Version: Unity 6.5 Alpha (6000.5)
LanguageEnglish
  • C#

PhysicsWorld

struct in Unity.U2D.Physics

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

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 PhysicsCoreSettings2D.maximumWorlds. A world is completely isolated from all other worlds.

Static Properties

Property Description
aabbMargin Get 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.
alwaysDrawWorlds Get if worlds are always drawn independent of whether rendering is currently active or not as specified by PhysicsWorld.renderingMode. When true, world drawing is always active and a PhysicsEvents.WorldDrawResults event is produced containing the DrawResults. When false, world drawing only occurs depending on the PhysicsWorld.renderingMode setting. This can be controlled via PhysicsCoreSettings2D.alwaysDrawWorlds.
bodyMaxRotation Get 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 Get the time that a body must be still before it will go to sleep, in seconds. This value is 0.5 seconds.
concurrentSimulations Gets 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.
disableSimulation Get 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 PhysicsCoreSettings2D.disableSimulation.
globalCounters Get the world counters, summed for all the active worlds.
globalProfile Get the world timing profile, summed for all the active worlds.
hugeWorldExtent Gets 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 * PhysicsWorld.lengthUnitsPerMeter.
isRenderingAllowed Get if rendering is currently allowed. Rendering is always allowed in the Editor however it is only allowed elsewhere depending on PhysicsCoreSettings2D.renderingMode.
lengthUnitsPerMeter Get 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. For example, if your game uses pixels for units you can use pixels for all length values sent to the physics system. There should be no extra cost however, the physics system has some internal tolerances and thresholds that have been tuned for meters. By calling this function, the physics system is better able to adjust those tolerances and thresholds to improve accuracy. A good rule of thumb is to pass the height of your player character to this function. So if your player character is 32 pixels high, then pass 32 to this function. Then you may confidently use pixels for all the length values sent to the physics system. All length values returned from the physics system will also then be in pixels because the physics system does not do any scaling internally, however, you are now on the hook for coming up with good values for gravity, density, and forces. The default value is 1.
linearSlop Get 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 * PhysicsWorld.lengthUnitsPerMeter. Normally this is 0.5cm.
maximumWorldsAllocated Get the actual allocated maximum worlds available. This can differ at runtime from PhysicsCoreSettings2D.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.
renderingMode Get the current value of PhysicsCoreSettings2D.renderingMode. NOTE: Drawing and rendering are always available in the Unity Editor however rendering requires compute buffer support on any device it is used without which no rendering will occur.
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. Typically, per-world, multiple read operations can happen in parallel however only a single write operation can occur concurrently. Read and write operations can never happen at the same time. Locking is a self-balancing reader-preferred system that tries to reduce writers "starving". Once a writer is in a queue, it registers incoming readers as waiting readers and, once active readers are handled, it starts processing a single writer. After that writer has been handled, it flips waiting readers into active readers and processes them. Whilst this system is extremely fast, it does have a very small overhead. Disabling this system can give a small performance boost but is nearly always not worth it therefore this option should be used for testing only. EXTREME CAUTION should be taken if disabling locks on platforms that support threading! A majority of this API is thread-safe and is is due to the safety locks! Locks are used to ensure that read and write operations do not interfere with each other. Locks also ensure that no read or write operations happen during a simulation step. Overlapping read or write operations will almost certainly result in corruptions and a subsequent crash, so unless you are absolutely sure this is not the case, do not disable locks!
speculativeContactDistance Get the distance at which speculative contacts will be calculated. This reduces jitter. This value is 4.0f * PhysicsWorld.lengthUnitsPerMeter. Normally this is 2cm.
transformChangeMode Get the current value of PhysicsCoreSettings2D.transformChangeMode. See TransformChangeMode.
usePhysicsLayers Get if the option of PhysicsCoreSettings2D.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 PhysicsCoreSettings2D.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 PhysicsCoreSettings2D.maximumWorlds.

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! 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 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 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 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 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 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 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! 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 ContactHitEvent.
contactHitEventThreshold The contact hit event threshold controls the collision speed needed to generate a contact hit event, usually in meters per second. See ContactHitEvent.
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.
drawColors Controls what colors are used to draw PhysicsBody, PhysicsShape, PhysicsJoint etc.
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.
drawFillOptions Controls how shape geometry is filled when drawing. See DrawFillOptions.
drawFilter Limits what gets drawn to a narrow selection. This only affects DrawOptions that are drawing all bodies, shapes etc. It does not affect selected elements or custom drawing. See IgnoreFilter.
drawForceScale Controls the joint contact force scale used when drawing contact forces.
drawNormalScale Controls the joint contact normal scale used when drawing contact normals.
drawOptions Limits what gets drawn to a broad selection. See DrawOptions.
drawPointScale Controls the draw point scale used when drawing points.
drawThickness Controls the draw thickness (outline and orientation).
elementDepth Controls the element depth. When using custom drawing of geometry or primitive shapes there is no reference to the orthogonal axis used with respect to the current PhysicsWorld.transformPlane. The element depth is in world-space and for each transform plan is defined as: Element depth is rendered along the Z axis when using PhysicsWorld.TransformPlane.XY.Element depth is rendered along the Y axis when using PhysicsWorld.TransformPlane.XZ.Element depth is rendered along the X axis when using PhysicsWorld.TransformPlane.ZY. You should set the element depth before performing any custom draw. The element depth will be reset to zero when rendering is complete.
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! 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 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.
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 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 SimulationType.
simulationWorkers Get/Set the simulation worker count for the world. 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.
transformPlaneCustom Controls the transformation for the PhysicsWorld.TransformPlane.Custom to allow transformation writing and reading to/from a custom 2D plane. See TransformPlaneCustom.
transformTweenMode Controls if and how Transform tweens are calculated and/or written. Transform tweening is where bodies that have their PhysicsBody.transformObject set, write to the Transform each frame depending on the specific body 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.
transformWriteCallbackTarget Get/Set the custom Object that implements the ITransformWriteCallback to which TransformWriteEvent and TransformTweenWriteEvent will be sent. The callback will only occur if PhysicsWorld.transformWriteMode is set to PhysicsWorld.TransformWriteMode.Custom and there are PhysicsWorld.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.
transformWriteMode Controls how transform writing is handled. Only bodies that have their PhysicsBody.transformWriteMode active and produce a BodyUpdateEvent will write to a transform. See 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! 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 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! 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 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!

