I'm a little brain dead and should've been able to figure this out by now. So any help would be wonderful about now....
I'm trying to figure out the best way to script out a toggle using an input key like "m." Whenever the user presses the "m" on the keyboard, the motion of the gameobjects should start and then reset once pressed again.
I think could have it all in one code, but also know that I may to change it from an input key to use a GUI button. With that, I'd kinda like to have it in another script by itself. The code below is on the spheres....
var move : boolean;
var speedOne : float;
var speedTwo : float;
var speedThree : float;
var defaultRotation : Quaternion;
var switchTo = Transform;
function Start(){
speedOne = Random.Range(50,200);
speedTwo = Random.Range(50,200);
speedThree = Random.Range(50,200);
//Save Original/Default Rotation
defaultRotation = transform.rotation;
}
function Update (){
if(move==true){
transform.Rotate(Vector3.right, speedOne*Time.deltaTime);
transform.Rotate(Vector3.up, speedTwo*Time.deltaTime);
transform.Rotate(Vector3.forward, speedThree*Time.deltaTime);
}
else{
transform.rotation = Quaternion.Slerp(transform.rotation, defaultRotation, Time.deltaTime);
}
move = GameObject.Find("Trigger").GetComponent.(Trigger),move;
}