0 votes

My camera is tilted to look at the characters feet. I want to be able to rotate the camera around the axis without moving the character using keys. I can get it to rotate but it tilts around the cameras tilted axis which isn't what I want. I am not a programmer but trying to learn so I would appreciate some help in this.


in Engine by (296 points)

I'm not sure but by my understandings of physics and mathematics it involves movement via a circular path( aka (x - a)² + (y - b)² + (z-c)² = r² ) and a rotation to the center point( aka (a,b,c))

Any advice on how to set the axis around which to rotate in code? I want it to rotate around the glodal axis. I've just started with 3d and only used 2d up until now so on a steep learning curve.

I'm not sure about "tilt" (sorry I'm not english^^) so... do you want to be able to rotate the camera left, right, up and down, like in an FPS but with keys?

Not sure if applies to the effect you are looking for but you can use a spatial node as parent of the camera, with the camera on the desired position.
Make the camera look at it and rotate the parent instead of the camera so the later will stay on the same relative position.

1 Answer

+1 vote

I might be wrong, but I think you can use rotate_x / rotate_y / rotate_z to rotate in local axis and set_rotation() / set_rotation_deg() to rotate around global axis.

by (372 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.