Class PhysicsProjectSettings
The physics project setting.
Inheritance
Namespace: Motphys.Rigidbody
Assembly: solution.dll
Syntax
[Serializable]
public class PhysicsProjectSettings : CustomProjectSettings
Constructors
PhysicsProjectSettings()
Declaration
public PhysicsProjectSettings()
Fields
MaxPosSolverIter
Declaration
public const uint MaxPosSolverIter = 20U
Field Value
Type | Description |
---|---|
System.UInt32 |
Properties
allowExpandSpeculativeMargin
Declaration
public bool allowExpandSpeculativeMargin { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | If true, the engine will expand all colliders' speculative margin to provide a wider range of collision detection. |
enableContactEvent
Declaration
public bool enableContactEvent { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | If false, engine will not produce collision events. |
enableSceneQuery
Declaration
public bool enableSceneQuery { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | If false, overlap test and raycast will not work. |
gravity
Declaration
public Vector3 gravity { get; set; }
Property Value
Type | Description |
---|---|
Vector3 | The gravity of the default physics world. |
Instance
Declaration
public static PhysicsProjectSettings Instance { get; }
Property Value
Type | Description |
---|---|
PhysicsProjectSettings | The physics setting instance. |
numSolverPositionIterations
Declaration
public uint numSolverPositionIterations { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 | The number of position solver iterations for all constraints in each substep. Increase the number of solver iterations will improve the stability and accuracy of the simulation but will also increase the computation cost. |
numSolverVelocityIterations
Declaration
public uint numSolverVelocityIterations { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 | The number of velocity solver iterations for all constraints in each substep. Increase the number of solver iterations will get more accurate simulation about bouncing and dynamic friction. |
numSubstep
Declaration
public uint numSubstep { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 | The number of substeps per physics step. Improve the numSubstep will improve the stability and accuracy of the simulation but will also increase the computation cost. |
simulationMode
Declaration
public SimulationMode simulationMode { get; }
Property Value
Type | Description |
---|---|
SimulationMode | The simulation mode how the engine updates. |
Methods
GetCollisionMask(Int32)
Get a collision mask for a specific layer.
Declaration
public uint GetCollisionMask(int layer)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | layer | Valid layer is in [0, 31] |
Returns
Type | Description |
---|---|
System.UInt32 | Return 0 if the input layer is invalid |
IgnoreLayerCollision(Int32, Int32, Boolean)
Ignore all collisions between any collider in layerA and any collider in layerB. It does not affect the generated colliders temporarily.
Declaration
public bool IgnoreLayerCollision(int layerA, int layerB, bool ignore = true)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | layerA | Valid layer is in [0, 31] |
System.Int32 | layerB | Valid layer is in [0, 31] |
System.Boolean | ignore |
Returns
Type | Description |
---|---|
System.Boolean | Return false if the input layer is invalid |
OnLoaded()
Declaration
protected override void OnLoaded()
OnValidate()
Declaration
public void OnValidate()
OnWillSave()
Declaration
protected override void OnWillSave()
SetAllLayersCollisionMask(Boolean)
Set all layers' collision mask. True: Enable collisions between all layers. False: Disable collisions between all layers.
Declaration
public void SetAllLayersCollisionMask(bool enable)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | enable |