- Home /
Camera position/rotation reset after 5 seconds of mouse inactivity
I am using a smooth camera script, is there a way I can reset the camera position/rotation after I have not moved mouse for 5 seconds, like in gta 5 when you get into a car and move the camera and you start driving, and the camera gets back into the original position.
Here is the script: https://pastebin.com/SZFAr8tA
Comment
well yes. just run a coroutine or track time in Update, whatever suits you best. reset the timer whenever the mouse has moved. do a check on the timer where you usually rotate the camera. if the time has not passed, pass in your usual direction, rotation, whatever, but if it passed replace it with a Vector3.forward from whatever space you need it (world, car...)
Thanks a lot, but how do I check if the mouse has moved ?