Xeonzinc Posted November 18, 2014 Share Posted November 18, 2014 Hi, I've been using sprites but they don't seem to following the normal rules of being based off the parent objects position? I've made a quick example here to illustrate:http://www.babylonjs-playground.com/#KFFKV#7 Essentially the case seems to be:• A sprite can have another sprite as it's parent, but won't incorporate the parent's position• A sprite can have a mesh as it's parent, but won't incorporate the parent's position• A mesh cannot have a sprite as a parent• A mesh can have a mesh as a parent, and the child correctly follows the parent Is this correct? I was under the impression all objects with position should follow the parent:child positioning? Quote Link to comment Share on other sites More sharing options...
joshcamas Posted November 19, 2014 Share Posted November 19, 2014 I'm assuming it has to do with a sprites inside a manager all being the same mesh. Quote Link to comment Share on other sites More sharing options...
Xeonzinc Posted November 19, 2014 Author Share Posted November 19, 2014 This seems like it would limit their usefulness somewhat. I suppose i could create my own function to constantly update the sprite world position based on my own defined parent and local position, but it seems inefficient. Anyone have any better ideas? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 20, 2014 Share Posted November 20, 2014 Because sprites are based on a different part of code they do not interfere with meshes. I think I can easily add a parent property on a sprite to inherit from another mesh or sprite position but is it really an important topic? Quote Link to comment Share on other sites More sharing options...
Xeonzinc Posted November 24, 2014 Author Share Posted November 24, 2014 Probably not, I just assumed sprites would have a parent property like lights and cameras etc. so was a bit confused (I should check documentation more in future) My reason for asking was to add a sprite-based health bar to a unit (with the sprite cells offering a convenient way to set the health level with some nice 2D graphics). I think the best option will be to switch to using a plane and write a function to select the image 'cell' with U/V offsets/scales. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Butterwell Posted January 30, 2018 Share Posted January 30, 2018 Well, I'd like to use sprites as part of a dynamic board. Having them all move together once placed would be a lovely thing. Quote Link to comment Share on other sites More sharing options...
Butterwell Posted January 30, 2018 Share Posted January 30, 2018 Never mind. I went with flat meshes. They will be superior when rearranging the board, anyway. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.