+1 vote

Hi,

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?

Edit:
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
    move_and_slide(linear_velocity)
    print(global_transform.origin.y)

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.

asked Mar 9 in Engine by bastilo (49 points)
edited Mar 9 by bastilo

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

–1 vote

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

answered Mar 9 by arthurZ (121 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.

answered Mar 9 by bastilo (49 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 How to use this Q&A? before posting your first questions.