I’m programming a 3D recreation physics engine that makes use of steady collision detection to keep away from my objects from with the ability to “tunnel” by way of the geometry.
Right here is mainly the way it works:
- Execute a swept-object/world collision test
- Transfer the thing as much as the precise level the place it collides
- If no time is remaining, all the things is completed, simply cease
- Else, replace the speed in order that the thing “slides” in a path orthogonal to the collision regular earlier than returning to step 1. That is the system I exploit for this sliding (I simply take away the element of the movement within the regular path):
velocity = velocity - (velocity dot regular) * regular
My downside happens in this type of state of affairs:
(Don’t consider faces aside from A and B, their solely function is the emphasize the 3D side of the form)
Right here, the thing first follows the black arrow, then collides face A. It slides accurately on face A (first crimson arrow) after which climbs on face B (second crimson arrow). The issue with this algorithm is exactly the truth that it might climb on the alternative face: after every consecutive body, the final movement will observe the great path, however with an area left-right shaking artifact that I’d recognize eliminating.
Any thought to resolve this could be tremendously appreciated.