I want a geometry to follow the camera and always be visible


Im making a geometry of a compass that should follow the camera. Such that when i move/rotate the camera, the compass stays in the same position on the screen. But i want the compass to rotate such that the compass north always points in the global 3d scene x-direction, and east always points in the z-direction. And the compass should always be visible/never hidden behind other objects regardless of the camera position.

I can think of 2 possible approaches for this:

  1. Attach the compass to the guiNode. This does everything I want except that it doesnt seem to give a depth perspective on the rotated compass (the part of the compass that is furthest from the camera isnt smaller then the part closest to the camera like it would be if it was attached to the rootNode (3d). Is there any way to get the depth perspective on objects attached to the guiNode?

  2. Attach the compass to the rootNode and calculate the compass position based on the camera position. The problem as i see now is that the compass might be hidden behind other geometries. Is there any way to always draw the compass on top?

Is there some other way of achieving what i want?

To solve number 1 you can always just render an image of the compass in blender, and a separate one for the needle and use those.

To keep it in the same position in the rootNode you can attach a CamNode:


This will keep it in the position on the screen, and should be perfect for your needle, as it will maintain its rotation relative to the parent.

For the actual “Compass” to maintain rotation relative to the camera, this code might come in handy:

You can add it to the Translucent bucket, if you want it drawn ontop of everything:

or you can attach another viewport (but as its not in the main scene, it won’t be affected by shadows etc):

You would also need to turn off depth testing as well as changing the bucket if you really wanted it drawn on everything.

Thank you for your responses. Ill try the renderbucket option first.