Sign in to follow this  

Mouse movement to object speed

This topic is 3858 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
hey, try using the last mouse position and the current pos and make a vector and use its length to base your speed to.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 3858 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this