- Home /
How are BounceCombine values combined?
Hi all
I'm trying to understand how PhysicMaterials work.
Given two Colliders with different PhysicMaterials, how does Unity combine the two different BounceCombine values?
All I've been able to find is an unanswered thread from 2009: http://forum.unity3d.com/threads/physic-material-bounce-combine-property.29725/
Furthermore, what is the behaviour of a Collider with no PhysicMaterial? Is this the same as the default settings when making a new PhysicMaterial?
Thanks, Ves
Answer by Bunny83 · Nov 02, 2014 at 12:12 AM
Well, collisions follow the usual equatation for real collisions. CR is the bounciness factor. This factor seems to be determined by this logic:
float GetFactor(PhysicMaterial aM1, PhysicMaterial aM2)
{
if (aM1.bounceCombine == PhysicMaterialCombine.Maximum || aM2.bounceCombine == PhysicMaterialCombine.Maximum)
return Mathf.Max(aM1.bounciness, aM2.bounciness);
if (aM1.bounceCombine == PhysicMaterialCombine.Multiply || aM2.bounceCombine == PhysicMaterialCombine.Multiply)
return aM1.bounciness * aM2.bounciness;
if (aM1.bounceCombine == PhysicMaterialCombine.Minimum || aM2.bounceCombine == PhysicMaterialCombine.Minimum)
return Mathf.Min(aM1.bounciness, aM2.bounciness);
return (aM1.bounciness + aM2.bounciness)*0.5f;
}
So the 4 possible values for the combine method have a strict order:
Maximum > Multiply > Minimum > Average
Unity simply picks the combine method that is more to the left.
At least that's what my tests concluded in :)
Thank you so much, and apologies for the late reply!
Your answer
![](https://koobas.hobune.stream/wayback/20220613170506im_/https://answers.unity.com/themes/thub/images/avi.jpg)