PhysicsWorld
A world is a container for all other physics objects such as PhysicsBody, PhysicsShape, PhysicsJoint etc. A world can be simulated in isolation from all other worlds. The maximum number of worlds that can be created at one time is defined by PhysicsConstants.MaxWorlds. A world is completely isolated from all other worlds.
Read time 22 minutesLast updated 8 days ago
Definition
- Type: Struct
- Namespace: UnityEngine.LowLevelPhysics2D
- Assembly: UnityEngine.Physics2DModule
- Implements: IEquatable<PhysicsWorld>
public readonly struct PhysicsWorld : IEquatable<PhysicsWorld>
Properties
Property | Description |
|---|---|
| autoBodyUpdateCallbacks | Controls if body update callback targets are automatically called. See PhysicsWorld.SendBodyUpdateCallbacks |
| autoContactCallbacks | Controls if shape contact callback targets are automatically called. See PhysicsWorld.SendContactCallbacks |
| autoJointThresholdCallbacks | Controls if joint threshold callback targets are automatically called. See PhysicsWorld.SendJointThresholdCallbacks |
| autoTriggerCallbacks | Controls if shape trigger callback targets are automatically called. See PhysicsWorld.SendTriggerCallbacks |
| awakeBodyCount | Get the number of awake bodies in the world. |
| bodyUpdateEvents | Get the body events from the last simulation. The PhysicsBody objects returned should be checked to see if they are valid before accessing as they may have been deleted since this event was produced (see PhysicsBody.isValid). Any change to the world state can invalidate this data so referring to this data afterwards may cause an unavoidable crash! It is recommended that you immediately extract what information you need and not directly reference the returned data. See PhysicsEvents.BodyUpdateEvent. |
| bounceThreshold | Adjust the bounce threshold, usually in meters per second. It is recommended not to make this value very small because it will prevent bodies from sleeping. |
| contactBeginEvents | Get the contact begin events from the last simulation. The PhysicsShape objects returned should be checked to see if they are valid before accessing as they may have been deleted since this event was produced (see PhysicsShape.isValid). The PhysicsShape.Contact objects returned should be checked to see if they are valid before accessing as they may have been deleted since this event was produced (see isValid). Any change to the world state can invalidate this data so referring to this data afterwards may cause an unavoidable crash! It is recommended that you immediately extract what information you need and not directly reference the returned data. See PhysicsEvents.ContactBeginEvent. |
| contactDamping | The contact bounciness with 1 being critical damping (non-dimensional). |
| contactEndEvents | Get the contact end events from the last simulation. The PhysicsShape objects returned should be checked to see if they are valid before accessing as they may have been deleted since this event was produced (see PhysicsShape.isValid). The PhysicsShape.Contact objects returned should be checked to see if they are valid before accessing as they may have been deleted since this event was produced (see isValid). Any change to the world state can invalidate this data so referring to this data afterwards may cause an unavoidable crash! It is recommended that you immediately extract what information you need and not directly reference the returned data. See PhysicsEvents.ContactEndEvent. |
| contactFilterCallbacks | Controls if contact filter callbacks will be called. A contact filter callback allows direct control over whether a contact will be created between a pair of shapes. This applies to both triggers and non-triggers but only with Dynamic bodies. These are relatively expensive so disabling them can provide a significant performance benefit. A contact filter callback will call the PhysicsShape.callbackTarget for both shapes involved if they implement PhysicsCallbacks.IContactFilterCallback. |
| contactFrequency | The contact stiffness, in cycles per second. |
| contactHitEvents | Get the contact hit events from the last simulation. The PhysicsShape objects returned should be checked to see if they are valid before accessing as they may have been deleted since this event was produced (see PhysicsShape.isValid). Any change to the world state can invalidate this data so referring to this data afterwards may cause an unavoidable crash! It is recommended that you immediately extract what information you need and not directly reference the returned data. See PhysicsEvents.ContactHitEvent. |
| contactHitEventThreshold | The contact hit event threshold controls the collision speed needed to generate a contact hit event, usually in meters per second. See PhysicsEvents.ContactHitEvent. |
| contactRecycleDistance | The contact recycle distance, in meters. Setting this to zero disables contact point recycling. Contact recycling reuses contact points across simulation time-steps when the relative movement is small. This feature improves stability and performance by around 25% (approximately). Contact points are not recalculated until shapes move more than 5cm (default) relative to each other. Contact recycling skips some updates such as friction, pre-solve (etc) until the contacts are no longer recycled. |
| contactSpeed | The contact speed used to solve overlaps, in meters per second. |
| continuousAllowed | Controls if continuous collision detection will be used between Dynamic and Static bodies. Generally you should keep continuous collision enabled to prevent fast moving objects from going through Static objects. The performance gain from disabling continuous collision is minor. |
| counters | Get the world counters. |
| definition | Get/Set a world definition by accessing all of its current properties. This is provided as convenience only and should not be used when performance is important as all the properties defined in the definition are accessed sequentially. You should try to only use the specific properties you need rather than using this feature. |
| drawCapacity | Controls the draw capacity. The draw capacity of the buffers when drawing are initially zero however increasing this value will mean buffers won't be resized when more elements are drawn and therefore no GC allocations will occur. Changes won't take effect until exiting play mode. This value directly controls the capacity for each element type drawn. This is only used in the Unity Editor or in a Development Player. |
| drawColors | Controls what colors are used to draw PhysicsBody, PhysicsShape, PhysicsJoint etc. This is only used in the Unity Editor or in a Development Player. |
| drawContactType | Controls the PhysicsWorld.DrawContactType used when drawing contact points. |
| drawFillAlpha | Controls the draw fill alpha. This is used to scale the interior fill alpha and is only used when PhysicsWorld.DrawFillOptions.Outline is used so that the interior color can be distinguished from the outline color by transparency. This is only used in the Unity Editor or in a Development Player. |
| drawFillOptions | Controls what aspects of is drawn using Draw. This is only used in the Unity Editor or in a Development Player. |
| drawImpulseScale | Controls the joint contact impulse scale used when drawing contact impulses. This is only used in the Unity Editor or in a Development Player. |
| drawNormalScale | Controls the joint contact normal scale used when drawing contact normals. This is only used in the Unity Editor or in a Development Player. |
| drawOptions | Draw Options used to control what is drawn using Draw. This is only used in the Unity Editor or in a Development Player. See PhysicsWorld.DrawOptions. |
| drawPointScale | Controls the draw point scale used when drawing points. This is only used in the Unity Editor or in a Development Player. |
| drawThickness | Controls the draw thickness (outline and orientation). This is only used in the Unity Editor or in a Development Player. |
| elementDepth | Controls the element depth. |
| gravity | Get/Set the gravity vector applied to all bodies in the world, usually in m/s^2. |
| isDefaultWorld | Check if this is the default PhysicsWorld. The default world is automatically created at start-up. |
| isEmpty | Check if the world is empty as defined by having no bodies, shapes or joints. |
| isOwned | Get if the world is owned. See PhysicsWorld.SetOwner. |
| isValid | Check if the world is valid. |
| jointThresholdEvents | Get the joint events from the last simulation. An event is produced by a Joint which exceeds either its PhysicsJoint.forceThreshold or PhysicsJoint.torqueThreshold. The PhysicsJoint objects returned should be checked to see if they are valid before accessing as they may have been deleted since this event was produced (see PhysicsJoint.isValid). Any change to the world state can invalidate this data so referring to this data afterwards may cause an unavoidable crash! It is recommended that you immediately extract what information you need and not directly reference the returned data. See PhysicsEvents.JointThresholdEvent. |
| lastSimulationDeltaTime | Get the delta-time used for the last simulation run. |
| lastSimulationTimestamp | Get the timestamp when the last simulation was run. |
| maximumLinearSpeed | Get/Set the maximum linear speed. |
| ownerUserData | Get PhysicsUserData that can be used for any purpose, typically by the owner only. |
| paused | Get/Set if the world is paused. When paused, any simulation attempted will be ignored whether it be automatic or manual. |
| preSolveCallbacks | Controls if pre-solve callbacks will be called. This only applies to Dynamic bodies and is ignored for triggers. These are relatively expensive so disabling them can provide a significant performance benefit. A pre-solve callback will call the PhysicsShape.callbackTarget for both shapes involved if they implement PhysicsCallbacks.IPreSolveCallback. |
| profile | Get the world timing profile. |
| simulationSubSteps | Get/Set the simulation sub-steps to use during simulation. See PhysicsWorld.Simulate. |
| simulationType | Get/Set the simulation type which controls when or if the simulation will be automatically simulated. See PhysicsWorld.SimulationType. |
| simulationWorkers | Get/Set the simulation worker count for the world. A single simulation worker is always used for simulation therefore a worker count of one means single thread simulation only. The actual quantity of workers used will always be capped to those available on the current device and reading the property will return the number of workers actually being used by the device. Changing the worker count continuously is not recommend and will impact performance as it requires the task queue be recreated. See PhysicsWorldDefinition.simulationWorkers. |
| sleepingAllowed | Controls if bodies go to sleep when not moving and not interacting. Sleeping can provide a significant performance improvement when many Dynamic or Kinematic bodies are in the world. |
| transformPlane | Controls the transform plane that the world uses when writing transforms. See PhysicsWorld.transformWriteMode. |
| transformTweening | Controls if Transform tweening is used. Transform tweening is where bodies that have their PhysicsBody.transformObject set, write to the Transform each frame depending on the specific body PhysicsBody.TransformWriteMode set. Regardless of this setting, Transform tweening is never used if the PhysicsWorld.simulationType is PhysicsWorld.SimulationType.Update or PhysicsWorld.transformWriteMode is PhysicsWorld.TransformWriteMode.Off. |
| transformWriteMode | Controls how transform writing is handled. Only bodies that have their PhysicsBody.transformWriteMode active and produce a PhysicsEvents.BodyUpdateEvent will write to a transform. See PhysicsWorld.TransformWriteMode. |
| triggerBeginEvents | Get the trigger begin events from the last simulation. The PhysicsShape objects returned should be checked to see if they are valid before accessing as they may have been deleted since this event was produced (see PhysicsShape.isValid). Any change to the world state can invalidate this data so referring to this data afterwards may cause an unavoidable crash! It is recommended that you immediately extract what information you need and not directly reference the returned data. See PhysicsEvents.TriggerBeginEvent. |
| triggerEndEvents | Get the trigger end events from the last simulation. The PhysicsShape objects returned should be checked to see if they are valid before accessing as they may have been deleted since this event was produced (see PhysicsShape.isValid). Any change to the world state can invalidate this data so referring to this data afterwards may cause an unavoidable crash! It is recommended that you immediately extract what information you need and not directly reference the returned data. See PhysicsEvents.TriggerEndEvent. |
| userData | Get/Set PhysicsUserData that can be used for any purpose. This cannot be set on the PhysicsWorld.defaultWorld and will always be at the default. The physics system doesn't use this data, it is entirely for custom use. |
| warmStartingAllowed | Is warm-starting allowed in the world? Disabling warming-starting will severely impact stability. This is typically used for testing only! |
Static Properties
Property | Description |
|---|---|
| aabbMargin | The distance used to expand AABBs in the broadphase dynamic tree, in meters. This allows broadphase proxies to move by a small amount without triggering a tree adjustment. This value is 0.05f * PhysicsWorld.lengthUnitsPerMeter. Normally this is 5cm. |
| bodyMaxRotation | The maximum rotation of a body per time step, in degrees. This limit is very large and is used to prevent numerical problems. This value is approximately 45-degrees or 0.25f * PhysicsMath.PI radians. |
| bodyTimeToSleep | The time that a body must be still before it will go to sleep, in seconds. This value is 0.5f |
| bypassLowLevel | Get if the low-level physics is currently bypassed or not. When bypassed, no simulations or rendering will occur reducing it to near-zero CPU overhead. This can be controlled via PhysicsLowLevelSettings2D.bypassLowLevel. |
| concurrentSimulations | Controls how many simulations can be started in parallel. Whilst running simulations in parallel can improver overall performance, workers should ideally be left free for the simulation solver otherwise it may degrade solving performance. The actual quantity of workers used will always be capped to those available on the current device. If the total number of workers available is below 4 then parallel simulation won't occur as generally this would reduce overall performance, however parallel solving of each simulation using workers will still be used. This should not be confused with the quantity of workers used when solving a simulation. |
| defaultWorld | Get the default world created at start-up. This world cannot be destroyed as it is permanently owned by Unity itself. See PhysicsWorld.SetOwner and PhysicsWorld.isOwned. |
| globalCounters | Get the world counters, summed for all the active worlds. |
| globalProfile | Get the world timing profile, summed for all the active worlds. |
| hugeWorldExtent | Positions greater than about 16km will have precision problems, so 100km as a limit should be fine in all cases. This is used to detect bad values. This value is 100000.0f * PhysicsWorld.lengthUnitsPerMeter. |
| isRenderingAllowed | Get if rendering is currently allowed. Rendering is always allowed in the Editor however it is only allowed in build if PhysicsLowLevelSettings2D.drawInBuild is active when building. |
| lengthUnitsPerMeter | Get the internal length units per meter. Changes won't take effect until exiting play mode. The physics system bases all length units on meters but you may need different units for your project. You can set this value to use different units but it should only be modified before any other calls to the physics system occur and only modified once. Changing this value after any physics object has been created can result in severe simulation instabilities. |
| linearSlop | A small length used as a collision and constraint tolerance, in meters. Usually it is chosen to be numerically significant, but visually insignificant. This value is 0.005f * PhysicsWorld.lengthUnitsPerMeter. Normally this is 0.5cm. |
| safetyLocksEnabled | Get/Set whether safety threading locks are enabled or not. Locks are enabled by default however on platforms that do not support threading, locks are not used. Disabling locks can result in a small performance boost however, please note the following EXTREME CAUTIONS. |
| speculativeContactDistance | The distance at which speculative contacts will be calculated. This reduces jitter. This value is 4.0f * PhysicsWorld.lengthUnitsPerMeter. Normally this is 2cm. |
| useFullLayers | Indicates if the option of PhysicsLowLevelSettings2D.useFullLayers is active or not. If no PhysicsLowLevelSettings2D asset is assigned, this option will return false (inactive). When active, the 64-bit layers are used (see PhysicsLowLevelSettings2D.physicsLayerNames) for property drawers and PhysicsLayers.GetLayerMask. When inactive, the 32-bit layers are used (see LayerMask) for property drawers and PhysicsLayers.GetLayerMask. In all cases, the physics system itself will always use the full 64-bit layers assigned, however when using 32-bit layers, the top 32-bits will be set to zero. |
| worldCount | Get the number of created worlds. This will be a value in the range of 1 to PhysicsConstants.MaxWorlds. |
Methods
Method | Description |
|---|---|
| CastGeometry | Returns the shape(s) that intersect the specified Capsule geometry as it is cast through the world. See PhysicsQuery.QueryFilter, PhysicsQuery.WorldCastMode, PhysicsQuery.WorldCastResult and Allocator. |
| CastMover | Cast a "Mover" which is geometry designed to collide with the world and solve its movement. Everything is specified via the PhysicsQuery.WorldMoverInput with results returned in PhysicsQuery.WorldMoverResult. |
| CastRay | Returns the shape(s) that intersect the specified Ray. Technically this is a line-segment and not an infinite ray. See PhysicsQuery.QueryFilter, PhysicsQuery.WorldCastMode, PhysicsQuery.WorldCastResult and Allocator. |
| CastShape | Returns the shape(s) that intersect the specified shape as it is cast through the world. The selected shape is excluded from any results and must be in this world otherwise a warning will be produced. Neither PhysicsShape.ShapeType.Segment or PhysicsShape.ShapeType.ChainSegment shape types are supported. See PhysicsQuery.QueryFilter, PhysicsQuery.WorldCastMode, PhysicsQuery.WorldCastResult and Allocator. |
| CastShapeProxy | Returns the shape(s) that intersect the specified Circle geometry as it is cast through the world. See PhysicsQuery.QueryFilter, PhysicsQuery.WorldCastMode, PhysicsQuery.WorldCastResult and Allocator. |
| ClearDraw | Clear all the custom drawn items that have a lifetime. This is only used in the Unity Editor or in a Development Player. |
| CreateBody | Create a body using the PhysicsBodyDefinition.defaultDefinition in the world. See PhysicsBody.Create. |
| CreateBodyBatch | Create a batch of bodies in the world. |
| CreateJoint | Create a PhysicsDistanceJoint in the world. See PhysicsDistanceJoint.Create. |
| Destroy | Destroy a world, destroying all objects contained within it such as all PhysicsBody and attached PhysicsShape and PhysicsJoint. If the object is owned with PhysicsWorld.SetOwner then you must provide the owner key it returned. Failing to do so will return a warning and the world will not be destroyed. You cannot destroy the PhysicsWorld.defaultWorld as it is permanently owned by Unity itself. |
| DrawBox | Draw a Box. This is only used in the Unity Editor or in a Development Player. |
| DrawCapsule | Draw a Capsule outline. This is only used in the Unity Editor or in a Development Player. For further information on the parameters. |
| DrawCircle | Draw a Circle outline. This is only used in the Unity Editor or in a Development Player. For further information on the parameters. See CircleGeometry. |
| DrawGeometry | Draw the specified span of Capsule geometry. This is only used in the Unity Editor or in a Development Player. |
| DrawLine | Draw a Line. This is only used in the Unity Editor or in a Development Player. |
| DrawLineStrip | Draw a set of vertices as lines joined to each other. This is only used in the Unity Editor or in a Development Player. |
| DrawPoint | Draw a Point. This is only used in the Unity Editor or in a Development Player. A Point is similar to a filled Circle except the radius here is specified in pixels rather than world units. |
| DrawTransformAxis | Draw a Transform axis. This is only used in the Unity Editor or in a Development Player. |
| Explode | Apply a radial explosion applying impulses away from the position to all bodies found within in the radius. |
| GetBodies | Get all the active PhysicsBody in the specified world. |
| GetBodyUpdateCallbackTargets | Get all current PhysicsWorld.bodyUpdateEvents where either of the PhysicsBody involved are valid (see PhysicsBody.isValid) and have a callback target assigned (see PhysicsBody.callbackTarget). |
| GetBodyUpdateOwnerUserData | Get all PhysicsBody.ownerUserData assigned to each PhysicsBody returned with PhysicsWorld.bodyUpdateEvents. The Native Array returned will be of the same length and be ordered the same as the PhysicsEvents.BodyUpdateEvent returned with PhysicsWorld.bodyUpdateEvents. Any PhysicsBody that are not valid will return a default PhysicsUserData. |
| GetBodyUpdateUserData | Get all PhysicsBody.userData assigned to each PhysicsBody returned with PhysicsWorld.bodyUpdateEvents. The Native Array returned will be of the same length and be ordered the same as the PhysicsEvents.BodyUpdateEvent returned with PhysicsWorld.bodyUpdateEvents. Any PhysicsBody that are not valid will return a default PhysicsUserData. |
| GetContactCallbackTargets | Get all current PhysicsWorld.contactBeginEvents and PhysicsWorld.contactEndEvents where either of the PhysicsShape involved are valid (see PhysicsShape.isValid) and have a callback target assigned (see PhysicsShape.callbackTarget). |
| GetJoints | Get all the active PhysicsJoint in the specified world. |
| GetJointThresholdCallbackTargets | Get all current PhysicsWorld.jointThresholdEvents where either of the PhysicsJoint involved are valid (see PhysicsJoint.isValid) and have a callback target assigned (see PhysicsJoint.callbackTarget). |
| GetOwner | Get the owner object associated with this world as specified using PhysicsWorld.SetOwner. |
| GetTransformWriteTweens | Gets all the existing Transform Write Tweens that are handled per-frame. |
| GetTriggerCallbackTargets | Get all current PhysicsWorld.triggerBeginEvents and PhysicsWorld.triggerEndEvents where either of the PhysicsShape involved are valid (see PhysicsShape.isValid) and have a callback target assigned (see PhysicsShape.callbackTarget). |
| OverlapAABB | Returns all shapes that potentially overlap the provided AABB. The overlap is between AABB of shapes in the world therefore it may not result in an exact overlap of the shape itself. See PhysicsAABB, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator. |
| OverlapGeometry | Returns all shapes that overlap the provided Capsule geometry. See CapsuleGeometry, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator. |
| OverlapPoint | Returns all shapes that overlap the provided point. See PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator. |
| OverlapShape | Returns all shapes that overlap the provided shape. The selected shape is excluded from any results and must be in this world otherwise a warning will be produced. |
| OverlapShapeProxy | Returns all shapes that overlap the shape proxy. See PhysicsQuery.QueryFilter. PhysicsQuery.WorldOverlapResult and Allocator. |
| Reset | Reset the world to a canonical state so that it will reproduce identical results each time. The world must be empty for this to be called otherwise a warning is produced. |
| SendAllCallbacks | Send all callbacks to targets: |
| SendBodyUpdateCallbacks | Send all current PhysicsWorld.bodyUpdateEvents where the PhysicsBody involved are valid (see PhysicsBody.isValid) and have a callback target assigned (see PhysicsBody.callbackTarget). Only callback targets that implement PhysicsCallbacks.IBodyUpdateCallback will be called. This will be called automatically if PhysicsWorld.autoBodyUpdateCallbacks is true. This must be called on the main thread. |
| SendContactCallbacks | Send all current PhysicsWorld.contactBeginEvents and PhysicsWorld.contactEndEvents where either of the PhysicsShape involved are valid (see PhysicsShape.isValid) and have a callback target assigned (see PhysicsShape.callbackTarget). These events will only be created if both of the shape pairs has PhysicsShape.contactEvents set to true. Only callback targets that implement PhysicsCallbacks.IContactCallback will be called. This will be called automatically if PhysicsWorld.autoContactCallbacks is true. This must be called on the main thread. |
| SendJointThresholdCallbacks | Send all current PhysicsWorld.jointThresholdEvents where the PhysicsJoint involved are valid (see PhysicsJoint.isValid) and have a callback target assigned (see PhysicsJoint.callbackTarget). These events will only be created if the joint exceeds its PhysicsJoint.forceThreshold or PhysicsJoint.torqueThreshold. Only callback targets that implement PhysicsCallbacks.IJointThresholdCallback will be called. This will be called automatically if PhysicsWorld.autoJointThresholdCallbacks is true. This must be called on the main thread. |
| SendTriggerCallbacks | Send all current PhysicsWorld.triggerBeginEvents and PhysicsWorld.triggerEndEvents where either of the PhysicsShape involved are valid (see PhysicsShape.isValid) and have a callback target assigned (see PhysicsShape.callbackTarget). These events will only be created if one of the shape pairs has PhysicsShape.triggerEvents set to true. Only callback targets that implement PhysicsCallbacks.ITriggerCallback will be called. This will be called automatically if PhysicsWorld.autoTriggerCallbacks is true. This must be called on the main thread. |
| SetElementDepth3D | Set the element depth using the specified 3D position. The relevant axis will be extracted using the current PhysicsWorld.transformPlane. This is only used in the Unity Editor or in a Development Player. |
| SetOwner | Set the (optional) owner object associated with this world and return an owner key that must be specified when destroying the world with PhysicsWorld.Destroy. The physics system provides access to all objects, including the ability to destroy them so this feature can be used to stop accidental destruction of objects that are owned by other objects. You can only set the owner once, multiple attempts will produce a warning. The lifetime of the specified owner object is not linked to this world i.e. this world will still be owned by the owner object, even if it is destroyed. It is also valid to not specify an owner object (NULL) to simply gain an owner key however it can be useful, if simply for debugging purposes and discovery, to know which object is the owner. |
| SetOwnerUserData | Set PhysicsUserData that can be used for any purpose, typically by the owner only. |
| Simulate | Simulate the world. The world should must have its PhysicsWorld.simulationType set to PhysicsWorld.SimulationType.Script for this to work. |
| TestOverlapAABB | Tests if the provided AABB potentially overlaps any shapes. The overlap is between AABB of shapes in the world therefore it may not result in an exact overlap of any shape itself. See PhysicsAABB and PhysicsQuery.QueryFilter. |
| TestOverlapGeometry | Tests if the provided Capsule geometry overlaps any shapes. See CapsuleGeometry and PhysicsQuery.QueryFilter. |
| TestOverlapPoint | Tests if the provided point overlaps any shapes. See PhysicsQuery.QueryFilter. |
| TestOverlapShape | Tests if the provided shape overlaps any shapes. The selected shape is excluded from any results and must be in this world otherwise a warning will be produced. |
| TestOverlapShapeProxy | Test if the provided shape proxy overlaps any shapes. |
Static Methods
Method | Description |
|---|---|
| Create | Create a PhysicsWorld using the PhysicsWorldDefinition.defaultDefinition. |
| DestroyBodyBatch | Destroy a batch of bodies. Any invalid bodies will be ignored. Owned bodies will produce a warning and will not be destroyed (See PhysicsBody.SetOwner). |
| DestroyJointBatch | Destroy a batch of joints. Any invalid joints will be ignored. Owned joints will produce a warning and will not be destroyed (PhysicsJoint.SetOwner). |
| DestroyShapeBatch | Destroy a batch of shapes, destroying all PhysicsShape.Contact the shapes are involved in. Any invalid shapes will be ignored including chain segment shapes created via a PhysicsChain (the chain must be destroyed)." Owned shapes will produce a warning and will not be destroyed (PhysicsShape.SetOwner). See PhysicsBody.MassConfiguration. |
| GetWorlds | Get all the active PhysicsWorld. This includes the PhysicsWorld.defaultWorld so will always contain at least a single world. |
| Simulate | Simulate a batch of worlds. The worlds can be simulated concurrently depending on the setting of PhysicsLowLevelSettings2D.concurrentSimulations. The worlds in the batch must have their PhysicsWorld.simulationType set to PhysicsWorld.SimulationType.Script. |
Structs
Struct | Description |
|---|---|
| PhysicsWorld.DrawColors | The colors used to draw PhysicsBody, PhysicsShape, PhysicsJoint etc. |
| PhysicsWorld.ExplosionDefinition | Used to define the parameters when using PhysicsWorld.Explode. |
| PhysicsWorld.WorldCounters | PhysicsWorld counters that give details of the world simulation size. |
| PhysicsWorld.WorldProfile | PhysicsWorld profile that contains the timings of specific world simulation stages. All times are in milliseconds. |
Enums
Enum | Description |
|---|---|
| PhysicsWorld.DrawContactType | Controls which properties of a PhysicsShape.ContactManifold.ManifoldPoint are drawn when drawing contact points. |
| PhysicsWorld.DrawFillOptions | Controls what aspects of is drawn using Draw. |
| PhysicsWorld.DrawOptions | Draw Options used to control what is drawn using Draw. Debug Drawing is only available on devices that support Compute Shaders. |
| PhysicsWorld.SimulationType | Defines when the simulation will run. |
| PhysicsWorld.TransformPlane | Defines the 2D Transform plane where Transform writes will occur. This also defines the rotation axis which will automatically be perpendicular to the selected plane. See PhysicsWorld.transformPlane. |
| PhysicsWorld.TransformWriteMode | Defines how the 2D Transforms from each PhysicsBody are written to the 3D Transform system. |