Question by
AxolPop · Jan 13, 2021 at 11:59 AM ·
transformnavmeshnavmeshagentnoob
How to make NavMesh agent move directly forward
I want to make an agent move directly forward to where the mouse position is, however, I don't want them to go to EXACTLY where the mouse pointer is, just point in the direction and move forward. However, in-game all this code does is make them tilt in place. Any way to fix this?
if (Input.GetMouseButtonDown(0))
{
transform.LookAt(Input.mousePosition);
Vector3 vector3 = agent.transform.forward * 5;
}
Comment