I so far have this script to make my monster move but it says that there is an unknown identifier "myRigidbody".
#pragma strict
var target : Transform;
var moveSpeed = 240;
var rotationSpeed = 180;
var myTransform : Transform;
function Awake()
{
myTransform = transform;
}
function Start()
{
target = GameObject.FindWithTag("Player").transform;
}
function Update () {
myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
myRigidbody.AddForce(myTransform.forward * moveSpeed * Time.deltaTime);
}
Could somebody show me how to identify it or where I went wrong scripting.
↧