0 votes

This video illustrates the problems.

To try to describe them, basically when I put linear interpolation code for adding acceleration and deceleration to already working code several things break. After months of trying and giving up, I cant do this anymore and will require help. The project's code can be found open source here.

(It's a modified version of this)

in Engine by (52 points)

1 Answer

0 votes

I'm not sure about the code you currently have but if all else fails I'd suggest lerping a velocity Vector3 with global_transform.basis.xform(direction) like this.

var velocity : Vector3

func _process(delta):
    var local_z_movement = Input.get_action_strength("move_forward") - Input.get_action_strength("move_backward")
    var local_x_movement = Input.get_action_strength("move_left") - Input.get_action_strength("move_right")

    var intended_velocity = global_transform.basis.xform(Vector3(local_x_movement, 0, local_z_movement)
    velocity = lerp(velocity, intended_velocity, delta)
by (3,249 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.