find the exact moment of impact

Sep 30, 2010 at 7:32 PM

I'm writing a game where i'm using two physics engines, farseer and a very simple one I've written myself. I'm passing objects between physics engines. say when an object is in the air it's handled by farseer, but when it hits the ground my physics engine takes over. To get some objects to collide and rolls on a surface naturally looking i need to know the exact moment the object makes contact with the ground in farseer. For example, i want to know did the collision happen at the beginning of a frame, half way though or near the end etc. I can then use this data to tell my physics engine how much of the frame has passed already when it calculated what the next frame should look like.

Is there any way to do this in farseer 3.0?

cheers,

 

-- Brian

Sep 30, 2010 at 11:03 PM

Checkout the Box2D manual here and read about the PreSolve event. You should be able to calculate have far into the ground the object have tavelled and then make out from that how much of the frame have passed.

http://box2d.org/manual.html#_Toc258082975

Oct 1, 2010 at 10:59 AM

Sounds perfect =].

cheers!

Oct 1, 2010 at 2:30 PM

have to admit i'm having trouble here. I'm using the preSolve event but not sure how to find the next projected position before it solves the constraints. also can;t help but think there might be something in the TImeOfImpact class to tell me something? theres a TOIOutput struct that seems to store variable T which sounds like it represents how much of the frame has passed by. if i could get access for when the object collides with the ground that would be perfect, but i can;t figure out how exactly.

any ideas?