Hey everyone,
I think there may be a problem with the collision detection fix used at the end of this lecture to prevent the ball from passing through pins at high speeds.
According to the Unity docs, setting the collision detection to “Continuous Dynamic” will:
Use continuous collision detection against objects set to Continuous and Continuous Dynamic Collision. It will also use continuous collision detection against static MeshColliders (without a rigidbody). For all other colliders it uses Discrete collision detection.
Because the ball has a Rigidbody on it, the pins will continue to use the “Discrete” collision detection method with the ball, even if you set the pins to “Continuous Dynamic”.
I believe the most performant solution would be to set the pins’ collision detections to “Continuous” and the ball’s to “Continuous Dynamic”. With that, pins could pass through other pins, but collisions with the ball would always be accurate. Alternatively, you could set the pins and the ball to “Continuous Dynamic” to make all collisions between the pins and the ball accurate, but at the expense of a higher CPU utilization.
Let me know if I misinterpreted anything, and thanks for these lectures, I’ve been enjoying them a lot!