///<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);
        }
Beispiel #2
0
 static WheelSlidingFriction()
 {
     DefaultSlidingFrictionBlender = new PropertyBlender(BlendFriction);
 }
 static MaterialManager()
 {
     FrictionBlender = DefaultFrictionBlender;
     BouncinessBlender = DefaultBouncinessBlender;
     MaterialInteractions = new Dictionary<MaterialPair, InteractionProperties>();
 }
        ///<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);

        }
Beispiel #5
0
 static WheelBrake()
 {
     DefaultRollingFrictionBlender = new PropertyBlender(BlendFriction);
 }
 static WheelSlidingFriction()
 {
     DefaultSlidingFrictionBlender = new PropertyBlender(BlendFriction);
 }
Beispiel #7
0
 static WheelDrivingMotor()
 {
     DefaultGripFrictionBlender = new PropertyBlender(BlendFriction);
 }
Beispiel #8
0
 static WheelBrake()
 {
     DefaultRollingFrictionBlender = new PropertyBlender(BlendFriction);
 }
 static MaterialManager()
 {
     FrictionBlender      = DefaultFrictionBlender;
     BouncinessBlender    = DefaultBouncinessBlender;
     MaterialInteractions = new Dictionary <MaterialPair, InteractionProperties>();
 }
 static WheelDrivingMotor()
 {
     DefaultGripFrictionBlender = new PropertyBlender(BlendFriction);
 }