Forum rules - please read before posting.

Default NavMesh Issue

Hello!

I am currently working on a scene where one part of the scene can be accessed in two ways. This scene has three different navmeshes that can become the default depending on which way the player enters the scene or if they have entered the scene both ways. When using an interaction that goes into this area it changes the default navmesh depending on which interaction it is or if the other entering interaction has been used before.

The problem is that even after setting the default navmesh the game will still use the other navmeshs in the area that are not the default letting the player go into places they shouldn't be able to go into based off of their actions.

I've tried solving this problem by having all three navmeshs outside of the scene and have the one that needs to be the default be transformed or teleported back into the scene before the player it teleported into that part of the scene.

However, I can't get the navmeshes to teleport for transform even though they have moveable and remember transform scripts. Some times they move and most of the time they don't, but I can never get the default navmesh to teleport to where I want it to go. I've done these sort of things with objects that have had polygon collides before, so I'm not sure why this is not working properly.

Anyone know is there are any other solutions to this problem?

Comments

  • In 2D or 3D?

    Moving NavMeshes physically isn't best practice, but it's a problem that's hard to visualise.  Please post some images showing the layout of the scene along with any other relevant shots (how you're setting the Default NavMesh etc).

    To change NavMesh at runtime, you can use the Scene: Change setting Action.  Combined with Scene: Check, you can have your OnStart cutscene evaluate the previous scene and assign the correct NavMesh accordingly.
  • I found the solution, one of my actions was not connected properly after making my new adjustments to that interaction, but if there is another way to have it work without having to transform my navmeshes that would be great.

    I'm using 2d and here are my images http://imgur.com/a/BQwMQ

    The first image is what it would look like if the player had opened up both paths into the same area in this scene.

    The next two images are what it would look like if the player had opened one of the two ways into that area in the scene.

    In those first three pictures, each one has it's own navmesh for each choice the player could make, but in the next two pictures is the problem. Even if the player has only opened up one way and the game has set the appropriate navmesh as the default, the game still acts as though all of the navmeshes are all active allowing the player to walk onto the wall as seen in the next picture.

    The second to last picture is how I currently have the navmeshes in the area working. When the scene starts they are off of the scene and then when the player goes into that area the appropriate navmesh transforms to its correct location and becomes the default navmesh.

    The last picture is of some of the actions in one of the interactions for going into this area, where it uses variables to decide where each navmesh should be transformed to and which one will be the default navmesh.

    Thanks for taking the time to look at it.
  • edited August 2017
    What version of AC?

    A NavMesh is considered "on" when placed on the NavMesh layer.  Setting the Default NavMesh in the Scene: Change settings Action should change which one (and only one) is placed on that layer.

    In a separate Cutscene, create a single instance of this Action to test with, and run it from the Inspector while the game is running - does it place the chosen NavMesh on the correct layer, while turning all others off?

    However, it may not even be necessary to create 3 separate NavMeshes.  If a "Hole" exists on a NavMesh's boundary, it'll actually extend the NavMesh rather than subtract from it:

    image

    If the two "entrances" are separate PolygonColliders (with no NavMesh and not parented to the NavMesh), you can use the same Action to modify the Default NavMesh's holes at runtime.
  • After testing using the cutscene I figured it out! One part of the interaction wasn't hooked up properly. The first time the player uses the interaction it plays a few extra actions. I forgot to check to make sure that those extra interactions were hooked up properly after making some changes. So the first time the interaction would run it was not changing the Default NavMesh properly.

    Thanks so much for helping me out!
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.