Time until collision

Here's the place to get help and discuss features. The focus is on the C++ version, but generic questions are welcome.
SPQR3
Posts: 1
Joined: Wed Feb 15, 2012 11:22 am

Time until collision

Postby SPQR3 » Fri Feb 17, 2012 8:21 am

I have only one circle, and one square. They are both dynamic bodies, affected by gravity. I would like to calculate how much time there is until they collide. Actually I would like to call a function when there is exactly 1 sec before the collision. Do you know a way to achieve this with Box2D without making the calculations myself? I have seen something similar called "Time of Impact", but haven't found any examples online for it.

Erin Catto
Site Admin
Posts: 2948
Joined: Thu Sep 06, 2007 12:34 am

Re: Time until collision

Postby Erin Catto » Fri Feb 24, 2012 4:27 pm

Yeah, you can use b2TimeOfImpact. You'll have to look at some of the examples in the testbed because it is an internal function and it is not documented in the manual.


Return to “General Discussion”



Who is online

Users browsing this forum: No registered users and 1 guest