Class PhysicMaterial
Physics materials, typically used to configure elasticity and friction.
Inheritance
Namespace: Motphys.Rigidbody
Assembly: solution.dll
Syntax
public class PhysicMaterial : ScriptableObject
Properties
bounceCombine
Declaration
public MaterialCombine bounceCombine { get; set; }
Property Value
Type | Description |
---|---|
MaterialCombine | The strategy to combine bounciness of two materials. |
bounciness
Declaration
public float bounciness { get; set; }
Property Value
Type | Description |
---|---|
System.Single | This value determines how much an object bounces back after a collision. The valid range of bounciness is [0, 1]. 0 means no bounce, 1 means full bounce. Note: Value will be automatically clamped to [0, 1] if it is set outside the range. |
collisionEventCombine
Declaration
public MaterialBoolCombine collisionEventCombine { get; set; }
Property Value
Type | Description |
---|---|
MaterialBoolCombine | The strategy to combine |
dynamicFriction
Declaration
public float dynamicFriction { get; set; }
Property Value
Type | Description |
---|---|
System.Single | More larger value means more faster to stop the body when it is moving on a surface. Note: if the set value is larger than staticFriction, staticFriction will be set to the same value as dynamicFriction. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when the set value is negative. |
enableCollisionEvent
Declaration
public bool enableCollisionEvent { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | If true, collision event will be triggered when this body collides with other bodies. Disable it if you don't need collision event for this body to improve performance |
frictionCombine
Declaration
public MaterialCombine frictionCombine { get; set; }
Property Value
Type | Description |
---|---|
MaterialCombine | The strategy to combine dynamic and static friction of two materials. |
staticFriction
Declaration
public float staticFriction { get; set; }
Property Value
Type | Description |
---|---|
System.Single | More larger value means more difficult to move the body when it is static on a surface. Note: if the set value is smaller than dynamicFriction, dynamicFriction will be set to the same value as staticFriction. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when the set value is negative. |
Methods
Clone()
Declaration
public PhysicMaterial Clone()
Returns
Type | Description |
---|---|
PhysicMaterial |
SetFrictions(Single, Single)
Update the dynamic and static friction of the material.
Declaration
public void SetFrictions(float dynamicFriction, float staticFriction)
Parameters
Type | Name | Description |
---|---|---|
System.Single | dynamicFriction | |
System.Single | staticFriction |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | thrown if either dynamicFriction or staticFriction is negative, or dynamicFriction is greater than staticFriction |