Rotating mesh to always face camera

Hi Babylon community! My first post here, I’m starting out on a big project, so I imagine there will be many more : )
Here’s my question:
I have a bunch of meshes which have a “front side”. What can I do to always make the front side face the viewer ? So if I move my camera (it’s a Fly camera), then the meshes automatically rotate to face the camera. Thank you very much for taking the time to read and respond if you will :slight_smile:

Hey @ti0! Welcome to the Babylon Family! Fantastic to have you here!

I think this is what you’re looking for:
https://doc.babylonjs.com/api/classes/babylon.transformnode#billboardmode_all

I also put this little playground together to demonstrate how it works:
https://playground.babylonjs.com/#4ECHM3

In this scene I have a cube that always faces the camera. If you switch the commenting on lines 18 and 19 you can see that the cube will ONLY rotate in Y to face the camera.

Hope that’s helpful!

3 Likes

This is exactly what I needed!
I’ve been using Babylon for nearly two months now, and I just love how insanely simple you make things!

1 Like