Godot Version
Godot 4.6.2.stable
Question
I’ve tried multiple times to make a camera with relative movement, but I can’t make anything work, I just wanted to know if anyone has any suggestions/ tutorials, I’m willing to change versions if it helps
If you share code, please wrap it inside three backticks or replace the code in the next block:
func _ready() -> void:
print("hello world")
What’s “relative movement”? Relative to what?
to the camera, I want to turn a 3rd person camera and still move forward so if I turn the camera completely around, I want the player to turn around and move in the new forward direction
You want player movement to be relative to camera’s viewing direction? Project the input directions to x and z axes and then project the result onto horizontal plane.
Two things to keep in mind:
- You track your camera independent to the player
- The player can access the camera.
So, to allow the player to face the model toward the camera direction this snippets could help:
# Get the input direction and handle the movement/deceleration.
var direction = Vector3(input_dir.x, 0, input_dir.y).rotated(Vector3.UP, _camera_mount.rotation.y)