Forum rules - please read before posting.

Navmesh misaligned or really offset?

image
AC version: 1.65.2
Unity version: 2018.2.13f1
In this one scene I'm working on, there are two problems. The navmesh in game does not reflect its placement in editor. So the character shows up above the navmesh and can walk across walls and so on. I can change the offset of the navmesh (changing the y offset to -.9 seems to do the trick), but then the pathfinding seems way off. So here in the screenshot the blue line doesn't seem to reflect the character's actual path? The character is always way above where the mouse click is, and while I don't need it to be perfect, it would be nice if the character ended up much closer approximately to the mouse click.

I've checked a couple other things, too, like making sure the player character's sprite is not offset, playing with the distance accuracy and other movement settings, and no luck.

Thanks for taking the time to look at this in advance.

Comments

  • There's not much detail to go on here, but it's likely that the audio icon in your screenshot is the player's root object.  The blue line next to it should also be their path.

    In which case, the NavMesh looks correct - and it's your player that has the problem.  But you say the sprite child is at the same position as their root?

    Let's see some images of the Player and sprite child's Inspector.  Could it be that the sprite's Pivot Point is incorrect?

    Try dropping in the 2D Demo's character, Brain2D (from /Assets/AdventureCreator/2D Demo/Resources), into the scene so that he overrides the default.  Does he play correctly?  If so, the issue will be with your own player.  If not, the issue will likely be with the NavMesh - in which case, let's see full-screen images of your scene, NavMesh Inspector and Scene/Settings Manager.
  • Brain worked fine... however, my default player works as expected in other scenes. Only in this scene is there the problem with pathfinding. Screenshots of navmesh, player, scene settings etc: https://drive.google.com/drive/folders/1rCdR7-Cy3_nRnc7A2FQOvL9OtMpUfLw-?usp=sharing
  • Two things I can see:

    1) Your NavMesh's PolygonCollider2D has a non-zero Offset value in the Y axis.  Set it to zero, and tweak the GameObject's position if necessary.

    2) Your Player's sprite child indeed has a non-zero local position - her Y value is 2.06.  This will need to be set to zero.  To correct her appearance relative to her root object's position, you can tweak the "Pivot point" of her sprites.  Generally they should be at the bottom, by her feet.
  • Thank you! Changing the pivot point worked.
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.