0 votes

I've got a fixed projection perspective camera with a vertical FOV of 70 deg and rotated 45deg on Y axis.

Player movement is along Camera's X axis (right/left), Z axis (front/back), Y axis is set to 0.

What I'd like to achieve is for the player to move directly towards the screen top/bottom when pressing forward/back keys instead of moving along camera's Z axis which causes and illusion of traveling at an angle the further from the center of the screen you are (which makes sense but is not desired in this case).

The screenshot below depicts:

  • Green: Direction to camera
  • Blue: Camera's Z axis (player movement forward/back)
  • Red: Desired forward/back movement vector

enter image description here

I was able to brute-force some values like if camera's Z axis are at 45deg to the player-camera direction then the desired rotation would be half of that (22.5deg) but I can't seem to find a solution for the rest of the world positions due to my lack of Math knowledge.

Godot version 3.5
in Engine by (12 points)

Please log in or register to answer this question.

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.