Weird rotations using the wander task

Gege256

New member
Hello there,

First because this is my first post here id like to say i m more than impressed by the overall quality of the UCC and the behavior trees, real professional work.

My issue comes from the wander task, my tree is simple as entry/wander and repeat when complete.I m using wander with navMeshAgent movement.
At some stop the agent makes some weird rotation sometimes more than 360 degrees rotation sometimes nothing.
Of course i checked all my setting like Stopping distance in agent and wander settings in inspector, everything seems ok and in fact if i set wander to use no pause (maxpausetime=0) those weird rotations disapears and it works fine! I also tried to disable UpdateRotation and it also make it disapear but i d like to keep it for obvious reasons.

Any idea how i could fix this ?Because i d really like to keep those pauses.

Thanks in advance.
Please find a gif below to demonstrate the weird behavior.

updaterotation.gif
 
Happy to hear that your enjoying our assets.

That gif looks like the character is jittering as they are trying to land directly on the destination. Try increasing the stopping distance for your NavMeshAgent
 
Well it works if i set to a ridiculous 3.5 meters but still something weird is happening in NavMeshMovement functions.
Any idea why it works with initial stopping distance (1m) only if i disable pause(maxpausetime=0) ?

As stated by others your support is great,
Thank you very much for your help.
 
3.5 is way too high. I just tried a repro scene and have it working with a value of 0.1. I'm not sure what the pause time has to do with it. Here's a sample repro scene with it working - are you able to get the weird turning in this scene?
 

Attachments

  • repro.unitypackage
    20.9 KB · Views: 10
No, i m definitely unable to reproduce the case in the repro scene, my character also works fine in this repro scene; i guess we can close this ticket i ll just investigate the navmesh of my original scene.

By the way in the meantime i did a bit of digging in wander & navMeshMovement code and something called my attention.
To wander , in TrySetTarget() you set a 3D random direction and multiply it by wander distance but what if the resulting position is high above ground or deep below ?
Shouldn t you retrieve hit.position from NavMesh.SamplePosition() to avoid the potential problem mentionned above ?

Thanks for your time.
 
Good to hear that the scene helped narrow down the issue.

To wander , in TrySetTarget() you set a 3D random direction and multiply it by wander distance but what if the resulting position is high above ground or deep below ?
Shouldn t you retrieve hit.position from NavMesh.SamplePosition() to avoid the potential problem mentionned above ?
When you are setting the destination the NavMeshAgent will automatically have it positioned on the ground so a 3D space is no problem.
 
Top