How to stop characterbody3d sliding on landing

Godot Version

Godot Engine v4.2.2.stable.official [15073afe3]

Question

To keep it short my character model (CharacterBody3D) is sliding on the ground after jumping and landing and I do not know how to stop this.
Setting the velocity to 0 on landing before calling move_and_slide() in the _physics_process() doesn’t seem to to anything.

Could you post your relevant code?

Already fixed the issue, I was adding the direction to the velocity later in the code execution e.g. velocity never could have been 0 at this point. Needed to set the direction and velocity to 0 too at the time of landing.

At landing

velocity = Vector3(0,0,0);
currentDirection = Vector3(0,0,0);

Calc current velocity

velocity.x = lerp(velocity.x, currentDirection.x * currentSpeed, LERP_VAL);
velocity.z = lerp(velocity.z, currentDirection.z * currentSpeed, LERP_VAL);

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.