Why is the player flickering up and down a bit?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Darxoon

I am making a 3D game with a custom player controller. For now, it has always worked. Now, for some reason, the player flickers a bit up and down, like shown here, because instead of a CollisionShape with a BoxShape or generated ConvexPolygonShape being used, I used “Create Trimesh Static Body” on my collision mesh I imported from blender to create a ConcavePolygonShape

Video that shows the player flickering up and down (I couldn’t get it to be embedded for some reason)

The custom player controller is pretty big, so I’m only going to show the important part (I left out the part that assigns the velocity and does other stuff not related to physics):

func _physics_process(delta):
	# do physics
	vertical_velocity -= gravity * delta
	horizontal_velocity *= horizontal_drag
	# ...

	var to_move: Vector3 = Vector3(horizontal_velocity.x, vertical_velocity, horizontal_velocity.y) + anim_velocity * delta
	var complete_velocity = move_and_slide(to_move, Vector3.UP)
	horizontal_velocity.x = complete_velocity.x
	horizontal_velocity.y = complete_velocity.z
	vertical_velocity = complete_velocity.y
	for i in range(get_slide_count()):
		emit_signal("collide", get_slide_collision(i))

I have no idea why it worked with BoxShapes but not with a generated ConcavePolygonShape

:bust_in_silhouette: Reply From: Calinou

This is a known bug in Godot 3.2, see this GitHub issue.

As a workaround, scale everything up by a 10× factor. This should make the jittering significantly less noticeable. Make sure to increase the Camera node’s Far property so you can see further away.

You can also try switching the physics engine to GodotPhysics in the Project Settings.

Thanks, this answer is really unsatisfying but I guess I have to wait until this will get fixed

Darxoon | 2020-10-14 09:28