1
\$\begingroup\$

I apologize for the vague title. I really wish I could ask something more specific, but I can't. I had my click-to-move script working fine with the NavMesh. I showed it to my colleague earlier today, and must have accidenntally made a change and saved. Now the guy's not walking.

There are no errors and my debugging leads me to believe all code paths are working as expected. When I click on a location, it checks that it is valid on the NavMesh, then updates the NavMeshAgent's destination:

I am not going to post the code because I don't think the problem resides there, but rather it was something I did in the editor. The character also turns in the correct direction, and starts the walk animation correctly, but it looks like something is blocking its movement, and I can't figure out what that is.

The following screenshots will help clarify my situation. Note that the camera is shaking because its position is set to match the character's in Update. The character appears to be colliding with something, which makes it look like the camera is colliding too (note this is not a physics-based game in any way).

enter image description here

enter image description here

enter image description here

enter image description here

edit here's some more screenshots, showing the person slightly above the ground and their collider (it's the box near their feet). I disabled the collider on the floor so there are no colliders other than the player's.

enter image description here

enter image description here

\$\endgroup\$
  • \$\begingroup\$ @DMGregory There are no rigid bodies. The only collider is a box on the player. I added a screenshot to the question. The cylidner shape in that image is the NavMeshAgent \$\endgroup\$ – max pleaner Mar 6 '18 at 17:53
  • \$\begingroup\$ Incidentally, this is why the phrase "Commit early, commit often" exists. You need to do a better job of using source control; then you wouldn't need to be here. \$\endgroup\$ – Engineer Mar 6 '18 at 18:25
  • \$\begingroup\$ @ArcaneEngineer fair point \$\endgroup\$ – max pleaner Mar 6 '18 at 19:02
3
\$\begingroup\$

So it turns out it was something to do with a change I made to my Animator (not sure what, will debug later).

The takewaway here is that if you encounter a wierd bug like this, try disabling every component one-by one, don't assume that because the component doesn't seem related it can have no effect.

edit and use source control

edit2 figured out specifically what the issue was. When I was showing my friend how Unity animations work I made one that animates the player's position. This was overriding the NavMeshAgent's destination. The wierd thing is, this particular animation is never triggered by the scene. Just having a defined animation which changes the player's position was enough to prevent it from moving.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.