Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


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 _maximumWorlds. A world is completely isolated from all other worlds.
Read time 24 minutesLast updated 6 days ago

Definition

public readonly struct PhysicsWorld : IEquatable<PhysicsWorld>

Properties

Property

Description

autoBodyUpdateCallbacksControls if body update callback targets are automatically called. See PhysicsWorld.SendBodyUpdateCallbacks
autoContactCallbacksControls if shape contact callback targets are automatically called. See PhysicsWorld.SendContactCallbacks
autoJointThresholdCallbacksControls if joint threshold callback targets are automatically called. See PhysicsWorld.SendJointThresholdCallbacks
autoTriggerCallbacksControls if shape trigger callback targets are automatically called. See PhysicsWorld.SendTriggerCallbacks
awakeBodyCountGet the number of awake bodies in the world.
bodyUpdateEventsGet 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 _isValid). Any change to the world state can invalidate this data so referring to this data afterwards may cause an unavoidable crash! You must immediately extract what information you need and not directly reference the returned data as it will be cleared immediately after being provided. See PhysicsEvents.BodyUpdateEvent.
bounceThresholdAdjust 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.
capacityGet the current world capacities reached since the world was created. This reflects the peak object counts and can be used to presize a _capacity for similar worlds. Peaks are not capped, so a peak above 65535 is clamped to that maximum when used to presize another world.
contactBeginEventsGet 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 _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. Any change to the world state can invalidate this data so referring to this data afterwards may cause an unavoidable crash! You must immediately extract what information you need and not directly reference the returned data as it will be cleared immediately after being provided. See PhysicsEvents.ContactBeginEvent.
contactDampingThe contact bounciness with 1 being critical damping (non-dimensional).
contactEndEventsGet 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 _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. Any change to the world state can invalidate this data so referring to this data afterwards may cause an unavoidable crash! You must immediately extract what information you need and not directly reference the returned data as it will be cleared immediately after being provided. See PhysicsEvents.ContactEndEvent.
contactFilterCallbacksControls 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 _callbackTarget for both shapes involved if they implement PhysicsCallbacks.IContactFilterCallback.
contactFrequencyThe contact stiffness, in cycles per second.
contactHitEventsGet 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 _isValid). Any change to the world state can invalidate this data so referring to this data afterwards may cause an unavoidable crash! You must immediately extract what information you need and not directly reference the returned data as it will be cleared immediately after being provided. See PhysicsEvents.ContactHitEvent.
contactHitEventThresholdThe contact hit event threshold controls the collision speed needed to generate a contact hit event, usually in meters per second. See PhysicsEvents.ContactHitEvent.
contactRecycleDistanceThe 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.
contactSpeedThe contact speed used to solve overlaps, in meters per second.
continuousAllowedControls 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.
countersGet the world counters.
definitionGet/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.
drawColorsControls what colors are used to draw PhysicsBody, PhysicsShape, PhysicsJoint etc.
drawContactTypeControls the PhysicsWorld.DrawContactType used when drawing contact points.
drawFillAlphaControls 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.
drawFillOptionsControls how shape geometry is filled when drawing. See PhysicsWorld.DrawFillOptions.
drawFilterLimits what gets drawn to a narrow selection. This only affects PhysicsWorld.DrawOptions that are drawing all bodies, shapes etc. It does not affect selected elements or custom drawing. See PhysicsWorld.IgnoreFilter.
drawForceScaleControls the joint contact force scale used when drawing contact forces.
drawNormalScaleControls the joint contact normal scale used when drawing contact normals.
drawOptionsLimits what gets drawn to a broad selection. See PhysicsWorld.DrawOptions.
drawPointScaleControls the draw point scale used when drawing points.
drawThicknessControls the draw thickness (outline and orientation).
elementDepthControls the element depth.
generationGet the world handle generation.
gravityGet/Set the gravity vector applied to all bodies in the world, usually in m/s^2.
indexGet the world handle index.
isDefaultWorldCheck if this is the default PhysicsWorld. The default world is automatically created at start-up.
isEmptyCheck if the world is empty as defined by having no bodies, shapes or joints.
isOwnedGet if the world is owned. See PhysicsWorld.SetOwner.
isValidCheck if the world is valid.
jointThresholdEventsGet the joint events from the last simulation. An event is produced by a Joint which exceeds either its _forceThreshold or _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 _isValid). Any change to the world state can invalidate this data so referring to this data afterwards may cause an unavoidable crash! You must immediately extract what information you need and not directly reference the returned data as it will be cleared immediately after being provided. See PhysicsEvents.JointThresholdEvent.
lastSimulationDeltaTimeGet the delta-time used for the last simulation run.
lastSimulationTimestampGet the timestamp when the last simulation was run.
maximumLinearSpeedGet/Set the maximum linear speed.
ownerUserDataGet PhysicsUserData that can be used for any purpose, typically by the owner only.
pausedGet/Set if the world is paused. When paused, any simulation attempted will be ignored whether it be automatic or manual.
preSolveCallbacksControls 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 _callbackTarget for both shapes involved if they implement PhysicsCallbacks.IPreSolveCallback.
profileGet the world timing profile.
simulationSubStepsGet/Set the simulation sub-steps to use during simulation. See PhysicsWorld.Simulate.
simulationTypeGet/Set the simulation type which controls when or if the simulation will be automatically simulated. See PhysicsWorld.SimulationType.
simulationWorkersGet/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 _simulationWorkers.
sleepingAllowedControls 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.
syncInterpolationControls if an extra write pass prior to the script fixed-update callback is made for any interpolation tweens to ensure that transforms are synchronized to the final body pose. Because this is an extra write pass, it has an impact on overall performance so only enable if you require transforms synchronized this way.
transformPlaneControls the transform plane that the world uses when writing transforms. See _transformWriteMode.
transformPlaneCustomControls the transformation for the PhysicsWorld.TransformPlane.Custom to allow transformation writing and reading to/from a custom 2D plane. See PhysicsWorld.TransformPlaneCustom.
transformTweenModeControls if and how Transform tweens are calculated and/or written. Transform tweening is where bodies that have their _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 _simulationType is PhysicsWorld.SimulationType.Update or _transformWriteMode is PhysicsWorld.TransformWriteMode.Off.
transformWriteCallbackTargetGet/Set the custom Object that implements the PhysicsCallbacks.ITransformWriteCallback to which PhysicsEvents.TransformWriteEvent and PhysicsEvents.TransformTweenWriteEvent will be sent. The callback will only occur if _transformWriteMode is set to PhysicsWorld.TransformWriteMode.Custom and there are _bodyUpdateEvents available. The object assigned here will be kept alive, not allowing the GC to dispose of it. To remove the object assigned here, set the callback target to NULL.
transformWriteModeControls how transform writing is handled. Only bodies that have their _transformWriteMode active and produce a PhysicsEvents.BodyUpdateEvent will write to a transform. See PhysicsWorld.TransformWriteMode.
triggerBeginEventsGet 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 _isValid). Any change to the world state can invalidate this data so referring to this data afterwards may cause an unavoidable crash! You must immediately extract what information you need and not directly reference the returned data as it will be cleared immediately after being provided. See PhysicsEvents.TriggerBeginEvent.
triggerEndEventsGet 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 _isValid). Any change to the world state can invalidate this data so referring to this data afterwards may cause an unavoidable crash! You must immediately extract what information you need and not directly reference the returned data as it will be cleared immediately after being provided. See PhysicsEvents.TriggerEndEvent.
userDataGet/Set PhysicsUserData that can be used for any purpose. This cannot be set on the _defaultWorld and will always be at the default. The physics system doesn't use this data, it is entirely for custom use.
warmStartingAllowedIs warm-starting allowed in the world? Disabling warming-starting will severely impact stability. This is typically used for testing only!

