Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | bastilo |
Hi,
I have a KinematicBody (3D) that has simple gravity (every physics process tick: add the gravity value to the y coordinate via “move_and_slide”). 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.
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.
Golimonkey | 2020-03-10 13:47