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
- Type: Struct
- Namespace: Unity.U2D.Physics
- Assembly: UnityEngine.PhysicsCore2DModule
- 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 _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. |
| 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. |
| capacity | Get 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. |
| 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 _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. |
| 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 _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. |
| 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 _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 _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. |
| 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. |
| drawColors | Controls what colors are used to draw PhysicsBody, PhysicsShape, PhysicsJoint etc. |
| 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. |
| drawFillOptions | Controls how shape geometry is filled when drawing. See PhysicsWorld.DrawFillOptions. |
| drawFilter | Limits 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. |
| 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 PhysicsWorld.DrawOptions. |
| drawPointScale | Controls the draw point scale used when drawing points. |
| drawThickness | Controls the draw thickness (outline and orientation). |
| elementDepth | Controls the element depth. |
| generation | Get the world handle generation. |
| gravity | Get/Set the gravity vector applied to all bodies in the world, usually in m/s^2. |
| index | Get the world handle index. |
| 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 _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. |
| 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 _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 _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. |
| syncInterpolation | Controls 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. |
| transformPlane | Controls the transform plane that the world uses when writing transforms. See _transformWriteMode. |
| transformPlaneCustom | Controls the transformation for the PhysicsWorld.TransformPlane.Custom to allow transformation writing and reading to/from a custom 2D plane. See PhysicsWorld.TransformPlaneCustom. |
| transformTweenMode | Controls 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. |
| transformWriteCallbackTarget | Get/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. |
| transformWriteMode | Controls 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. |
| 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 _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. |
| 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 _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. |
| userData | Get/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. |
| 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 | 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 * _lengthUnitsPerMeter. Normally this is 5cm. |
| alwaysDrawWorlds | Get 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. |
| 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. |
| contactFilterGroupMode | Get the current value of _contactFilterGroupMode. |
| contactFilterMode | Get the current value of _contactFilterMode. |
| 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 _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 _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 * _lengthUnitsPerMeter. |
| isRenderingAllowed | Get if rendering is currently allowed. Rendering is always allowed in the Editor however it is only allowed elsewhere depending on _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. |
| 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 * _lengthUnitsPerMeter. Normally this is 0.5cm. |
| maximumWorldsAllocated | Get 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. |
| renderingMode | Get the current value of _renderingMode. |
| 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 | Get the distance at which speculative contacts will be calculated. This reduces jitter. This value is 4.0f * _lengthUnitsPerMeter. Normally this is 2cm. |
| transformChangeMode | Get the current value of _transformChangeMode. See PhysicsWorld.TransformChangeMode. |
| usePhysicsLayers | Get 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. |
| worldCount | Get the number of created worlds. This will be a value in the range of 1 to _maximumWorlds. |
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. |
| CreateBody | Create a body using the _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 _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 span of Capsule 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 inputs. |
| DrawQueryCastShape | Draw the PhysicsWorld.CastShape query input. |
| DrawQueryCastShapeProxy | Draw the PhysicsWorld.CastShapeProxy query input. |
| DrawQueryResult | Draw the PhysicsQuery.CastResult returned from multiple queries. Only a result where _hit is true is drawn. |
| DrawShapeProxy | Draw the specified span of PhysicsShape.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 _bodyUpdateEvents where either of the PhysicsBody involved are valid (see _isValid) and have a callback target assigned (see _callbackTarget). |
| GetBodyUpdateOwnerUserData | Get 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. |
| GetBodyUpdateUserData | Get 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. |
| GetContactCallbackTargets | Get all current _contactBeginEvents and _contactEndEvents where either of the PhysicsShape involved are valid (see _isValid) and have a callback target assigned (see _callbackTarget). |
| GetJoints | Get all the active PhysicsJoint in the specified world. |
| GetJointThresholdCallbackTargets | Get all current _jointThresholdEvents where either of the PhysicsJoint involved are valid (see _isValid) and have a callback target assigned (see _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 _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. |
| GetTriggerCallbackTargets | Get all current _triggerBeginEvents and _triggerEndEvents where either of the PhysicsShape involved are valid (see _isValid) and have a callback target assigned (see _callbackTarget). |
| OverlapAABB | Returns 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. |
| 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(s). This first converts the shape to a PhysicsShape.ShapeProxy and uses PhysicsWorld.TestOverlapShapeProxy. 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 proxies. 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 _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. |
| SendContactCallbacks | Send 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. |
| SendJointThresholdCallbacks | Send 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. |
| SendTriggerCallbacks | Send 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. |
| SetElementDepth3D | Set 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. |
| SetOwner | Set 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. |
| SetOwnerUserData | Set PhysicsUserData that can be used for any purpose, typically by the owner only. |
| Simulate | Simulate the world. If |
| TestOverlapAABB | Tests 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. |
| TestOverlapGeometry | Tests if the provided Capsule geometry overlaps any shapes. See CapsuleGeometry and PhysicsQuery.QueryFilter. |
| TestOverlapPoint | Tests if the provided point(s) overlap 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 proxies overlaps any shapes. |
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 _transformChangeMode. |
| Create | Create a PhysicsWorld using the _defaultDefinition. |
| CreateOwnerKey | Create an owner key. |
| 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 _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 PhysicsEvents.TransformChangeEvent for the types of transform changes that are watched for. |
| SetOwner | Set 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. |
| SetTransform | Set the Transform position without causing a PhysicsEvents.TransformChangeEvent to be generated by default. See PhysicsWorld.RegisterTransformChange. |
| SetTransformAccess | Set the TransformAccess position without causing a PhysicsEvents.TransformChangeEvent to be generated. See PhysicsWorld.RegisterTransformChange. |
| Simulate | Simulate a batch of worlds. If |
| UnregisterTransformChange | Unregister 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.DrawColors | The colors used to draw PhysicsBody, PhysicsShape, PhysicsJoint etc. |
| PhysicsWorld.DrawResults | The 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.ExplosionDefinition | Used to define the parameters when using PhysicsWorld.Explode. |
| PhysicsWorld.TransformPlaneCustom | A transformation applied to the transform write if _transformPlane is set to PhysicsWorld.TransformPlane.Custom. |
| PhysicsWorld.WorldCapacity | Describes 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.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 how shape geometry is filled when drawing. |
| PhysicsWorld.DrawOptions | Draw Options limits what gets drawn to a broad selection. |
| PhysicsWorld.IgnoreFilter | A ignore flags are a narrow selection of objects/types in the world which needs to be ignored. |
| PhysicsWorld.RenderingMode | Controls drawing and rendering is allowed. |
| PhysicsWorld.SimulationType | Defines when the simulation will run. |
| PhysicsWorld.TransformChangeMode | Defines when changes to Transform that are registered with PhysicsWorld.RegisterTransformChange are called. |
| PhysicsWorld.TransformChangeReason | Defines the reason why a Transform changed. Register and unregister for transform changes with PhysicsWorld.RegisterTransformChange and PhysicsWorld.UnregisterTransformChange. |
| 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 _transformPlane. |
| PhysicsWorld.TransformTweenMode | Defines if and how Transform tweens are calculated and/or written. |
| PhysicsWorld.TransformWriteMode | Defines how the 2D Transforms from each PhysicsBody are written to the 3D Transform system. |