Forum rules - please read before posting.

Character sometimes walks in place at edge of NavMesh

I've finished the draft of a small 2D point-and-click adventure using AC (yay!), and there's one bug that I haven't been able to find a forum post about.

Sometimes, when I click outside the NavMesh to have the player/character walk to the edge of it, sometimes they get stuck at the edge walking in place. I think it mainly happens in corners, but it's a little unpredictable.

Here's a video of it happening: https://youtu.be/aGPXvMBP7YQ

Thanks in advance for any help dealing with this.

Comments

  • The video shows the issue, but not much in the way of what might cause it. Let's see some screens of your Player's Inspector, and the objects that make up the scene.

    What are your AC and Unity versions, also?

    Is it possible they're getting caught on a collider? Unless you have a specific need to, it's not strictly necessary to have a Rigidbody2D component on your character - if they have one, try removing it to see if that helps.

  • I removed the player's Rigidbody2D, but my player still gets stuck walking in place on the edge of the Navmesh sometimes. None of the other objects in the scene have colliders or Rigidbody components. Just in case, I tried turning off everything I could think of in the scene (Markers, Hotspots, Objects, Sorting Map) except the player and the navmesh, and it's still happening. So let's start there, I guess.

    Here are some images:
    Image of scene with just player & navmesh
    Player Prefab Rigidbody2D and Collider Inspector
    Player Prefab Player Inspector
    Player Child Sprite Inspector
    Default Navmesh Inspector
    AC Scene Settings with Default Sorting Map Removed

    Any of those ring a bell? Really hoping I just missed a setting somewhere.

    Thanks again for any help on this.

  • I'm afraid I'm getting "Access denied" messages on those links.

    Does the issue occur if you drop the 2D Demo's Player prefab, Brain2D, into the scene to override your own?

  • Sorry about that. Should have shared through my Google Drive or something.

    I got Brain into my project, and he does not have this problem. So I compared all their attributes. There were a couple of things different (RigidBody2D type was Dynamic for Etuni, Kinematic for Brain2D; Turn root object in 3D was on for Etuni, Off for Brain2D; Facing directions 4 for Etuni, 8 for Brain2D; Etuni has active Frame flipping that Brain2D does not; and some differences in movement speed), but the "turn before walking" seems to be the issue.

    The "Turn before walking?" was unchecked for Etuni (My player), but checked for Brain2D. When it is unchecked, Etuni does their little moonwalk, but when it is checked, Etuni does not and stops as they should.

    I tried to do the opposite (ie, give Brain2D Etuni's settings), but this didn't reproduce the problem. So obviously something is up with my character. Glad I can fix the problem by checking Turn Before Walking, but any thoughts as to why this might happen?

    Just thinking about my next project and how I could create a better character.

  • Nothing springs to mind - I would need to see those images before I could have an idea.

    If it works though, it works!

  • edited May 2020
    I had a similar problem, but my issue was due to not having set idle poses for the rest of the states that it could be in.

    E.g. I had 8 directional movement on, and would use left and right walking for UpRight walking and UpLeft walking, so if the character walked true left he would stop in his left idle. But, if he happened to walk UpLeft it would look exactly the same, but there wasn't an UpLeft idle pose, so it would continually run the UpLeft walk animation at NavMesh edges even though the character had stopped moving.

    Felt like a dummy when I went through a million different settings and realized that was the issue. Unsure if it's your issue, but that was my experience!
  • It's been a while since I set up this character, so I had to go look and make sure I had made Idle images.

    @Crayon That was exactly my issue! UgH! I'm using 4 facing directions. I was frame flipping "Left Mirrors Right", but my right idle image was labeled DR (Down right) instead of R (Right). Once I changed that, it worked.

    In hindsight, I realize now that Etuni would always face the same direction when they did the walk in place thing.

    Thanks so much!

  • Welcome to the community, @Crayon.

    AC should have been reporting a missing idle animation - was that the case?

    Though this all seems sorting now, for completeness: if you switch a character's "Animation engine" to "Sprites Unity Complex", animation is then controlled via Animator parameters and transitions. This gives you total control over how animation is played back, so that you can e.g. transition to a left-facing idle animation even if they're facing up-left and have an up-left-facing walking animation.

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.