See here:

I want the blue box to always face the camera by rotating on the Z-axis just like the yellow box does on the Y-axis using BILLBOARDMODE_Y.

For example, I don’t want this to be possible, I want the blue box to rotate on the Z-axis to face the camera

Is it a bug or am I using it wrong?

The Z axis is the blue arrow, so I think you want to rotate around the X axis (red arrow) instead?

You can use the TransformNode.lookAt method to do it, as you have to apply a 90° correction to align the mesh with the camera (something that you can’t do with billboards):

@Evgeni_Popov I want thee blue box to spin around the pole like the yellow box does, to try to face the camera. My game has trees represented as planes, and some of them can grow along the X or Z axis.

Edit: I found how to get the behavior I want:

Is this the least expensive way to get this result, though?

Also, it still bahaves slightly different when looking down from its top, the blue one spins around a little crazy, while the yellow one is stable when looking down from the top.

It seems fine to me. You can use FromLookDirectionRHToRef instead of FromLookDirectionRH to avoid some GC.

I did not reproduce with your PG, but I think it’s the gimbal lock problem. The best way to avoid it is to not allow the camera looking straight down (set constraints on camera.beta).

Yeah it seems to be. Actually, it looks like it’s the same as using BILLBOARDMODE_Y | BILLBOARDMODE_USE_POSITION:


Which results in no “twisting around” near the center of the view, but I think this doesn’t looks as good for my use case, so maybe it’s all good as is!