CameraNode lookAt() problem

hey there,



i’ve got a Node node and a CameraNode camNode in that node.-> node.attachChild(camNode)



Then i rotate the node → node.rotate(0.0f, ((tpf/100)pro)rotateSpeed_x-1, 0.0f);



Then i move the camNode along the Y axis.

Vector3f movement = new Vector3f(camNode.getLocalTranslation().x,camNode.getLocalTranslation().y-(tpf
zoomSpeed*10),camNode.getLocalTranslation().z);

camNode.setLocalTranslation(movement);



and then i try to make the camNode look back the node’s center → camNode.lookAt(node.getLocalTranslation(), Vector3f.UNIT_Y);



But this doenst work.

If i add a box → node.attachChild(box) the box is not in the center of the screen, its horizontally displaced. it looks somehow like the camara copied the rotation value of the node. Everything works fine if i do not rotate the node before i call lookAt().



Any ideas?

Not sure if I understood right, you rotate the node where the cameranode is attached to? Might be that the lookat does not process parent rotations then.

1 Like
@EmpirePhoenix said:
Not sure if I understood right, you rotate the node where the cameranode is attached to?

yes
@EmpirePhoenix said:
Might be that the lookat does not process parent rotations then.

Hm this could be, it looks more like its getting the root node rotation value + rotate itself by that value. if i set the world rotation to the local rotation it works but something else is fucked up