Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

DirectXXX

Collision Time / Time Based Collision

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

Heres my current algorithm Pos // PositionOf object GameLoopStart OldPos = Pos; // making copy of position IF (CollisionDetected) GetNewVelocity and Pos = Old Pos Keep Moving with a velocity GameLoopEnd It works acceptable with slow moving objects. But collosion is detected when colliding object already crossed the plane of that object. This algorithm''s inaccuracy results into loss and gain of energy of system. I need to find the exact time at which objects collides with a given verlocity.?

Share this post


Link to post
Share on other sites
Advertisement
Are you sure you''re going about it the right way?

If you want to know where to put your object after the collision, then intersect it with where it hit.

If you want to "roll back" time that you''ve moved so you can have more accurate inter-object collision, then you can either...

* Find the intersection, as above, and calculate how much of the frame time happened before the collision occurred

or

* Use a "binary search" approach with time and iterate around using smaller time steps until you reach close to where you think the collision occurred.

Hard to describe, but I hope you get the idea.


Why you shouldn''t use iostream.h - ever! | A Good free online C++ book

Share this post


Link to post
Share on other sites


""If you want to "roll back" time that you''ve moved so you can have more accurate inter-object collision, then you can either...""

YES

""* Use a "binary search" approach with time and iterate around using smaller time steps until you reach close to where you think the collision occurred.""

I found this easy i will do this. but could you also explain the former method too.

Share this post


Link to post
Share on other sites
I think using the old position and the new position, find out the fraction of the total movement where the object was stopped. Basically that''s "distance between intersection and old pos / distance between new pos and old pos".

Then you''d end up with a float from 0 to 1. 0 meaning that the object was stopped at its start position, and 1 meaning the object was stopped at the end position.

Then you can just multiply your frame time by that float to find out when the intersection occurred.

Hope this helps.


Why you shouldn''t use iostream.h - ever! | A Good free online C++ book

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!