I'm using this method to detect collision between two AABBs. The algorithm is simple, fast and works great. It uses the relative velocity between the two objects to calculate TOI. This works fine with Euler, but now i'm trying to switch to RK4, which makes it hard for me to determine the TOI since i can't just divide the distance between the two AABBs by their relative velocity. Since RK4 is so popular, how do people deal with this issue? How to calculate a TOI for a swept AABB with RK4?
Tell me more
×
Game Development Stack Exchange is a question and answer site for
professional and independent game developers. It's 100% free, no registration required.
|
Integration should have nothing to do with calculating the TOI. I'm not sure where your problem is as RK4 only allows for more accurate results by allowing a more accurate acceleration curve during each time step. Remember acceleration is just the change in velocity over the time step. Thus vel = accel / dt or vel = accel * inverse_dt The swept box algorithm you provided calculates it's own velocities inside itself based on the new and old positions. To find the position of each box at the TOI just multiply that velocity by the TOI for each box, not what RK4 has found. I'm also assuming your only using linear motion as your swept box detection does not provide a contact point. |
|||
|
