- Home /
"Nav Mesh Agent" messes up simple prototype player-gameobject. What's up with that?
[A] Pre-NavMesh setup:
So I have a simple prototype "player" game-object: a parent character-controller (2 units high) with three child Mesh Renderers ("body" = cylinder, "ears" and "nose" = cube), like this (for full-res, right-click image and "open in new tab")
The character is initially a few units in the air and immediately in the first frame, via CharacterController.Move(y=-4)
is put firmly on the ground below.
My custom-scripted third-person camera stays close behind this player at all times and without NavMeshAgent in-game it looks like this:
[B] With fully-baked NavMesh setup:
When I add a NavMeshAgent to the root "player" game-object, in-game the character is immediately dropping half-way below-ground:
When I remove this NavMeshAgent from the "player" game-object and add it to its "body" (cylinder mesh) sub-object, this problem goes away but as soon as I move the character (via CharacterController.SimpleMove
, not via NavMeshAgent.destination
-- didn't even get to that point yet), its transforms seem to be messed up: the body stays somewhat behind ears/nose and the whole thing stays a bit above-ground instead of sticking to the ground firmly:
Where do I learn more about how and why the NavMeshAgent immediately messes up extremely-simple-prototyp pre-existing setups like this in such a manner?
It seems to me that the Nav$$anonymous$$eshAgent might not be properly configured. Did you play around with the height, radius and base offset? I get the feeling that adjusting the base offset while keeping the Nav$$anonymous$$eshAgent component on the root player might be the solution.
Thanks for commenting! I believe I left everything in the Nav$$anonymous$$eshAgent at defaults. But it doesn't matter anymore as I've since decided to go with a 3rd-party nav solution. =)