Mouse movement to object speed
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.
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.
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.
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.
ranges and the you can control it a bit unless its a true sim is it.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement