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)
@FeedMyKids1 Жыл бұрын
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.
@RDD87z3 ай бұрын
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)
@H1tARun8 ай бұрын
Thanks a lot. I may be fiddling around with Godot, but you helped me a lot.
@FeedMyKids18 ай бұрын
Good! I'm hoping to make more videos soon and make them more software/engine agnostic.
@BadgervanWyk6 ай бұрын
Your voice...... its beautiful
@leothelion6342 жыл бұрын
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
@FeedMyKids12 жыл бұрын
Ah, I never played WoW and figured anyone who uses this advice would create their own logic after turning their NPCs around.
@castlecodersltd6 ай бұрын
Interesting, thank you 🙂
@madog5682Ай бұрын
how do i set it to the local player?
@FeedMyKids1Ай бұрын
Can you elaborate?
@madog5682Ай бұрын
@@FeedMyKids1 im trrying to make the fleeing ai part be set where if the player enters the trigger zone it would flee instead but im seing guied on the opposite where it follows the local player by grabbing the direct root case 1: // Target Player if (!Networking.IsOwner(gameObject)) break; TargetPlayer = Networking.LocalPlayer; // Ensures target player is the owner! SetAIDestination(TargetPlayer.GetPosition()); // Sets AI target to the target players root position every update! break;
@madog5682Ай бұрын
i decided to finaly delve into scripting so im un familuar with most things
@FeedMyKids1Ай бұрын
@@madog5682 You can leave the trigger zone on your character for simplicity's sake (So on your fleeing AI, you'd have like a sphere collider set to "isTrigger = true" making sure the player has a rigidbody: on your AI which should be a monobehaviour, use "OnTriggerStay(Collider other)" In that method check if the "other" is the player. If it's the player, turn in the direction the player is facing (If player faces north, AI faces north) within same if: Go forward. void OnTriggerStay(Collider other) { if (other.gameObject.tag == "Player") { transform.rotation = other.transform.rotation; transform.position += transform.forward * speed * Time.deltaTime; } } Something along those lines. You change it for your navmeshagent if that's what youre using, but this is the concept.
hi thanks for make this video. i have different purpose how to make object run away when it clicked? thanks in advance.
@FeedMyKids12 жыл бұрын
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.
@thegrey4482 жыл бұрын
@@FeedMyKids1 hi buddy thanks for your answered. i will try it. hopefully you could make tutorial for it. if you dont mind. thanks.
@thegrey4482 жыл бұрын
@@FeedMyKids1 hi budd , onmousedone so useful and i used settrigger for animator to animated. many thanks👌
@FeedMyKids12 жыл бұрын
@@thegrey448 Perfect! Glad it worked
@edhalsim Жыл бұрын
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.
@KampinKarl1 Жыл бұрын
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.
@edhalsim Жыл бұрын
@@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.
@Ytsssss364 Жыл бұрын
@@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