Mouse movement to object speed

Started by
2 comments, last by ankhd 16 years, 11 months ago
I'm writing an Air Hockey game. I get my mouse movement input using DirectInput. How can one translate mouse movement to object speed ? As you guessed it, the mouse controls the player's mallet. Should I invlove a timer for this issue ? thx.
There is nothing that can't be solved. Just people that can't solve it. :)
Advertisement
hey, try using the last mouse position and the current pos and make a vector and use its length to base your speed to.
thats is my first dillema , should the vector length will be the speed or should I use a timer to calculate the time delta between the positions and get the speed from the known formula : v = s / dt.

The thing is that trying the second approach produces very large speed values which aren't seems to fit. The first approach its much better but I don't know if it is accurate.

If someone knows or did it before plz let me know what is the best way .

thx.
There is nothing that can't be solved. Just people that can't solve it. :)
try having 4 predefined speed ranges or more and split the mag in to that many
ranges and the you can control it a bit unless its a true sim is it.

This topic is closed to new replies.

Advertisement