Public Methods

Method Description
CastGeometry Returns the shape(s) that intersect the specified Circle geometry as it is cast through the world. See QueryFilter, WorldCastMode, WorldCastResult and Collections.Allocator
CastMover Cast a "Mover" which is geometry designed to collide with the world and solve its movement. Everything is specified via the WorldMoverInput with results returned in WorldMoverResult.
CastRay Returns the shape(s) that intersect the specified Ray. Technically this is a line-segment and not an infinite ray. See QueryFilter, WorldCastMode, WorldCastResult and Collections.Allocator.
CastShape Returns the shape(s) that intersect the specified shape as it is cast through the world. Neither PhysicsShape.ShapeType.Segment or PhysicsShape.ShapeType.ChainSegment shape types are supported. See QueryFilter, WorldCastMode, WorldCastResult and Collections.Allocator.
CastShapeProxy Returns the shape(s) that intersect the specified Circle geometry as it is cast through the world. See QueryFilter, WorldCastMode, WorldCastResult and Collections.Allocator.
ClearDraw Clear all the custom drawn items that have a lifetime.
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.
DrawAABB Draw an AABB.
DrawBox Draw a Box.
DrawCapsule Draw a Capsule outline. For further information on the parameters, see CapsuleGeometry.
DrawCircle Draw a Circle outline. For further information on the parameters, see CircleGeometry.
DrawGeometry Draw the specified Circle Geometry.
DrawLine Draw a Line.
DrawLineStrip Draw a set of vertices as lines joined to each other.
DrawPoint Draw a Point. A Point is similar to a filled Circle except the radius here is specified in pixels rather than world units.
DrawQueryCastGeometry Draw the PhysicsWorld.CastGeometry query input.
DrawQueryCastRay Draw the PhysicsWorld.CastRay query input.
DrawQueryCastShape Draw the PhysicsWorld.CastShape query input.
DrawQueryCastShapeProxy Draw the PhysicsWorld.CastShapeProxy query input.
DrawQueryResult Draw the CastResult returned from multiple queries. Only a result where Unity.U2D.Physics.PhysicsQuery.CastResult._hit is true is drawn.
DrawShapeProxy Draw a ShapeProxy.
DrawTransformAxis Draw a Transform axis.
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).
GetBodyUpdateUserData Get all PhysicsUserData 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 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. If the PhysicsWorld.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 PhysicsWorld.transformTweenMode is PhysicsWorld.TransformTweenMode.Sequential then the tweens are unsorted as a Jobs.TransformAccessArray is used to write them. See TransformWriteTween and TransformWriteMode.
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, QueryFilter, WorldOverlapResult and Collections.Allocator.
OverlapGeometry Returns all shapes that overlap the provided Circle geometry. A circle with a radius of zero is equivalent to PhysicsWorld.OverlapPoint. See CircleGeometry, QueryFilter, WorldOverlapResult and Collections.Allocator
OverlapPoint Returns all shapes that overlap the provided point. This first converts the shape to a ShapeProxy and uses PhysicsWorld.TestOverlapShapeProxy. See QueryFilter, WorldOverlapResult and Collections.Allocator.
OverlapShape Returns all shapes that overlap the provided shape. See PolygonGeometry, QueryFilter, see cref="Unity.U2D.Physics.PhysicsQuery.WorldOverlapResult"/> and Collections.Allocator.
OverlapShapeProxy Returns all shapes that overlap the shape proxy. See QueryFilter. WorldOverlapResult and Collections.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: PhysicsWorld.SendBodyUpdateCallbacksPhysicsWorld.SendTriggerCallbacksPhysicsWorld.SendContactCallbacksPhysicsWorld.SendJointThresholdCallbacks
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 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 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 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 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. For more details, see PhysicsWorld.elementDepth.
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.
Simulate Simulate the world. If is zero then only contact and trigger events will be updated and no velocity or position integration or constraint updates will occur.
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 QueryFilter.
TestOverlapGeometry Tests if the provided Circle geometry overlaps any shapes. A circle with a radius of zero is equivalent to PhysicsWorld.TestOverlapPoint. See CircleGeometry and QueryFilter.
TestOverlapPoint Tests if the provided point overlaps any shapes. See QueryFilter.
TestOverlapShape Tests if the provided shape overlaps any shapes. This first converts the shape to a ShapeProxy and uses PhysicsWorld.TestOverlapShapeProxy.
TestOverlapShapeProxy Test if the provided shape proxy overlaps any shapes. This first converts the shape to a ShapeProxy and uses PhysicsWorld.TestOverlapShapeProxy.

Static Methods

Method Description
CheckTransformChanges Checks 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 PhysicsWorld.transformChangeMode.
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 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 MassConfiguration.
GetWorlds Get all the active PhysicsWorld. This includes the PhysicsWorld.defaultWorld so will always contain at least a single world.
RegisterTransformChange Register a transform watcher to call the specified callback when a transform changes. See TransformChangeEvent for the types of transform changes that are watched for. You MUST unregister this when no longer needed with PhysicsWorld.UnregisterTransformChange otherwise you will receive warnings.
SetTransform Set the Transform position without causing a TransformChangeEvent to be generated by default. See PhysicsWorld.RegisterTransformChange.
SetTransformAccess Set the Jobs.TransformAccess position without causing a TransformChangeEvent to be generated. See PhysicsWorld.RegisterTransformChange.
UnregisterTransformChange Unregister a transform watched to stop calling the specified callback when a transform changes. See TransformChangeEvent for the types of transform changes that are watched for.