For our current project we need to catch collisions on objects that can be moving very quickly in opposite directions.
We're using non-kinimatice rigidbodies on both objects, one with a capsule collider and the the other with a box collider...
One object moves via translation, the other via velocity.
Most of the time this works fine, but It seems that sometimes an object can go straight through the other without colliding properly when both are at high speed.
Any suggestions on the cheapest way of solving this, is the only option to use continous dynamic collision detection on one of the rigidbodies?
Thanks in advance guys :)
Maybe you find some enlightenment on the awesome DontGoThroughThings Daniel's script. From my brief experience, the new physics improvement on Unity 3, collisionDetectionMode, still doesn't work as good as this raycasting implementation. For sure, neither is 100%, but this was pretty close on my case:
So it solves the issue of "objects moving very quickly" in the very practical instance of crossing walls that it never should be able to. You could extrapolate this script into one able to detect another object moving really fast.
The problem exists even if you use continuous dynamic collision detection because fast moving objects can move so fast that they are too far apart from itself from one frame to the next immediate frame. It's like they teleported and no collision detection would ever be triggered because no collision existed, from each frame perspective, and thus from all calculations processed.