I want to have the camera move with a mesh. Foward/backward motion was easy:

if (Input.is_key_pressed(KEY_W)):
    self.translation.z -= movement_speed; # relies on camera script to move camera
if (Input.is_key_pressed(KEY_S)):
    self.translation.z += movement_speed;

I just put those short blocks on both the camera and the mesh. But I can't figure out how to rotate the mesh about the camera while rotating the camera. If I just rotated the mesh, it would rotate about it's center point and end up unaligned with the camera. In photoshop, you can set anchor points to rotate a layer about a point other than the center. How can I set an anchor point to another element/node in godot?

EDIT:

The solution to rotation was pretty simple. All I had to do was make the camera a child of the mesh I wanted it to follow. But then the camera did not move with the mesh... How do I get the motion to work?

0 Answers