31 ms·
No, because the rebound velocity doesn't depend on how far two bodies intersect. To answer the wider question - when a contact is detected, you can immediately
by philh 16y ago
No, because the rebound velocity doesn't depend on how far two bodies intersect.
To answer the wider question - when a contact is detected, you can immediately calculate the new velocity of the two bodies. Then you move things around to be nonintersecting. Then next frame, everything has the correct velocity.
(In fact, this will be done in two passes. Collision detection will generate a list of contacts, containing properties like the initial velocities of the two bodies. Then the collision resolution phase will change the velocities.)
- JoeAltmaier 16y agoIts harder than that - the rebound path can generate more collisions. Its iterative and can take an indefinite amount of time to calculate a frame.