by any chance do u've any idea how to make a really good sophisitcated escape npc. (should have same speed as player). so the npc just tries to trick the player velocity/direction you know like random zigzag or something. i'm trying to find the best way possible to make it really hard to the player to touch the npc. (even if it spossible but still challenging)
Do you know of any way to make it possible for the prey to turn left or right instead of only one angle? Possibly according to the position of the predator (if predator is more to your left, you go right, and vice versa)
You can multiply the direction in which the prey is supposed to run with Quaternion.AngleAxis(degreesAwayFromOriginalAngle(negativeForLeft), Vector3.up). If you want to know which side the predator is on use Vector3.Dot.
This is really good. I want to take this and turn the chaser into a walking humanoid downloaded from Mixamo. I tried adding an animator controller and got my guy to walk. But, when I tried adding a chaser script along with a nav agent, now my guy just goes bonkers. What am I doing wrong? Any help to my understanding would be greatly appreciated.
Hi, check if on your animator component the Apply Root Motion box is ticked. If it is, untick it. It applies motion based on the animation and could conflict with the motion the navmeshagent is trying to apply.
@@KampinKarl1 Thanks for the prompt reply. When I have Apply Root Motion checked, but no chaser script or Nav Mesh Agent, it walks exactly how it's supposed it, just not towards the target. When I turn that off, but enable the script and Nav Mesh Agent, it follows the target, but it floats and glides rather than walks.
@@edhalsim "When I have Apply Root Motion checked, but no chaser script or Nav Mesh Agent, it walks exactly how it's supposed it, just not towards the target" what? you downloaded an animation that actually *moves* eg "translates" moves across a distance? no no. you want to zero root so it's "walking in place" the navmesh strictly is making it move, enhanced by the script
Reminds me of World of Warcraft when enemies run away its annoying asf because they will run into another group of enemies and aggro them causing a 4v1 then I die
Hi, Put a collider on your object so you can use Unity's built-in OnMouseDown callback (write OnMouseDown in your script and your IDE should give you an intelisense autofill for the method and the name of the method should show up in blue [as opposed to white]). Call the RunAway() or whatever method from within OnMouseDown.