Making the Movement more Responsive

Like Rick showed you can can do the MoveToCursor method continously by using GetMouseButton. But your Player still folows the Last path in which you shot a Raycast. So he still moves unitl he gets to this NavmeshTarget. I wanted my Player to be a bit more responsive so heres what i did:

if (Input.GetMouseButtonUp(0))
        {
            _myAgent.ResetPath();
        }

Heres how it works. GetMouseButtonUp detects if the button is released so when we are lifting our Fingers. ResetPath just Cancels any Path that our NavmeshAgent is following. This will give you a much more responsive Movement sorta like playing with an Controller.

4 Likes

Thank you for sharing this

I like the way this works for movement. Once we get to combat, we’ll be moving automatically within range controlled by the fighter. This may need some adjustment to be compatable with that system. When you get there, we’ll see if we can make this model continue to work (click and release basic movement: stop, click on enemy: move to and attack).

Privacy & Terms