Jump to content
  • Advertisement
Sign in to follow this  
evren bingol

Physics Prediction

This topic is 3015 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

What is the best way to predict a future position of an object. Assuming there is no collusion, We only have damping and it is implemented as velocity*=(1-damping)*time; / this gets called every update time is the delta time between each update. ----- so I do this. distance_to_add =velocity*(1-damping)*time; predictedPos=currentPos+(distance_to_add*time); i just did what the physics lib does in one update. And found the displacement and added to . But it is off. Any help would be super. Thanks

Share this post


Link to post
Share on other sites
Advertisement
I don't quite understand why you
are using

velocity*=(1-damping)*time

This equation will result in less damping over a longer period of time.
As you think about it by a bigger delta time the velocity will be multiplied
with a bigger value.
I would propose some like this:

velocity*=(1-damping)/(1+time)

This should devide the factor by a value greater than or equal to 1 and
therefor lead to more damping over a longer period of time.


velocity*=power(1-damping,time*factor+1)

This will lead to a similar behavior like above but will damp harder
by increasing delte time. The factor is your own choice to apply your needs.

Assuming your equation the change in the second part would be:

dinstance_to_add=velocity*(1-damping)*time;
predictedPos=currentPos+distance_to_add;

You need to multiply velocity by time to get a distance.
Now you want to add this distance but added a distance multiplied by time.
I hope that should have fixed the problem.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!