Create
Create a PhysicsWorld using the PhysicsWorldDefinition.defaultDefinition.
Read time 1 minuteLast updated 15 days ago
Definition
- Type: Method
- Namespace: Unity.U2D.Physics
- Assembly: UnityEngine.PhysicsCore2DModule
Create()
Create a PhysicsWorld using the PhysicsWorldDefinition.defaultDefinition.
public static PhysicsWorld Create()
Returns
Type | Description |
|---|---|
| PhysicsWorld | The created world. |
Create(PhysicsWorldDefinition)
Create a PhysicsWorld.
public static PhysicsWorld Create(PhysicsWorldDefinition definition)
Parameters
The world definition to use.
Returns
Type | Description |
|---|---|
| PhysicsWorld | The created world. |
Create(Snapshot, PhysicsWorldDefinition)
Creates a new PhysicsWorld from , using for the settings a snapshot does not store.
snapshotdefinitionpublic static PhysicsWorld Create(PhysicsWorld.Snapshot snapshot, PhysicsWorldDefinition definition)
Parameters
A snapshot produced by PhysicsWorld.CreateSnapshot.
The world definition supplying the settings the snapshot does not store.
Returns
Type | Description |
|---|---|
| PhysicsWorld | The created world restored to the snapshot state, or an invalid world if the snapshot was rejected or no world could be created. |
Remarks
A snapshot restores the full simulation configuration, so these PhysicsWorldDefinition properties are taken from and their values in are ignored: PhysicsWorldDefinition.gravity, PhysicsWorldDefinition.bounceThreshold, PhysicsWorldDefinition.contactHitEventThreshold, PhysicsWorldDefinition.contactFrequency, PhysicsWorldDefinition.contactDamping, PhysicsWorldDefinition.contactSpeed, PhysicsWorldDefinition.contactRecycleDistance, PhysicsWorldDefinition.maximumLinearSpeed, PhysicsWorldDefinition.sleepingAllowed, PhysicsWorldDefinition.continuousAllowed and PhysicsWorldDefinition.capacity. All other properties are applied normally, for example PhysicsWorldDefinition.simulationWorkers and PhysicsWorldDefinition.simulationSubSteps. To use a value other than the snapshot's, set the matching property on the returned world after this call. Creating and restoring a world processes the whole image, so this is not intended to be called at high frequency.
snapshotdefinitiondefinition