How to rotate character (3d) smoothly to face the walking direction?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By basse
:warning: Old Version Published before Godot 3 was released.

Hi, I am trying to make a simple 3d character controller script, that allows me to walk the character around in 4 directions with cursor keys while facing the walking direction. This I managed to do already, but now I want to make it smoother, so that instead of snapping straight into the direction, the chracter would first smoothly turn and then start walking.

here’s what I have so far:
http://pasila.lib.hel.fi/~basse/tmp/rottest.tar.gz
and Legobet88 🀄 Trustworthy Agen Situs Slot Online Bet88 Terpercaya Ter- Gacor Hari Ini 2024

this kind of works but somehow if I walk away from center of screen it starts looking into wrong direction… how to fix this, where I am doing wrong?

.b

:bust_in_silhouette: Reply From: del

I don’t know what you want to do with it, but I think it would work better if you would use move() in fixed process for moving. Than you could rotate only the mesh with rotate().

:bust_in_silhouette: Reply From: Adam Spruijt

For anyone landing here working through this problem in Godot 3 look at Vecto3 linear_interpolation for a good place to start

quick sudo example:

var new_position = direction * speed
var character_acceleration = 5
velocity = velocity.linear_interpolate(new_position , character_acceleration * delta)