Quantcast
Channel: Questions in topic: "follow"
Viewing all articles
Browse latest Browse all 536

How to make a follow AI

$
0
0
I know there are a lot of questions about this but all of them are outdated or don't work. So I want a basic ragdoll AI that follows the Player until it touches the player. But none of the code works with ragdolls. Here is the code I saw and did. var Player : Transform; var MoveSpeed = 4; var MaxDist = 10; var MinDist = 5; function Start () { } function Update () { transform.LookAt(Player); if(Vector3.Distance(transform.position,Player.position) >= MinDist){ transform.position += transform.forward*MoveSpeed*Time.deltaTime; if(Vector3.Distance(transform.position,Player.position) <= MaxDist) { //Here Call any function U want Like Shoot at here or something } } } But that did not work. Also, the Player is called Player and enemy called jeff. THANKS!

Viewing all articles
Browse latest Browse all 536

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>