I have tried to make a script to attach to the main camera so that whenever a user is idle for X time, the camera rotates back to it's original position.
The thing is that I am not able to do it permanently.
Follows my code:
asked Dec 22 '09 at 05:44 PM
slerp function needs to run multiple times to rotates the object in time by the speed that you specified. you just run the function one time in each time that reset is greater than maxreset. create a coroutine that executes till rotattion of your gameobject is equal to the second parameter of your slerp function or returned value has zero in all x,y,z,w values
answered Dec 22 '09 at 06:46 PM
You should be able to fix the code you've given simply by removing the
It's also worth noting that you should move this logic out of OnGUI and into Update as OnGUI is called at irregular intervals. If you move it, you'll also need to stop using Events and use Input.GetKeyDown, Input.GetMouseButtonDown etc.
answered Dec 22 '09 at 07:31 PM