Sprite always looking at camera

Hi, I am using sprite manager to create several instances of an image on scene as a sprite. I want to disable the behaviour of a sprite to keep looking at camera. I want it to face in the same direction when I pan or rotate camera. Example playground can be found here https://www.babylonjs-playground.com/#KLR6WC#1

1 Like

I always thought this was the main reason to use sprites :slight_smile: - It’s also written in the doc page - Sprites - Babylon.js Documentation .

What you want is probably a plane with an image as a texture.

Well I get their main use but for me that’s not the advantage I wanted to take from them. I was looking at loading 1 image with different quadrants for each product I render on scene and use this to minimize api calls. But this if not it’s okay for me to re-implement the sprites as a plane with an image texture.

I just need to know if there’s a way of disabling this feature such that I can still take advantage of the sprite manager.

AFAIK it is impossible. But it is very much possible I don’t have the right information :slight_smile:


Which direction? Sprites have no direction as they always face the camera. You would need to have a rotation in addition to the position to give each sprite an orientation that is independent from the camera, which is not supported by the sprite / sprite manager.

Ohhh okay… I’ll go with the plane asset and use these images as textures then.

Quite recently I asked a similar question regarding plane - lookAt() for camera. @Evgeni_Popov gave a solution for this:
yourSpriteObject.billboardMode = BABYLON.AbstractMesh.BILLBOARDMODE_ALL;

sprite object does not expose a billboardMode property according to api. Sprite - Babylon.js Documentation

Oh sorry I had not seen that. I actually used plane with image texture and set it with alpha cutoff.

@saifshk17 can you please hook me up with a link to that particular issue

https://playground.babylonjs.com/#YDO1F#454 here you go. I have added a line at the end to always look at camera.Turn this off and you will have your solution. You can add your png to this plane texture and see how it works for you.
Also, if you want your image to have both sides then set mat.backFaceCulling = false; otherwise just set it to true for one side culling.

1 Like