- Home /
Question by
sbh69840 · May 29, 2017 at 06:32 AM ·
1st person1080p1 frame
Rotate an object from when it is clicked to till I click it again to stop.
I have a game object which I want to rotate using transform but what happens is, I have to click the mouse button for every frame to rotate it. But, what I want is it to keep spinning from when I first click the mouse till I again click it to stop.
Comment
Answer by Bill9009 · May 29, 2017 at 06:56 AM
Here you go:
bool rotation = false;
void Update () {
rotation = rotation ^ Input.GetMouseButtonDown(0);
if (rotation)
transform.Rotate(transform.rotation.x + 1, transform.rotation.y, transform.rotation.z);
}
Your answer
Follow this Question
Related Questions
HD Video Playback 1 Answer
C# Joystick GetComponent(); 1 Answer
I'm trying to make a first person camera for my game but.. 1 Answer