Axis - indicator reloded (solved)

Oops, you’re right. Simply flipping the euler angles doesn’t get you the rotation relative to the world. And my compass method has a similar problem. I think it would work if aspect2d used the camera’s coordinates but it uses render’s so setting the compass to render does nothing, and I don’t think there is any special node that is “render as seen from camera”.

Here is a solution using a task…

corner = aspect2d.attachNewNode("corner of screen")
corner.setPos(-0.8, 0, -0.8)
axis = loader.loadModel("zup-axis")
axis.setScale(0.04)
axis.reparentTo(corner)
def axisTask(task):
    axis.setQuat(render.getQuat(camera))
    return task.cont
taskMgr.add(axisTask, "axisTask")

render.getQuat(camera) gets render’s rotation, in quaternion form, as seen from camera.

I also got a version working with setCompass, but for it to work the corner node has to be attached to the camera in 3D space. I love eliminating a task, but don’t do this as you lose the resolution independent benefit of aspect2d. Just for show…

corner = camera.attachNewNode("corner of screen")
corner.setPos(-3, 10, -2)
axis = loader.loadModel("zup-axis")
axis.setDepthTest(False)
axis.setBin("fixed",0)
axis.setScale(0.08)
axis.reparentTo(corner)
axis.setCompass()