Thanks to the debug feature for the agent pathfinding Godot now has I'm 99% sure this is likely a navmesh agent setup issue rather than any kind of baking or code problem. I thought I had the agent setup clocked in properly but the "Let's all decide to get stuck rather than move" issue has happened again. I can get it mostly working with my two adult villagers but the two children seem to be refusing to move despite the path calculating. I would be very surprised if this was a code issue because it's copy and pasted from the two adult villagers which is working fine.
Relevant pseudo code just in case:
func _ready():
isWondering = true
villagerStatusText.text = "Wondering"
localVillageManager = get_parent_node_3d()
villagerAgentRandomisedPosition()
randomGenerator.randomize()
randomPoint = RandomPointInCircle(50.0)
wonderVector3 = Vector3(localVillageManager.global_transform.origin.x + randomPoint.x, 0.0, localVillageManager.global_transform.origin.z + randomPoint.y)
maleChildNavigationAgent.set_target_position(wonderVector3)
func _physics_process(delta):
if isWalking == true:
var lookDirection = atan2(velocity.x, velocity.z)
rotation.y = lerp (rotation.y, lookDirection, 1 * delta)
if isWondering == true:
movementDelta = speed * delta
var currentLocation = global_transform.origin
var nextLocation = maleChildNavigationAgent.get_next_path_position()
customVelocity = (nextLocation - currentLocation).normalized() * movementDelta
maleChildNavigationAgent.set_velocity(customVelocity)
func _on_MaleAdultNavigationAgent_velocity_computed(safe_velocity):
velocity = safe_velocity
move_and_slide()
func villagerAgentRandomisedPosition():
villagerWanderTimer.wait_time = 3
speed = 500
isWondering = true
isNavMeshPathFinished = false
isWalking = true
MaleVillagerWalkingAnimation()
randomGenerator.randomize()
randomPoint = RandomPointInCircle(50.0)
wonderVector3 = Vector3(localVillageManager.global_transform.origin.x + randomPoint.x, 0.0, localVillageManager.global_transform.origin.z + randomPoint.y)
maleChildNavigationAgent.set_target_position(wonderVector3)
func _on_villager_wander_timer_timeout():
villagerAgentRandomisedPosition()
Me attempting to debug the problem, purple and green debug paths are the adults, pink and orange are the children.



What was interesting for me, when it was a totally flat surface I was dealing with, Total Bean which is a project I'm playing around with now I'm using a standard click to move navmesh agent and the capsule jitters every time it stops and like with the agents here getting stuck no amount of tweaking of the distance or height offset seems to fix this problem. If Godot could have more visual debugging with regards to collision setup and height that would be so useful.