Sign in to follow this  
evren bingol

Physics Prediction

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
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

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