Stutter when the player is on the ground

Godot Version

Godot 4.3

Question

I made a super simple scene where there’s a character, a camera and a floor.
However, when I am on the ground, the screen begins to stutter; while I disable the gravity or just jump, the screen becomes smooth. What could be the problem?

Thanks in advance.


The character’s code(basically the default one but added the camera rotation):

extends CharacterBody3D


const SPEED = 5.0
const JUMP_VELOCITY = 4.5
var mouseSensibility := 600
var mouse_relative_x := 0
var mouse_relative_y := 0
@onready var Camera = $Camera3D

func _physics_process(delta: float) -> void:
	# Add the gravity.
	if not is_on_floor():
		velocity += get_gravity() * delta

	# Handle jump.
	if Input.is_action_just_pressed("ui_accept") and is_on_floor():
		velocity.y = JUMP_VELOCITY
		print(2)


	# Get the input direction and handle the movement/deceleration.
	# As good practice, you should replace UI actions with custom gameplay actions.
	var input_dir := Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
	var direction := (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
	if direction:
		velocity.x = direction.x * SPEED
		velocity.z = direction.z * SPEED
	else:
		velocity.x = move_toward(velocity.x, 0, SPEED)
		velocity.z = move_toward(velocity.z, 0, SPEED)

	move_and_slide()

func _input(event):
	if event is InputEventMouseMotion:
		rotation.y -= event.relative.x / mouseSensibility
		Camera.rotation.x -= event.relative.y / mouseSensibility
		Camera.rotation.x = clamp(Camera.rotation.x, deg_to_rad(-90), deg_to_rad(90) )
		mouse_relative_x = clamp(event.relative.x, -50, 50)
		mouse_relative_y = clamp(event.relative.y, -50, 10)

Try switching collision shape of player to something simpler, like a capsule.

it is a capsule.

I’m talking about CollisionShape3D, not mesh.
On screenshot it shows “ConvexPoly” with array size of 1154.

Cool, thanks!
Yeah, after changing CollisionShape3D to a real capsule, there is no stutter.

Also, I find that if I use Jolt Physics Engine, the stutter can be fixed as well.

In general, when it comes to physics calculations, you want to use as simplest shape as possible. Maybe Jolts Physics Engine doing some auto optimizations.