Quantcast
Channel: Questions in topic: "addforce"
Viewing all articles
Browse latest Browse all 1264

Declaring myRigidbody

$
0
0
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.

Viewing all articles
Browse latest Browse all 1264

Trending Articles