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!