+1 vote


I have a KinematicBody (3D) that has simple gravity (every physics process tick: add the gravity value to the y coordinate via "moveandslide"). It moves smoothly on one StaticBody but if it reaches the next StaticBody (which is - in this case - a copy of the same body directly next to the first StaticBody) it bounces a little bit up for a very small moment.
I think it's a very simple task to move a KinematicBody over different collision shapes of the environment without bouncing or stuttering. What do I miss here?

To try it for yourself just create a scene with two StaticBody boxes next to each other but on the same y level and a KinematicBody with this script:

extends KinematicBody

const GRAVITY = 1.0
const SPEED = 1.0

func _physics_process(delta):
    var linear_velocity = Vector3(0, -GRAVITY, 0)
    if Input.is_action_pressed("ui_up"): linear_velocity.z -= SPEED
    if Input.is_action_pressed("ui_down"): linear_velocity.z += SPEED

In my case, the KinematicBody is on y position 0.80902 when it's colliding with one collision box and on 0.817xxx (the last 3 digits differ each physics frame) when it's colliding with both boxes at the same time.

in Engine by (50 points)
edited by

I have expirienced same problem. It is very bad if you are colliding with 4 static bodies, for exsample standing on the edge of 4 cubes like you would in voxel(minecraft) like game.

2 Answers

–2 votes

Maybe using move_and_slide_with_snap with the snap == true could solve it.

by (175 points)

Sadly, this is not working either. If I apply the linear velocity vector as the snap vector it just behaves as before (bouncing) and if I apply Vector3(0, -1, 0) as the snap vector the player just stops before the new StaticBody (like it behaves if I just use moveandcollide).

Did you try the max angle argument equals 46 or above degrees (even 60ยบ) in the move_and_slide_with_snap? Please, try this.

Yes, this has the same effect as before.

+1 vote

I just found out that this is an engine bug that is hopefully fixed in the next release.

by (50 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 webmaster@godotengine.org with your username.