I’m trying to solve the age old problem. Fast projectile, thin walls = projectile passes through walls without colliding. This is not acceptable in a modern physics engine, i should have tools to deal with this.
My projectile is created in mid air, and then propelled by applying a force to it in the direction of the camera. I’m never using kinematic movement methods.
Enter the collision detection modes, which work as thus (according to documentation)
Use this to set up a Rigidbody’s for continuous collision detection, which is used to prevent fast moving objects from passing through other objects without detecting collisions. For best results, set this value to CollisionDetectionMode.ContinuousDynamic for fast moving objects, and for other objects which these need to collide with, set it to CollisionDetectionMode.Continuous. This has a big impact on physics performance, so just leave it set to the default value of CollisionDetectionMode.Discrete, if you don’t have any issues with collisions of fast objects. Continuous Collision Detection is only supported for Rigidbodies with Sphere-, Capusle- or BoxColliders. See Also: CollisionDetectionMode.
So i set my projectile as ContinuousDynamic. I set my wall as continuous (i give it a rigidbody, and also make it kinematic). The projectile has a sphere collider, the wall has a box collider. and it still passes clean through at high speeds. What in the hell?
I suppose i could increase the timestep value, but that is an absurd and unscaleable solution to what should be a very simple problem. I could make the wall thicker, or the projectile larger, but those ideas are dumb for the same reason. Continuous/interpolated collision detection is not a complicated feature, a modern physics engine should support this easily. Why isn’t it working?
I’m trying to make a game which relies very heavily on a lot of physics and optimisations. I was planning to turn the timestep DOWN for more performance, not up. Turning it up to fix this problem would scale up the load of every aspect.