Forum rules - please read before posting.

Player and navmesh

Hi!

I dont understand why my player dosnt walk aroud/avoids the holes i make.
and its like his colider is in the center of him or something.

https://imgur.com/ImDHqwV
https://imgur.com/BvGaQzz
https://imgur.com/Bw6tbrc
https://imgur.com/YHOUIPt

How can i make so that his feets are the area that collides with the edges of the navmesh?

Malte

Comments

  • edited June 2019

    His centre is where the large "Audio Source" gizmo icon is. This needs to be at the bottom, by his feet.

    To correct this, you need to raise up his sprite(s) - which you can do by selecting their Inspectors and setting the "Pivot" to "Bottom". That'll cause his centre to be positioned at his feet, rather than his waist - see the Manual's "Character animation (Sprites Unity)" or "Character animation (Sprites Unity Complex)" chapters.

    The "Circle Collider 2D" also needs adjusting - remove the Offset value so that it's at the object's centre (though visually this'll be back to his feet after correcting the sprite pivots).

    See the included 2D Demo's "Brain2D" player prefab for an example on how a 2D character should be set up.

  • https://imgur.com/rOndmQQ
    the holes in scene

    https://imgur.com/qQlSnMt
    hole1 obj properties

    https://imgur.com/840BoQN
    player prefab

    I adjusted the circle collider.

    The i looked through the 3d camera and saw that the holes were not zeroed at the z axis, so i fixed that.

    hole1 seems to work well now after i moved the pivot to bottom.
    hole2 the player just walks through.

    do you see anything odd?

    Malte

  • If hole1 works but hole2 doesn't, then let's see a screenshot of hole2's Inspector as a comparison.

    Try unparenting both hole1 and hole2 from Default NavMesh, so that all three of them are children of the _NavMesh folder object.

  • https://imgur.com/AgEPdml
    I´ve unparented the holes

    https://imgur.com/IMfSbxf
    holes inspector comparison

    https://imgur.com/0YPrJo4
    My player can still stand on the little pine tree. :/

    https://imgur.com/riR6zFx
    player standing beside the little pine tree. ( and hole 2)

  • This may be an issue of size vs accuracy - hole2 is smaller and your player's yello sphere gizmo (which represents accuracy) is very large by comparison.

    Two things to test:

    1. Check Retro-style movement? in the Player Inspector.
    2. Drop the 2D Demo's Player prefab, Brain2D, into your scene file and then run it. He can be found in /AdventureCreator/2D Demo/Resources.

    What are the results of both? If neither resolve the issue, PM me the scene file and I'll take a look.

  • edited August 2019

    I shrinked the yellow sphere/increased the destination accuracy.
    and now the player is "noticing" hole2.
    And he´s walking where i want him to walk within the default navmesh.
    so its solved.

    Thank you so much!.

    Malte

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.