/// <summary> /// Initializes a new instance of the <see cref="UniformMaterial"/> class from a given material. /// </summary> /// <param name="name">The name of the material. Can be <see langword="null"/>.</param> /// <param name="material">The material from which the properties are copied.</param> public UniformMaterial(string name, MaterialProperties material) { Name = name; DynamicFriction = material.DynamicFriction; StaticFriction = material.StaticFriction; Restitution = material.Restitution; SupportsSurfaceMotion = material.SupportsSurfaceMotion; _surfaceMotion = material.SurfaceMotion; }
/// <summary> /// Gets the <see cref="MaterialProperties"/> for the given rigid body, position and shape /// feature. /// </summary> /// <param name="body">The rigid body.</param> /// <param name="positionLocal"> /// The local position on the rigid body for which the material properties should be returned. /// </param> /// <param name="featureIndex"> /// The index of the shape feature from which the material properties are needed. For a /// <see cref="CompositeShape"/> the feature index is the index of the child of the composite /// shape. For a <see cref="TriangleMeshShape"/> the feature index is the index of a triangle. /// </param> /// <returns> /// The <see cref="MaterialProperties"/> of the given rigid body at the given position and /// child feature. /// </returns> public MaterialProperties GetProperties(RigidBody body, Vector3 positionLocal, int featureIndex) { MaterialProperties parameters = new MaterialProperties( StaticFriction, DynamicFriction, Restitution, SupportsSurfaceMotion, SurfaceMotion); return(parameters); }