2025-02-07 Material collision effects and breakable objects
I was building a new home world after being bored by the one that I had been using for over a year.
Initially, I just wanted to make sure that shooting walls would produce decals and the correct sound effects depending on the material being hit, after being inspired by a Half-Life 1 documentary starring Gabe Newell on the topic of fun, reinforcement, and world interactivity (2-minute watch, between 15:08-17:03). I was thinking it was odd I never spent time to implement such a basic game functionality within the Unity engine.
However, the whole idea went out of control and I ended up building an analogue of throwable and breakable objects.
Below is a random assortment of things I have learned while building this system.
Some items may be specific to the
Avoiding Continuous Speculative for important collisions
When a rigidbody is thrown and hits another collider, we need to apply an appropriate sound effect volume and damage amount, using the collision force.
Collision events are raised through OnCollisionEnter, containing this information.
The issue is that depending on the collision detection type of the rigidbody, the reported amount may equal to 0 newton too often, even on objects that are thrown hard onto walls. This especially happens when the rigidbody is set to Continuous Speculative.
The fix is to set the collision detection type to Continuous Dynamic, as long as we care about these objects reporting the correct forces to produce sounds or be damaged on impact. For instance, this is not necessary on the individual debris emitted out of breakable objects.

Don't bounce away from broken objects
If you throw a bowling ball against a fragile window, the bowling ball should go through the window because it conserves most of its energy.
Collisions with all non-moving objects will cause the thrown object to bounce away from it, even if that non-moving object breaks the moment it is hit. This also applies to some heavy breakable objects that can be moved.
The fix that I chose is to save the velocity and angular velocity of thrown objects every physics frame in FixedUpdate.
When an object breaks apart, it needs to inform the other object that collided with it, so that it cancels the bounce and re-applies most of
its energy based on the velocity and angular velocity of the last saved physics frame.