Friday, November 27, 2015

c# - Rotating an object continously with OnMouseDown


I have a script that works but it does not do what I want it to do. My script makes an object rotate on when another is clicked. However, I want the object to continuously rotate until I click on the other object again. Right now when I click it rotates just a bit and stops.


Here is my script:


 public class Rotate : MonoBehaviour {
public float speed =50f;
public GameObject target;

public void OnMouseDown(){
target.transform.Rotate (new Vector3(0, Time.deltaTime, 0) * speed);
}

}

How can I make the object rotate continuously until I click it again?




No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...