Forum rules - please read before posting.

NavmeshAgentIntegration stops player from moving

Hi
Has anyone seen this before?
https://drive.google.com/file/d/1OfSVOtF4W-znpUirF5xu2SJR5B3tcKql/view?usp=sharing

My man moves fine when AC is handling the movement (navmesh layer, point and click, Unity Navigation, motion control on the player set to Auto). However, if I then add the Navmeshagentintegration script and also a navmesh agent component, the player animates movement, but never moves. Sometimes he spontaniously moves backwards (whilst appearing to move forward) or off to the side, but never forward.

Disabling the integration script and the navmeshagent instantly makes it move again.

The integration script appears to be calling navmeshAgent.setDestination, and the navmesh gizmos shows that the intent is there to move.

I'm keen to use Navmesh (and perhaps later on A*) as when using just AC my player keeps getting stuck on the corners of things.

Olly

Comments

  • I'm afraid the link is giving me a "Video is unplayable" error.

    Does your character use Root Motion, and what is the character's Motion control set to (this'll be controlled by the Integration component)? It'll be best to see a screenshot of the character's full Inspector, if possible.

    I'm keen to use Navmesh (and perhaps later on A*) as when using just AC my player keeps getting stuck on the corners of things.

    If the player is getting stuck, try baking the NavMesh with an increased Agent Radius value.

    If your game is purely point-and-click, you might also be able to get away with checking Is Trigger on your wall colliders, since collision isn't necessary if you're only using pathfinding to move your characters.

  • Also, changing the agent radius doesn't ever seem to have much impact. Here's an example with the radius at double the size.

    https://drive.google.com/file/d/1XlwctjUogvqxvjHQfGRdL0Lz5W6Y2LZW/view?usp=sharing

  • I need to see your character's full Inspector - and specifically if they are relying on root motion.

    Does it work if you temporarily remove their Animator component?

    Here's an example with the radius at double the size.

    Try raising your Destination accuracy slider in the Settings Manager. When AC moves a character, it'll use this to determine how loosely it sticks to the NavMesh.

  • Root Motion!!!

    Thanks. Ticked that box and it's now working.

  • No, ignore that. I thought it worked but I hadn't noticed that the NavMeshAgent wasn't enabled, so Root Motion makes no difference.

  • edited June 2023

    Right. This is getting weirder.
    https://drive.google.com/file/d/1Q1BsEg41b6nM38T0Rni08y-6VqQdShvu/view?usp=sharing

    If I start with the NavmeshAgent and integration enabled, the character just stands there trying to walk.

    However if at runtime I then cycle the Motion setting in the Player component, everything starts working and you can see the Navmesh calculation red squares are over the player in the scene view, despite the components remainig the same.

    If I start the game with the Player component Motion setting set to Just Turning, it also stops moving. However if I then set Motion to Automatic, it immediately changes to Just Turning, and everything starts working as expected.

    Any ideas?

  • What's your Unity version?

    We'll need to see if this is an issue with the scene, or with your character. To do this, temporarily disable your own Player and drop Tin Pot - the Demo game's Player prefab - into the scene. They can be found in /Assets/AdventureCreator/Demo/Resources.

    Remove their Remember Animator and Animator components (in that order), and then attach the NavMeshAgent / NavMeshAgent Integration components. Do they then show the same issue, or is motion correct from the start?

  • Ok
    TinPot worked following your instructions.

    So I removed TinPot and put my player back, but set all my component settings to match. It turns out my player didn't have a Character Controller component on it. Adding that worked. Removing it made the same symptoms appear.

    Olly

  • There may be more to it - are you able to stop Tin Pot from moving by removing their Character Controller?

    What other components are on your character? There may be interference from another.

  • Here are my character components
    https://drive.google.com/file/d/16r5DHL5Lx45Y4-bFjeIVk4XNHdYNT5-2/view?usp=sharing

    Disabling Character Controller on Tinpot didn't do anything. He still works (annoyingly).

  • Inferring from your earlier post, am I to take it that this works until you remove the Character Controller?

    There's nothing custom attached to the character - at least not that I can see. If you'd like, you're welcome to PM me a .zip of your project. It's likely a minor setting or detail that we're dealing with, but I can't tell from these screenshots what it might be.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.