+3 votes

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 http://www.pasteall.org/66666

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

in Engine by (15 points)

2 Answers

–2 votes

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().

by (46 points)
0 votes

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)
by (52 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.