#How I can make the ship rotate to the direction of the movement?

9 messages · Page 1 of 1 (latest)

bleak raptor
#

I am new to this engine, and it probably is a very basic answer, but I don't really get GDScript yet.

#

I used one of the templates as base

blissful matrix
#

Add this

  rotation = lerp_angle(rotation, velocity.angle(), 0.1)

It should rotate slowly but I believe the result will be wrong due to your setup. In godot 0 degree is facing right

bleak raptor
#

Oh

bleak raptor
#

The only thing being that once I stop pressing keys, the ship goes back to being 90 degrees again

#

This is my code rn

torn nymph
#

@bleak raptor If the velocity vector is zero, then velocity.angle() can't be relied upon to give any sensible answer at all. It seems like what you really want to do is change the rotation only when the ship is moving (so velocity is not zero) not when it is standing still.