Jump to content

Sprites don't consider parent's position?


Xeonzinc
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 3 years later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...