Godot Version
v 4.7.2
Question
Hello, so i am trying to make a tile based movement and a camera that follows player in a specific way. The way it would work is the player would move one tile to the left, right, forward or backward - but only when player finished the movement, camera would catch up to the player instead of doing right after it player started moving.
I am doing it in the 3d scene and i unlinked the camera from the character-body in order to be able to code the moment when the camera starts to move. I am quite a beginner at coding and i tried using lerp, but i can’t manage to set it only for specific axis and when i do it for the general position, the camera just goes straight to the player while i need it to move only horizontally.
i am gonna paste the current code i have attached as a script to the camera, though it is not like this is the only code that i tried.
Edit - i am not sure if lerp is called a function so i removed the word
Edit - Oh right, sorry i forgot to mention it. I am trying to make a top-down game in a 3d scene so camera has to look only in one direction and move to the left, right, forward or backwards
func _physics_process(delta: float) -> void:
if position.distance_to(player.position) > 10:
position = lerp(position, player.position, 1.2 * delta)