How to make NavMesh Agent go 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
Your answer
![](https://koobas.hobune.stream/wayback/20220613023315im_/https://answers.unity.com/themes/thub/images/avi.jpg)