rotate freely prefab

hii, i'm new to unity ,i want make a prefab cube which is freely rotate with custom speed. how can i do it.

is there any inbuild function in unity to rotate object.?

1 Answer

1
function Update()
{
transform.Rotate(0,0,0.1*Time.time); 

}

rigidbody.AddTorque(Vector3.right * 10);

wow.. but i need to stop them aftr some rotation .then?

rigidbody.isKinematic = true;

it stop the rotation of object this will disable the physics properties where ever you want to stop rotation use above code

You can to use mouse position to stop rotate, if the mouse position is equal prefab don't rotate... if diferent rotate... is a idea!