+1 vote

How can you make the character rotate based on the direction of the movement?
for example when the character is running forward and is now running back the character "not the camera" will rotate facing the camera.

Godot version 3.3
in Engine by (41 points)

Can you elaborate , is this a first person camera or third??

2 Answers

+1 vote

Then don't make the camera a child of the player, make it a child of the level and code it to follow the player . To rotate the character in the direction of the movement, set their velocity (assuming you have this variable) as velocity=velocity.rotated(rotation).This will work if you are rotating the character yourself when certain keys are pressed.

To make the camera follow the player all you have to play with is the translation variable. Just get the distance between the character and the camera at the start of the game and be adding it to the translation of the camera in _process(delta).

by (1,333 points)

You can also reset the cameras rotation to zero in _process() while its still a child of the player.

0 votes

Answering your Question LIVE on YouTube: https://www.youtube.com/watch?v=fFQLwxayunI

by (597 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.