///<summary> /// Blends the bounciness of the two materials together. ///</summary> ///<param name="materialA">First material of the pair.</param> ///<param name="materialB">Second material of the pair.</param> /// <param name="blender">Blender to use to blend the material properties.</param> ///<param name="blendedCoefficient">Blended bounciness coefficient.</param> public static void GetBounciness(Material materialA, Material materialB, PropertyBlender blender, out float blendedCoefficient) { InteractionProperties properties; if (materialA != null && materialB != null && MaterialInteractions.TryGetValue(new MaterialPair(materialA, materialB), out properties)) { blendedCoefficient = properties.Bounciness; return; } blendedCoefficient = blender(materialA.Bounciness, materialB.Bounciness, null); }
static WheelSlidingFriction() { DefaultSlidingFrictionBlender = new PropertyBlender(BlendFriction); }
static MaterialManager() { FrictionBlender = DefaultFrictionBlender; BouncinessBlender = DefaultBouncinessBlender; MaterialInteractions = new Dictionary<MaterialPair, InteractionProperties>(); }
static WheelBrake() { DefaultRollingFrictionBlender = new PropertyBlender(BlendFriction); }
static WheelDrivingMotor() { DefaultGripFrictionBlender = new PropertyBlender(BlendFriction); }
static MaterialManager() { FrictionBlender = DefaultFrictionBlender; BouncinessBlender = DefaultBouncinessBlender; MaterialInteractions = new Dictionary <MaterialPair, InteractionProperties>(); }