Jittering CharacterBody3D when setting global_position

Godot Version

4.6.2.stable

Question

Hey everyone.

I am trying to achieve having NPCs using NavAgents to find a free seat and then proceed to sit down.

Setting up the NavAgents and Mesh was actually pretty easy and works just fine, even with x-Amount of NPCs and free seats.

The problem I am facing is, that when placing the NPCs on the seat, they start to jitter.
My guess is, that the MeshInstances that make up the chair and table somehow collide with the CharacterMesh, causing the jitter. But I can’t seem to fix it.

This is the part of the code that places the NPC on the bench.
The “movement_target“ is a Area3D Node that is placed at the spot where the NPC is supposed to sit down.

	if navigation_agent.is_navigation_finished() and not is_navigation_done and self.global_position.distance_to(movement_target.global_position) < 2:
		self.set_global_position(movement_target.global_position)
		animation_player.play("Sitting_Enter")
		#animation_player.play("Sitting_Idle")
		waiting_to_order()
		is_navigation_done = true
		return

This is my NPC scene:

This is my table scene:

Also here is a short video of the jitter.

I’d really appreciate any help. Thanks in advance :slight_smile:

Have you tried turning off the CollisionShape3D(s) of the npc or the chair? If the problem is collision then that could fix the issue.

Another point to think about. Do you need your character to have a characterbody3d if you’re moving it following that navigation pattern? You’re moving it by updating the transform after all.

Hey, thanks for the answer. I just tried your suggestion and it worked just fine.
I first tried with disabling the Collision on the chair completely but ended up just putting it on a different layer, so that the player can still collide but the npc cant.

Thanks!

Hey, havent thought about that.
What would other node would you suggest and what benefits would that have?