- Home /
Using a navmesh agent as a character controller
Hi everyone and thanks for any help before hand.
Im developing a top down game (think original gta). My Ai is working perfectly on the navmesh and the performance cost is minimal.
Instead of doing a whole collision system just for the player seems a bit of a waste so ive been trying to control the player using navmesh.
I have tried navmeshagent.move but i cant figure how to rotate the agent and give it a backward walk. Im not the best sripter so im probably missing something but how would i control forward and back on the navmesh agent using Vertical Axis and rotate the agent using horizontal agent.
thanks again
Answer by gamenovice · Feb 07, 2016 at 10:14 PM
What I typically do is divide direction based rotation away from translation. so you can keep the navmeshagent.move logic you already have. but if you know your input vector, then assuming a certain direction you want, you can set the transform.forward of your character to the vector created by your input (you have to do a little extra work to get it working with respect to the camera). doing this should get the character facing the way you want, while dealing with basic translation as well.