3 ms·
As the other comments note, you can create a sweep form to detect penetration. But this belies the more thorny issues of achieving a "high quality" solution: if
by syntheweave 5y ago
As the other comments note, you can create a sweep form to detect penetration. But this belies the more thorny issues of achieving a "high quality" solution: if two things impact a third within the exact same time step, you have to come up with a globally satisfying solution that coordinates all three, and sweeping doesn't do that by itself, it just says "well at some time it might hit one or both of them" - which if you run with directly, leads to weird behaviors related to the information loss where objects squeeze past each other or gain excess energy or trigger events they shouldn't. The solution to that problem is generally handled through the solver by various iterative methods. In a 2D platforming game using AABBs this is as simple as "step the physics on Y axis, then step them on X axis" - which completely eliminates the possibility of hitting two things at once, albeit it makes corners "sticky" on one axis. Once you have things rotating and colliding at any angle it gets a lot harder and the focus then is on how to iterate approximately in a way that produces the least error. (If you can afford it, backtracking the solver to optimize the solution quality to some metric of fewest/smallest impacts is one way to create satisfying interactions).