Change local position of a sprite

Hello! I’m facing an issue at the moment regarding the sprites.

I have a sprite who follow another mesh position. It would be easier to simply set the sprite a child of the mesh, however it seems impossible so I simply copy pasted the exact same position for both of them to fake it.

The problem I’m facing is that I would like my sprite to also move on itself locally. For example, I would like my sprite to fall down (follow the mesh) but also add a bounce animation locally (simulate a bounce effect with lerping position values). I don’t see any way of doing this at the moment. If my sprite was a mesh instead, it would be quite easy however, I need it to be a sprite.

Is there something I could do? Thanks hehe

You can use a mesh’s world matrix to position the sprite relative to it: Sprites Examples | Babylon.js Playground (babylonjs.com)

1 Like

This is an awesome trick !!! :slight_smile:

1 Like