Static Properties

Property

Description

aabbMarginGet 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 * _lengthUnitsPerMeter. Normally this is 5cm.
alwaysDrawWorldsGet if worlds are always drawn independent of whether rendering is currently active or not as specified by _renderingMode. When true, world drawing is always active and a PhysicsEvents.WorldDrawResults event is produced containing the PhysicsWorld.DrawResults. When false, world drawing only occurs depending on the _renderingMode setting. This can be controlled via _alwaysDrawWorlds.
bodyMaxRotationGet 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.
bodyTimeToSleepGet the time that a body must be still before it will go to sleep, in seconds. This value is 0.5 seconds.
concurrentSimulationsGets how many simulations can be started in parallel.
contactFilterGroupModeGet the current value of _contactFilterGroupMode.
contactFilterModeGet the current value of _contactFilterMode.
defaultWorldGet the default world created at start-up. This world cannot be destroyed as it is permanently owned by Unity itself. See PhysicsWorld.SetOwner and _isOwned.
disableSimulationGet if the automatic simulation of any PhysicsWorld is temporarily disabled. When true, no automatic simulation will occur. When false, normal operation occurs with automatic simulation. This can be controlled via _disableSimulation.
globalCountersGet the world counters, summed for all the active worlds.
globalProfileGet the world timing profile, summed for all the active worlds.
hugeWorldExtentGets what physics considers a large extent in the world. Positions greater than approximately 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 * _lengthUnitsPerMeter.
isRenderingAllowedGet if rendering is currently allowed. Rendering is always allowed in the Editor however it is only allowed elsewhere depending on _renderingMode.
lengthUnitsPerMeterGet the internal length units per meter. Changes won't take effect until exiting play mode. The physics system relates 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.
linearSlopGet the 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 * _lengthUnitsPerMeter. Normally this is 0.5cm.
maximumWorldsAllocatedGet the actual allocated maximum worlds available. This can differ at runtime from _maximumWorlds if it was changed and the physics system has not been restarted. Another reason this can differ would be if there was not available memory to allocate the requested maximum worlds.
renderingModeGet the current value of _renderingMode.
safetyLocksEnabledGet/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.
speculativeContactDistanceGet the distance at which speculative contacts will be calculated. This reduces jitter. This value is 4.0f * _lengthUnitsPerMeter. Normally this is 2cm.
transformChangeModeGet the current value of _transformChangeMode. See PhysicsWorld.TransformChangeMode.
usePhysicsLayersGet if the option of _usePhysicsLayers is active or not. If no PhysicsCoreSettings2D asset is assigned, this option will return false (inactive). When active, the physics 64-bit layers are used (see _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.
worldCountGet the number of created worlds. This will be a value in the range of 1 to _maximumWorlds.

Methods

Method

Description

CastGeometryReturns 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.
CastMoverCast 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.
CastRayReturns 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.
CastShapeReturns 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.
CastShapeProxyReturns 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.
ClearDrawClear all the custom drawn items.
CreateBodyCreate a body using the _defaultDefinition in the world. See PhysicsBody.Create.
CreateBodyBatchCreate a batch of bodies in the world.
CreateJointCreate a PhysicsDistanceJoint in the world. See PhysicsDistanceJoint.Create.
DestroyDestroy 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 _defaultWorld as it is permanently owned by Unity itself.
DrawAABBDraw an AABB.
DrawBoxDraw a Box.
DrawCapsuleDraw a Capsule outline. For further information on the parameters, see CapsuleGeometry.
DrawCircleDraw a Circle outline. For further information on the parameters, see CircleGeometry.
DrawGeometryDraw the specified span of Capsule geometry.
DrawLineDraw a Line.
DrawLineStripDraw a set of vertices as lines joined to each other.
DrawPointDraw a Point. A Point is similar to a filled Circle except the radius here is specified in pixels rather than world units.
DrawQueryCastGeometryDraw the PhysicsWorld.CastGeometry query input.
DrawQueryCastRayDraw the PhysicsWorld.CastRay query inputs.
DrawQueryCastShapeDraw the PhysicsWorld.CastShape query input.
DrawQueryCastShapeProxyDraw the PhysicsWorld.CastShapeProxy query input.
DrawQueryResultDraw the PhysicsQuery.CastResult returned from multiple queries. Only a result where _hit is true is drawn.
DrawShapeProxyDraw the specified span of PhysicsShape.ShapeProxy.
DrawTransformAxisDraw a Transform axis.
ExplodeApply a radial explosion applying impulses away from the position to all bodies found within in the radius.
GetBodiesGet all the active PhysicsBody in the specified world.
GetBodyUpdateCallbackTargetsGet all current _bodyUpdateEvents where either of the PhysicsBody involved are valid (see _isValid) and have a callback target assigned (see _callbackTarget).
GetBodyUpdateOwnerUserDataGet all _ownerUserData assigned to each PhysicsBody returned with _bodyUpdateEvents. The Native Array returned will be of the same length and be ordered the same as the PhysicsEvents.BodyUpdateEvent returned with _bodyUpdateEvents. Any PhysicsBody that are not valid will return a default PhysicsUserData.
GetBodyUpdateUserDataGet all _userData assigned to each PhysicsBody returned with _bodyUpdateEvents. The Native Array returned will be of the same length and be ordered the same as the PhysicsEvents.BodyUpdateEvent returned with _bodyUpdateEvents. Any PhysicsBody that are not valid will return a default PhysicsUserData.
GetContactCallbackTargetsGet all current _contactBeginEvents and _contactEndEvents where either of the PhysicsShape involved are valid (see _isValid) and have a callback target assigned (see _callbackTarget).
GetJointsGet all the active PhysicsJoint in the specified world.
GetJointThresholdCallbackTargetsGet all current _jointThresholdEvents where either of the PhysicsJoint involved are valid (see _isValid) and have a callback target assigned (see _callbackTarget).
GetOwnerGet the owner object associated with this world as specified using PhysicsWorld.SetOwner.
GetTransformWriteTweensGets all the existing Transform Write Tweens that are handled per-frame. If the _transformTweenMode is PhysicsWorld.TransformTweenMode.Sequential then the tweens are sorted into ascending transform depth allowing writing to the Transform hierarchy by simply iterating the tweens . If the _transformTweenMode is PhysicsWorld.TransformTweenMode.Sequential then the tweens are unsorted as a TransformAccessArray is used to write them. See PhysicsBody.TransformWriteTween and PhysicsBody.TransformWriteMode.
GetTriggerCallbackTargetsGet all current _triggerBeginEvents and _triggerEndEvents where either of the PhysicsShape involved are valid (see _isValid) and have a callback target assigned (see _callbackTarget).
OverlapAABBReturns all shapes that potentially overlap the provided AABBs. 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.
OverlapGeometryReturns all shapes that overlap the provided Capsule geometry. See CapsuleGeometry, PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator.
OverlapPointReturns all shapes that overlap the provided point(s). This first converts the shape to a PhysicsShape.ShapeProxy and uses PhysicsWorld.TestOverlapShapeProxy. See PhysicsQuery.QueryFilter, PhysicsQuery.WorldOverlapResult and Allocator.
OverlapShapeReturns 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.
OverlapShapeProxyReturns all shapes that overlap the shape proxies. See PhysicsQuery.QueryFilter. PhysicsQuery.WorldOverlapResult and Allocator.
ResetReset 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.
SendAllCallbacksSend all callbacks to targets:
SendBodyUpdateCallbacksSend all current _bodyUpdateEvents where the PhysicsBody involved are valid (see _isValid) and have a callback target assigned (see _callbackTarget). Only callback targets that implement PhysicsCallbacks.IBodyUpdateCallback will be called. This will be called automatically if _autoBodyUpdateCallbacks is true. This must be called on the main thread.
SendContactCallbacksSend all current _contactBeginEvents and _contactEndEvents where either of the PhysicsShape involved are valid (see _isValid) and have a callback target assigned (see _callbackTarget). These events will only be created if both of the shape pairs has _contactEvents set to true. Only callback targets that implement PhysicsCallbacks.IContactCallback will be called. This will be called automatically if _autoContactCallbacks is true. This must be called on the main thread.
SendJointThresholdCallbacksSend all current _jointThresholdEvents where the PhysicsJoint involved are valid (see _isValid) and have a callback target assigned (see _callbackTarget). These events will only be created if the joint exceeds its _forceThreshold or _torqueThreshold. Only callback targets that implement PhysicsCallbacks.IJointThresholdCallback will be called. This will be called automatically if _autoJointThresholdCallbacks is true. This must be called on the main thread.
SendTriggerCallbacksSend all current _triggerBeginEvents and _triggerEndEvents where either of the PhysicsShape involved are valid (see _isValid) and have a callback target assigned (see _callbackTarget). These events will only be created if one of the shape pairs has _triggerEvents set to true. Only callback targets that implement PhysicsCallbacks.ITriggerCallback will be called. This will be called automatically if _autoTriggerCallbacks is true. This must be called on the main thread.
SetElementDepth3DSet the element depth using the specified 3D position. The relevant axis will be extracted using the current _transformPlane. If PhysicsWorld.TransformPlane.Custom is used, the element depth is always set to zero.
SetOwnerSet the owner object using the specified owner key. You can only set the owner once, multiple attempts will produce a warning. This call does not bind the lifetime of the specified owner object, it is simply a reference. 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.
SetOwnerUserDataSet PhysicsUserData that can be used for any purpose, typically by the owner only.
SimulateSimulate the world. If
deltaTime
is zero then only contact and trigger events will be updated and no velocity or position integration or constraint updates will occur.
TestOverlapAABBTests if the provided AABBs potentially overlap 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.
TestOverlapGeometryTests if the provided Capsule geometry overlaps any shapes. See CapsuleGeometry and PhysicsQuery.QueryFilter.
TestOverlapPointTests if the provided point(s) overlap any shapes. See PhysicsQuery.QueryFilter.
TestOverlapShapeTests 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.
TestOverlapShapeProxyTest if the provided shape proxies overlaps any shapes.

Static Methods

Method

Description

CheckTransformChangesChecks for any transform changes. Anything using PhysicsWorld.RegisterTransformChange will immediately be notified of any changes. This should be used sparingly otherwise it may impact performance. The preference should be not using this but instead control transform changes to be monitored with _transformChangeMode.
CreateCreate a PhysicsWorld using the _defaultDefinition.
CreateOwnerKeyCreate an owner key.
DestroyBodyBatchDestroy a batch of bodies. Any invalid bodies will be ignored. Owned bodies will produce a warning and will not be destroyed (See PhysicsBody.SetOwner).
DestroyJointBatchDestroy a batch of joints. Any invalid joints will be ignored. Owned joints will produce a warning and will not be destroyed (PhysicsJoint.SetOwner).
DestroyShapeBatchDestroy 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.
GetWorldsGet all the active PhysicsWorld. This includes the _defaultWorld so will always contain at least a single world.
RegisterTransformChangeRegister a transform watcher to call the specified callback when a transform changes. See PhysicsEvents.TransformChangeEvent for the types of transform changes that are watched for.
SetOwnerSet the owner object using the specified owner key. You can only set the owner once, multiple attempts will produce a warning. This call does not bind the lifetime of the specified owner object, it is simply a reference. Whilst it is valid to not specify an owner object (NULL), it is recommended for debugging purposes.
SetTransformSet the Transform position without causing a PhysicsEvents.TransformChangeEvent to be generated by default. See PhysicsWorld.RegisterTransformChange.
SetTransformAccessSet the TransformAccess position without causing a PhysicsEvents.TransformChangeEvent to be generated. See PhysicsWorld.RegisterTransformChange.
SimulateSimulate a batch of worlds. If
deltaTime
is zero then only contact and trigger events will be updated and no velocity or position integration or constraint updates will occur. The worlds can be simulated concurrently depending on the setting of _concurrentSimulations.
UnregisterTransformChangeUnregister a transform watched to stop calling the specified callback when a transform changes. See PhysicsEvents.TransformChangeEvent for the types of transform changes that are watched for.

Structs

Struct

Description

PhysicsWorld.DrawColorsThe colors used to draw PhysicsBody, PhysicsShape, PhysicsJoint etc.
PhysicsWorld.DrawResultsThe draw results retrieved from the world. You must immediately extract what information you need and not directly reference the returned data as it will be cleared immediately after being provided.
PhysicsWorld.ExplosionDefinitionUsed to define the parameters when using PhysicsWorld.Explode.
PhysicsWorld.TransformPlaneCustomA transformation applied to the transform write if _transformPlane is set to PhysicsWorld.TransformPlane.Custom.
PhysicsWorld.WorldCapacityDescribes the expected world capacities used to presize internal allocations when a PhysicsWorld is created. All counts default to zero, in which case the engine uses its own minimum defaults. Every count is in the range zero to 65535 and any value outside that range is clamped into it.
PhysicsWorld.WorldCountersPhysicsWorld counters that give details of the world simulation size.
PhysicsWorld.WorldProfilePhysicsWorld profile that contains the timings of specific world simulation stages. All times are in milliseconds.

Enums

Enum

Description

PhysicsWorld.DrawContactTypeControls which properties of a PhysicsShape.ContactManifold.ManifoldPoint are drawn when drawing contact points.
PhysicsWorld.DrawFillOptionsControls how shape geometry is filled when drawing.
PhysicsWorld.DrawOptionsDraw Options limits what gets drawn to a broad selection.
PhysicsWorld.IgnoreFilterA ignore flags are a narrow selection of objects/types in the world which needs to be ignored.
PhysicsWorld.RenderingModeControls drawing and rendering is allowed.
PhysicsWorld.SimulationTypeDefines when the simulation will run.
PhysicsWorld.TransformChangeModeDefines when changes to Transform that are registered with PhysicsWorld.RegisterTransformChange are called.
PhysicsWorld.TransformChangeReasonDefines the reason why a Transform changed. Register and unregister for transform changes with PhysicsWorld.RegisterTransformChange and PhysicsWorld.UnregisterTransformChange.
PhysicsWorld.TransformPlaneDefines 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 _transformPlane.
PhysicsWorld.TransformTweenModeDefines if and how Transform tweens are calculated and/or written.
PhysicsWorld.TransformWriteModeDefines how the 2D Transforms from each PhysicsBody are written to the 3D Transform system.