How to locate sprite?

Hi, I have some questions about sprite.
I loaded a sprite image in the scene named tree and wanted to move it to the position of mesh M (part of a imported model). I have tried

tree.position = M.position

and

tree.position = M.absolutePosition

to do that. but the position of model M is transformed according to a TransformNode named root, including rotation transformation, while the class Sprite only has position attribute, no rotation and parent attributes, so I don’t know how to assign the precise position of M to the sprite.

So, what can I do to solve it?

Assuming you model is in a .glb type file then in the array of imported meshes you should find your mesh M as meshes[1] not meshes[0]. You can view the current scene meshes using the inspector see The Inspector | Babylon.js Documentation

and also see warning 2

2 Likes

@Youmyin a small playground could definitely help here but absolute position should normally be enough ?

Thank you :slightly_smiling_face:

1 Like

Thank you , I am trying other solutions :slightly_smiling_face:

1 Like