Hi,
I'm trying to make an object rotate back to its original rotation stored as the variable origrot, I figured I just call the variable back with transform.rotation = origrot but I get the error unknown identifier on the transform.rotation. I cant figure where I'm going wrong.
var shelfpos : Vector3;
shelfpos = transform.position;
var otherObject : GameObject;
otherObject = GameObject.Find("First Person Controller/Main Camera/held_item");
var inhand = false;
var origrot = 0.0;
function Start () {
var shelfpos : Vector3;
origrot = transform.rotation;
print (origrot);
}
function Update () {
var somePos : Vector3 = otherObject.transform.position; //get position of helditem object
// if object is selected move to helditem object
if (inhand == true)
// var i = (Time.time - startTime) / duration;
transform.position = Vector3.Lerp (transform.position, somePos,Time.time);
// transform.position = Vector3.Lerp(shelfpos, somePos, i);
if (inhand == false)
// var k = (Time.time - startTime) / duration;
// transform.position = Vector3.Lerp(somePos, shelfpos, k);
transform.position = Vector3.Lerp (transform.position, shelfpos,Time.time);
transform.rotation = origrot;
}
function OnMouseUp () {
inhand = true;
}
function OnGUI () {
if (inhand == true)
if (GUI.Button (Rect (170,250,150,30),"Return To Shelf"))
inhand = false;
}
Regards.