Struct Material
Describes how an object should respond to collisions with other objects.
Implements
Inherited Members
Namespace: Unity.Physics
Assembly: Unity.Physics.dll
Syntax
public struct Material : IEquatable<Material>
Fields
CustomTags
The custom tags set by the user.
Declaration
public byte CustomTags
Field Value
| Type | Description |
|---|---|
| byte |
Default
(Immutable) A default material.
Declaration
public static readonly Material Default
Field Value
| Type | Description |
|---|---|
| Material |
Friction
The friction.
Declaration
public float Friction
Field Value
| Type | Description |
|---|---|
| float |
FrictionCombinePolicy
The friction combine policy.
Declaration
public Material.CombinePolicy FrictionCombinePolicy
Field Value
| Type | Description |
|---|---|
| Material.CombinePolicy |
Restitution
The restitution.
Declaration
public float Restitution
Field Value
| Type | Description |
|---|---|
| float |
RestitutionCombinePolicy
The restitution combine policy.
Declaration
public Material.CombinePolicy RestitutionCombinePolicy
Field Value
| Type | Description |
|---|---|
| Material.CombinePolicy |
Properties
CollisionResponse
Gets or sets the collision response.
Declaration
public CollisionResponsePolicy CollisionResponse { get; set; }
Property Value
| Type | Description |
|---|---|
| CollisionResponsePolicy | The collision response. |
EnableDetailedStaticMeshCollision
When enabled, this option processes contact points from both the current and next frame to predict and refine collision accuracy, reducing the likelihood of ghost collisions.
This is particularly effective in scenarios prone to ghost collisions, such as colliders moving along slopes, either uphill or downhill, or similar cases where tend to occur ghost collisions.
To activate this behavior, at least one of the colliding objects must have this flag enabled. However, it also functions when both colliders have the flag enabled.
The system prioritizes evaluation from the dynamic collider when it collides with a static collider.
Declaration
public bool EnableDetailedStaticMeshCollision { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
EnableMassFactors
Get or Set EnableMassFactors
Declaration
public bool EnableMassFactors { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | If true, the object can have its inertia and mass overridden during solving. |
EnableSurfaceVelocity
Get or Set EnableSurfaceVelocity.
Declaration
public bool EnableSurfaceVelocity { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | If true, the object can apply a surface velocity to its contact points.. |
Methods
Equals(Material)
Tests if this Material is considered equal to another.
Declaration
public bool Equals(Material other)
Parameters
| Type | Name | Description |
|---|---|---|
| Material | other | The material to compare to this object. |
Returns
| Type | Description |
|---|---|
| bool | True if the objects are considered equal, false if they are not. |
GetCombineDetailedStaticMeshCollision(Material, Material)
Determines if detailed contact calculation should be enabled based on materials with the EnableDetailedStaticMeshCollision property enabled. Detailed contacts process collision points between the current and predicted future frame to improve collision accuracy and prevent ghost collisions.
Declaration
public static bool GetCombineDetailedStaticMeshCollision(Material materialA, Material materialB)
Parameters
| Type | Name | Description |
|---|---|---|
| Material | materialA | The material a. |
| Material | materialB | The material b. |
Returns
| Type | Description |
|---|---|
| bool | True if either material requires detailed contact processing between the current and next frame. |
GetCombinedFriction(Material, Material)
Get a combined friction value for a pair of materials. The combine policy with the highest value takes priority.
Declaration
public static float GetCombinedFriction(Material materialA, Material materialB)
Parameters
| Type | Name | Description |
|---|---|---|
| Material | materialA | The material a. |
| Material | materialB | The material b. |
Returns
| Type | Description |
|---|---|
| float | The combined friction. |
GetCombinedRestitution(Material, Material)
Get a combined restitution value for a pair of materials. The combine policy with the highest value takes priority.
Declaration
public static float GetCombinedRestitution(Material materialA, Material materialB)
Parameters
| Type | Name | Description |
|---|---|---|
| Material | materialA | The material a. |
| Material | materialB | The material b. |
Returns
| Type | Description |
|---|---|
| float | The combined restitution. |
GetHashCode()
Calculates a hash code for this object.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A hash code for this object. |