I am trying to get the direction the mouse is moving in, on the X & Y axis. I know to get the direction you need: endPos - startPos, but I need to do it every frame and not just at the end of the movement.
What’s the best way to approach this? Thx in advance guys!
Steph
mouse.pos mouse.screenpos - check for “Mouse Cursors” in the maxscript help
Available in 3ds Max 2008 and higher. Previously available in Avguard Extensions.
[QUOTE=Kameleon;24678]mouse.pos mouse.screenpos - check for “Mouse Cursors” in the maxscript help
Available in 3ds Max 2008 and higher. Previously available in Avguard Extensions.[/QUOTE]
Thx for the reply Kameleon!
I am aware of mouse.pos and mouse.screenpos, what I am trying to figure out is how do I check the current mouse position against the last mouse position to figure out which way the mouse is moving?
Stephane
A timer? Get the delta and figure out movement? Just throwing ideas
[QUOTE=Kameleon;24714]A timer? Get the delta and figure out movement? Just throwing ideas :)[/QUOTE]
Yes a timer would work! Thx for the suggestion, I’ll give that a try and post the code if successful.
Stephane
mouseTrack() might do the job as well…
http://docs.autodesk.com/3DSMAX/14/ENU/MAXScript%20Help%202012/files/GUID-0A4CD125-5CA0-42DA-B2D6-B8FDF511CCE-1942.htm
But AFAIK that one stops working as soon as you press some UI element ( because the viewport looses focus )
I’ve used the technique that Kameleon suggested. Store the position as previous position, then in the next update store it again as current position and then subtract one from the other. That’ll give you a direction vector.