I’m currently creating NPC’s to fight each other, and they need to navigate toward each other. I’m trying to use the method of “if MoveTo works, use MoveTo, otherwise, use Navigation”. This causes the problem of figuring out if MoveTo works. My first idea was to Raycast towards the target, and if it works, MoveTo will work. Unfortunately, that makes the lower NPC believe it can simply walk toward the other unit when in fact it can’t in this situation:
or this situation:
How could I make a character that knows when MoveTo won’t work, and switches to Navigation?
2 Likes
Yeah, but I’m trying to only use that when necessary, because I’ve found that it creates choppy and laggy movmement when used all the time, when sometimes a simple MoveTo would do the same thing. I’m trying to figure out when Pathfinding Service must be used, and when a MoveTo would suffice.
The choppy movement is incredibly simple to fix.
Add this line into the script:
enemy:WaitForChild("HumanoidRootPart"):SetNetworkOwner(nil)
Also, at that point it would be much better to just use pathfinding service entirely. It would be significantly more complicated to switch between the two. It would be much more efficient and worth your time to use only pathfinding.
1 Like