Forum rules - please read before posting.

Default Nav Mesh not working at scene start, working perfectly after teleporting away and back

Hello.
I have multiple rooms in my scene.
The player starts in a room with two holes in its nav mesh (the default nav nesh).
The holes in this room do not overlap the nav mesh.

At start of scene, the player gets stuck in the default nav mesh, walks on the spot, and cannot access one part of the nav mesh that is behind the larger hole. It is horrible! (particularly because I just made a really detailed set of graphics) I also had problems with the player not appearing where the 2DPlayerStart marker was and so on.

If, whilst playing, I send the player to another location (which involves using a hotspot with an Action list that reassigns nav mesh, sorting map, marker to teleport to and so on) and then send the player back to the first location, (involving another change of nav mesh, sorting map, player marker etc) THEN the default nav mesh functions perfectly with the holes. Which means - I think - that it must be a problem with the settings that are being called at the start of the scene.

I cannot figure out what I am doing wrong or where I should look. I have checked the scene settings within the Scene Manager and they all correlate with the settings I later call when the player returns to the default nav mesh. I have even tried creating an OnStart cutscene where I call all of the above properties (nav mesh, sorting map, player start etc) just as I do when the player is teleported back to the problem nav mesh, and it still doesn't work properly on starting the scene.

HELP. What can I try? Where should I look? I feel like I am missing something obvious... Thanks!

Comments

  • So that we can rule out this being related to your player, temporarily drop the 2D Demo's Brain2D player prefab into your scene file so that he overrides your own. Does he exhibit the same trouble?

    As this is a visual problem, I'll need to see the situation to more clearly understand it. Can you share some screenshots to explain exactly what's going on?

    Please also let me know your AC and Unity version numbers.

  • Hi Chris. Thanks for your fast response.

    I put Brain into the scene and he had similar problems to my character - he got stuck a lot, couldn't exit the scene half the time and couldn't get through the gaps between hole and default nav mesh. Once he had exited the room and returned (via the teleport method) he was fine, moving around the nav nesh as desired. Just like with my PlayerCharacter.

    Here https://imgur.com/XYL3yfE is an image of my nav mesh and hole situation - the green line represents the default nav mesh, the orange lines represent the holes in the nav mesh. The red dots are the places I have tried placing the player start marker.

    Here also is a link to a screenshot of my Scene Manager, in case that is useful...
    https://imgur.com/0uw7urQ

    and the details of my navmesh in the Inspector https://imgur.com/XWIlU9u

    Unity 2018.1.0f2
    Adventure Creator v1.70.2

    Thanks!

  • Best to see this for myself. A .unitypackage file of your game's Managers and scene file should be enough. Graphics of the scene shouldn't be necessary, nor should your Player if Brain is also showing the issue. Include any custom prefabs for the scene if you've made any.

    Then PM it to me along with instructions on how to recreate the issue (and teleport in/out to fix it) and I'll take a look.

  • Certainly as it relates to Brain2D, who I'm testing with, the issue is to do with the fact that your scene has non-Trigger colliders (e.g. the bathtub Hotspot). Brain, who relies on a Rigidbody2D, is colliding with them and its hindering his movement.

    You'll need to make sure your scene doesn't have such colliders when its not necessary, or simply remove the Rigidbody component from your characters.

  • AH - great relief. This is a super rookie mistake. Apologies and thanks. You're right.

    When one creates a new hotspot the IsTrigger element is checked on the Box Collider 2D as default. If one then creates a polygon Collider 2D component for strangely shaped objects the default for IsTrigger is unchecked. I simply hadn't noticed or thought to look outside of the NavMesh's for the source of the problem.

    What's strange is that the hotspots weren't interfering when I returned to the location. I wonder why that is?

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.