When I set a billboard effect on the base camera to follow an object in the scene, the camera points 180 degrees away, i.e., the back of the camera points towards the object.
The code snippet is:
my_effect = BillboardEffect.make(up_vector=(0,0,1), eye_relative=False, axial_rotate=False, offset=0, look_at=self.actorNodePath, look_at_point=(0,0,0))
What am I doing wrong?
That’s what a BillboardEffect does, because normally it’s used to rotate an object so that it is visible to the camera; that is, it rotates the -Y axis of the object to point to the camera or to the node you specify.
This means that when you apply it to the camera, it rotates the -Y axis of the camera to point to the node you specify.
One easy workaround is to apply the BillboardEffect to an ordinary node, and parent the camera to this node. Then set the camera’s HPR to 180,0,0.
Thanks for the quick reply and the fix David.
Now I understand it. Since the Panda3D coordinate frame assumes +Y as going through the viewport, -Y should point towards the viewport, i.e., the camera.
Should I also conclude that the “front” or the “face” of a model should be oriented towards its local -Y direction?
If your intention is to apply a billboard to the model so that it always keeps its “face” towards the camera, then yes. Otherwise, no.
It all depends on context. For instance, if you’re going to use the lookAt() method to rotate a model to look to an object, that method rotates the +Y axis to face that object, rather than the -Y axis. If you’re going to make the object swing like a door, it might depend entirely on how your door hinges are hooked up.