Timestamp to use in OnMouseDrag()

Hello. I’m working on some functionality where wheels are being spun depending on how fast/far the mouse is moved. I’m doing these updates in OnMouseDrag(). Part of the calculation is using Time.deltaTime like this:

m_LastMouseY = m_CurMouseY;
m_CurMouseY = Input.mousePosition.y;		
float deltaY = m_LastMouseY - m_CurMouseY;				
float spin = deltaY * Time.deltaTime;

However, this is making the amount of spin applied frame rate dependent, so much less spin is applied when the frame rate is higher. Seeing the effects it makes sense, but is there another timestamp I should be using so that what’s going on is frame rate independent? Or should I keep track of it myself with a couple of floats the good old fashioned way.
Thanks!
-Mo

Mouse movement is already framerate-independent to begin with, so using Time.deltaTime in this case does the opposite of what you want. Just take it out.

–Eric

Done. Fixed it. Thank you very much. Seems so obvious now :slight_smile:
-Mo