Quantum 3 3.1.0

Classes | Public Member Functions | Properties | List of all members
Quantum.Physics2D.PhysicsEngine2D.Api Class Reference

2D Physics API More...

Classes

struct  ThreadSafeApi
 Struct to provide thread-safe access to the physics functions. More...
 

Public Member Functions

 Api (FrameBase frame, int threadCount)
 Initializes an Api object to provide the physics functions. More...
 
PhysicsQueryRef AddLinecastQuery (FPVector2 start, FPVector2 end, bool firstHitOnly=false, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, FP verticalPosition=default, FP verticalHeight=default)
 Adds a broad-phase line cast query to the 2D physics scene. In order to be resolved, must be added from a system that runs prior to the Physics System. More...
 
PhysicsQueryRef AddOverlapShapeQuery (FPVector2 position, FP rotation, Shape2D shape, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, FP verticalPosition=default, FP verticalHeight=default)
 Adds a broad-phase shape overlap query to the 2D physics scene. In order to be resolved, must be added from a system that runs prior to the Physics System. More...
 
PhysicsQueryRef AddOverlapShapeQuery (Transform2D transform, Shape2D shape, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Adds a broad-phase shape overlap query to the 2D physics scene. In order to be resolved, must be added from a system that runs prior to the Physics System. More...
 
PhysicsQueryRef AddOverlapShapeQuery (Transform2D transform, Transform2DVertical transformVertical, Shape2D shape, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Adds a broad-phase shape overlap query to the 2D physics scene. In order to be resolved, must be added from a system that runs prior to the Physics System. More...
 
PhysicsQueryRef AddRaycastQuery (FPVector2 origin, FPVector2 direction, FP distance, bool firstHitOnly=false, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, FP verticalPosition=default, FP verticalHeight=default)
 Adds a broad-phase raycast query to the 2D physics scene. In order to be resolved, must be added from a system that runs prior to the Physics System. More...
 
PhysicsQueryRef AddShapeCastQuery (FPVector2 start, FP rotation, Shape2D *shape, FPVector2 translation, bool firstHitOnly=false, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, FP verticalPosition=default, FP verticalHeight=default)
 Adds a broad-phase shape cast query to the 2D physics scene. In order to be resolved, must be added from a system that runs prior to the Physics System. More...
 
PhysicsQueryRef AddShapeCastQuery (FPVector2 start, FP rotation, Shape2D shape, FPVector2 translation, bool firstHitOnly=false, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, FP verticalPosition=default, FP verticalHeight=default)
 
HitCollection * AllocatePersistentHitCollection (int defaultCapacity=64)
 Allocates a persistent HitCollection on the heap with an initial capacity. To free an allocated persistent collection of 2D hits, use FreePersistentHitCollection. More...
 
bool CheckOverlap (HitCollection *hits, Shape2D *shape, Transform2D *transform, Hit *hit)
 Checks if the shape of the hit overlaps another shape and add the results in a HitCollection. More...
 
bool CheckOverlap (HitCollection *hits, Shape2D *shapeA, Transform2D *transformA, Shape2D *shapeB, Transform2D *transformB)
 Checks if two 2D shapes overlap, compound shapes included, and adds a hit for each overlapping pair of their primitive shapes. More...
 
HitCollection CheckOverlap (Shape2D *shape, Transform2D *transform, Hit *hit)
 Checks if the shape of the hit overlaps another shape. More...
 
HitCollection CheckOverlap (Shape2D *shapeA, Transform2D *transformA, Shape2D *shapeB, Transform2D *transformB)
 Checks if two 2D shapes overlap, compound shapes included, with a hit for each overlapping pair of their primitive shapes. More...
 
bool CheckOverlap (Shape2D *shapeA, Transform2D *transformA, Shape2D *shapeB, Transform2D *transformB, out CollisionResultInfo2D result)
 Checks if two 2D primitive shapes overlap. More...
 
bool CheckOverlap (Shape2D.BoxShape boxShape, Transform2D *boxTransform, Shape2D.CapsuleShape capsuleShape, Transform2D *capsuleTransform, out CollisionResultInfo2D result)
 Checks if a box shape overlaps with a capsule shape. More...
 
bool CheckOverlap (Shape2D.BoxShape boxShape, Transform2D *boxTransform, Shape2D.CircleShape circleShape, FPVector2 circlePosition, out CollisionResultInfo2D result)
 Checks if a box shape overlaps with a circle shape. More...
 
bool CheckOverlap (Shape2D.BoxShape boxShape, Transform2D *boxTransform, Shape2D.EdgeShape edgeShape, Transform2D *edgeTransform, out CollisionResultInfo2D result)
 Checks if a box shape overlaps with edge box shape. More...
 
bool CheckOverlap (Shape2D.BoxShape boxShape, Transform2D *boxTransform, Shape2D.PolygonShape polygonShape, Transform2D *polygonTransform, out CollisionResultInfo2D result)
 Checks if a box shape overlaps with a polygon shape. More...
 
bool CheckOverlap (Shape2D.BoxShape boxShapeA, Transform2D *transformA, Shape2D.BoxShape boxShapeB, Transform2D *transformB, out CollisionResultInfo2D result)
 Checks if a box shape overlaps with another box shape. More...
 
bool CheckOverlap (Shape2D.CapsuleShape capsuleShape, Transform2D *capsuleTransform, Shape2D.BoxShape boxShape, Transform2D *boxTransform, out CollisionResultInfo2D result)
 Checks if a capsule shape overlaps with a box shape. More...
 
bool CheckOverlap (Shape2D.CapsuleShape capsuleShape, Transform2D *capsuleTransform, Shape2D.CircleShape circleShape, FPVector2 circlePosition, out CollisionResultInfo2D result)
 Checks if a capsule shape overlaps with a circle shape. More...
 
bool CheckOverlap (Shape2D.CapsuleShape capsuleShape, Transform2D *capsuleTransform, Shape2D.EdgeShape edgeShape, Transform2D *edgeTransform, out CollisionResultInfo2D result)
 Checks if a capsule shape overlaps with a edge shape. More...
 
bool CheckOverlap (Shape2D.CapsuleShape capsuleShape, Transform2D *capsuleTransform, Shape2D.PolygonShape polygonShape, Transform2D *polygonTransform, out CollisionResultInfo2D result)
 Checks if a capsule shape overlaps with a polygon shape. More...
 
bool CheckOverlap (Shape2D.CapsuleShape capsuleShapeA, Transform2D *capsuleTransformA, Shape2D.CapsuleShape capsuleShapeB, Transform2D *capsuleTransformB, out CollisionResultInfo2D result)
 Checks if a capsule shape overlaps with another capsule shape. More...
 
bool CheckOverlap (Shape2D.CircleShape circleShape, FPVector2 circlePosition, Shape2D.BoxShape boxShape, Transform2D *boxTransform, out CollisionResultInfo2D result)
 Checks if a circle shape overlaps with a box shape. More...
 
bool CheckOverlap (Shape2D.CircleShape circleShape, FPVector2 circlePosition, Shape2D.CapsuleShape capsuleShape, Transform2D *capsuleTransform, out CollisionResultInfo2D result)
 Checks if a circle shape overlaps with a capsule shape. More...
 
bool CheckOverlap (Shape2D.CircleShape circleShape, FPVector2 circlePosition, Shape2D.EdgeShape edgeShape, Transform2D *edgeTransform, out CollisionResultInfo2D result)
 Checks if a circle shape overlaps with a edge shape. More...
 
bool CheckOverlap (Shape2D.CircleShape circleShape, FPVector2 circlePosition, Shape2D.PolygonShape polygonShape, Transform2D *polygonTransform, out CollisionResultInfo2D result)
 Checks if a circle shape overlaps with a polygon shape. More...
 
bool CheckOverlap (Shape2D.CircleShape circleShapeA, FPVector2 circlePositionA, Shape2D.CircleShape circleShapeB, FPVector2 circlePositionB, out CollisionResultInfo2D result)
 Checks if a circle shape overlaps with another circle shape. More...
 
bool CheckOverlap (Shape2D.EdgeShape edgeShape, Transform2D *edgeTransform, Shape2D.BoxShape boxShape, Transform2D *boxTransform, out CollisionResultInfo2D result)
 Checks if a edge shape overlaps with a box shape. More...
 
bool CheckOverlap (Shape2D.EdgeShape edgeShape, Transform2D *edgeTransform, Shape2D.CapsuleShape capsuleShape, Transform2D *capsuleTransform, out CollisionResultInfo2D result)
 Checks if a edge shape overlaps with a capsule shape. More...
 
bool CheckOverlap (Shape2D.EdgeShape edgeShape, Transform2D *edgeTransform, Shape2D.CircleShape circleShape, FPVector2 circlePosition, out CollisionResultInfo2D result)
 Checks if a edge shape overlaps with a circle shape. More...
 
bool CheckOverlap (Shape2D.EdgeShape edgeShape, Transform2D *edgeTransform, Shape2D.PolygonShape polygonShape, Transform2D *polygonTransform, out CollisionResultInfo2D result)
 Checks if a edge shape overlaps with a polygon shape. More...
 
bool CheckOverlap (Shape2D.EdgeShape edgeShapeA, Transform2D *edgeTransformA, Shape2D.EdgeShape edgeShapeB, Transform2D *edgeTransformB, out CollisionResultInfo2D result)
 Checks if a edge shape overlaps with another edge shape. More...
 
bool CheckOverlap (Shape2D.PolygonShape polygonAssetA, Transform2D *transformA, Shape2D.PolygonShape polygonAssetB, Transform2D *transformB, out CollisionResultInfo2D result)
 Checks if a polygon shape overlaps with another polygon shape. More...
 
void FreePersistentHitCollection (HitCollection *collection)
 Free a persistent HitCollection previously allocated on the heap. To allocate a persistent collection of 2D hits, use AllocatePersistentHitCollection. More...
 
bool GetAllQueriesHits (out HitCollection *queriesHits, out int queriesCount)
 Gets all the results for all the broad-phase queries added to the 2D physics scene this frame. More...
 
CallbackFlags GetCallbacks (EntityRef entity)
 Get the flags that represent which 2D physics collision callbacks will be called for the entity . More...
 
HitCollection GetQueryHits (in PhysicsQueryRef queryRef)
 Gets the results of a broad-phase query added to the 2D physics scene. More...
 
HitCollection GetQueryHits (int index)
 Obsolete. Use 'GetQueryHits(in PhysicsQueryRef)' overload instead. More...
 
void Init ()
 Initializes the game scene and creates all the physics static entries using the settings from the map. More...
 
void Init (AssetRef< Map > mapRef)
 Initializes the game scene by cleaning all physics data and settings and create the new static physics entries for each static collider component in the mapRef . More...
 
bool IsStaticColliderEnabled (int staticColliderIndex)
 Returns the current state of a 2D static collider. More...
 
bool IsValidQueryRef (in PhysicsQueryRef queryRef)
 Checks if a given broad-phase physics query reference is valid for result retrieval. Broad-phase queries must be injected before the Physics system Update, their Ref stored and the results retrieved after the Physics Update, on the same frame. More...
 
Hit? Linecast (FPVector2 start, FPVector2 end, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, FP verticalPosition=default, FP verticalHeight=default)
 Queries the 2D physics scene with a line cast and returns the closest hit to the line start, if any. More...
 
void Linecast (HitCollection *collection, FPVector2 start, FPVector2 end, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, FP verticalPosition=default, FP verticalHeight=default, bool resetHitCollection=true)
 Queries the 2D physics scene with a line cast and adds the closest hit to the line start, if any, to a persistent collection of hits. More...
 
HitCollection LinecastAll (FPVector2 start, FPVector2 end, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, FP verticalPosition=default, FP verticalHeight=default)
 Queries the 2D physics scene with a line cast, returning all hits. More...
 
void LinecastAll (HitCollection *collection, FPVector2 start, FPVector2 end, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, FP verticalPosition=default, FP verticalHeight=default, bool resetHitCollection=true)
 Queries the 2D physics scene with a line cast, adding all hits to a persistent collection. More...
 
HitCollection OverlapShape (FPVector2 position, FP rotation, Shape2D shape, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, FP verticalPosition=default, FP verticalHeight=default)
 Queries the 2D physics scene with a shape overlap. More...
 
void OverlapShape (HitCollection *collection, FPVector2 position, FP rotation, Shape2D shape, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, FP verticalPosition=default, FP verticalHeight=default, bool resetHitCollection=true)
 Queries the 2D physics scene with a shape overlap. More...
 
void OverlapShape (HitCollection *collection, Transform2D transform, Shape2D shape, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, bool resetHitCollection=true)
 Queries the 2D physics scene with a shape overlap. More...
 
void OverlapShape (HitCollection *collection, Transform2D transform, Transform2DVertical transformVertical, Shape2D shape, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, bool resetHitCollection=true)
 Queries the 2D physics scene with a shape overlap. More...
 
HitCollection OverlapShape (Transform2D transform, Shape2D shape, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Queries the 2D physics scene with a shape overlap. More...
 
HitCollection OverlapShape (Transform2D transform, Transform2DVertical transformVertical, Shape2D shape, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Queries the 2D physics scene with a shape overlap. More...
 
Hit? Raycast (FPVector2 origin, FPVector2 direction, FP distance, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, FP verticalPosition=default, FP verticalHeight=default)
 Queries the 2D physics scene with a ray cast and returns the closest hit to the ray origin, if any. More...
 
void Raycast (HitCollection *collection, FPVector2 origin, FPVector2 direction, FP distance, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, FP verticalPosition=default, FP verticalHeight=default, bool resetHitCollection=true)
 Queries the 2D physics scene with a ray cast and adds the closest hit to the ray origin, if any, to a persistent collection of hits. More...
 
HitCollection RaycastAll (FPVector2 origin, FPVector2 direction, FP distance, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, FP verticalPosition=default, FP verticalHeight=default)
 Queries the 2D physics scene with a ray cast, returning all hits. More...
 
void RaycastAll (HitCollection *collection, FPVector2 origin, FPVector2 direction, FP distance, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, FP verticalPosition=default, FP verticalHeight=default, bool resetHitCollection=true)
 Queries the 2D physics scene with a ray cast, adding all hits to a persistent collection. More...
 
void ResetCallbacks (EntityRef entity)
 Resets the tracking history of collisions the entity might have. More...
 
void ResetMap ()
 Resets 2D physics scene map asset guid. More...
 
void ResetScene ()
 Resets the entries buffer and removes all the dynamic entries of the scene. Also, joints, queries and collision data are cleaned. The PhysicsCommon.MapPhysicsData is changed to default and the PhysicsSceneSettings is changed to initial state. More...
 
TaskHandle ScheduleReset (TaskHandle taskHandle)
 Schedules a task to reset the physics state. Useful when performing multiple physics updates per frame, in which case it should be scheduled in between Updates. More...
 
TaskHandle ScheduleUpdate (ICollisionCallbacks2D callbacks, FP dt, TaskHandle taskHandle, bool resetScene=true)
 Schedules all tasks that compose the 2D Physics Update loop. If the frame map changed, the static part of the physics engine is also reset. More...
 
void SetCallbacks (EntityRef entity, CallbackFlags flags)
 Sets which 2D physics collision callbacks will be called for the entity . More...
 
void SetStaticColliderEnabled (int staticColliderIndex, bool enabled)
 Set a toggleable 2D static collider enabled state to enabled . Disabled static colliders are not considered for collisions or on query resolutions. More...
 
Hit? ShapeCast (FPVector2 start, FP rotation, Shape2D *shape, FPVector2 translation, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, FP verticalPosition=default, FP verticalHeight=default)
 Queries the 2D physics scene with a shape cast and returns the hit with the shortest Hit.CastDistanceNormalized, if any. More...
 
Hit? ShapeCast (FPVector2 start, FP rotation, Shape2D shape, FPVector2 translation, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, FP verticalPosition=default, FP verticalHeight=default)
 
void ShapeCast (HitCollection *collection, FPVector2 start, FP rotation, Shape2D *shape, FPVector2 translation, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, FP verticalPosition=default, FP verticalHeight=default, bool resetHitCollection=true)
 Queries the 2D physics scene with a shape cast and adds the hit with the shortest Hit.CastDistanceNormalized, if any, to a persistent collection of hits. More...
 
HitCollection ShapeCastAll (FPVector2 start, FP rotation, Shape2D *shape, FPVector2 translation, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, FP verticalPosition=default, FP verticalHeight=default)
 Queries the 2D physics scene with a shape cast, returning all hits. More...
 
HitCollection ShapeCastAll (FPVector2 start, FP rotation, Shape2D shape, FPVector2 translation, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, FP verticalPosition=default, FP verticalHeight=default)
 
void ShapeCastAll (HitCollection *collection, FPVector2 start, FP rotation, Shape2D *shape, FPVector2 translation, int layerMask=-1, QueryOptions options=QueryOptions.HitAll, FP verticalPosition=default, FP verticalHeight=default, bool resetHitCollection=true)
 Queries the 2D physics scene with a shape cast, adding all hits to a persistent collection. More...
 
bool TryGetQueryHits (in PhysicsQueryRef queryRef, out HitCollection queryHits)
 Tries to get the results of a broad-phase query added to the 2D physics scene. More...
 
bool TryGetQueryHits (int index, out HitCollection queryHits)
 Obsolete. Use 'TryGetQueryHits(in PhysicsQueryRef, out HitCollection)' overload instead. More...
 
TaskHandle Update (ICollisionCallbacks2D callbacks, FP dt, TaskHandle taskHandle, bool resetScene=false)
 

Properties

Map Map [get]
 Retrieves the map asset currently used on the physics scene. More...
 

Detailed Description

2D Physics API

Constructor & Destructor Documentation

◆ Api()

Quantum.Physics2D.PhysicsEngine2D.Api.Api ( FrameBase  frame,
int  threadCount 
)
inline

Initializes an Api object to provide the physics functions.

Parameters
frameThe reference of a frame.
threadCountThe number of threads.

Member Function Documentation

◆ GetCallbacks()

CallbackFlags Quantum.Physics2D.PhysicsEngine2D.Api.GetCallbacks ( EntityRef  entity)
inline

Get the flags that represent which 2D physics collision callbacks will be called for the entity .

The entity must have a PhysicsCollider2D component attached to be able to collide with other physics entries.

To modify the callbacks, use SetCallbacks.

Parameters
entityThe entity from which to get the callback flags.
Returns
The callback flags set to a given entity. Default if the entity did not have callback flags set.

◆ ResetCallbacks()

void Quantum.Physics2D.PhysicsEngine2D.Api.ResetCallbacks ( EntityRef  entity)
inline

Resets the tracking history of collisions the entity might have.

◆ Init() [1/2]

void Quantum.Physics2D.PhysicsEngine2D.Api.Init ( )
inline

Initializes the game scene and creates all the physics static entries using the settings from the map.

◆ Init() [2/2]

void Quantum.Physics2D.PhysicsEngine2D.Api.Init ( AssetRef< Map >  mapRef)
inline

Initializes the game scene by cleaning all physics data and settings and create the new static physics entries for each static collider component in the mapRef .

Parameters
mapRefThe Map asset for loading static collider data and other physics settings.

◆ ResetScene()

void Quantum.Physics2D.PhysicsEngine2D.Api.ResetScene ( )
inline

Resets the entries buffer and removes all the dynamic entries of the scene. Also, joints, queries and collision data are cleaned. The PhysicsCommon.MapPhysicsData is changed to default and the PhysicsSceneSettings is changed to initial state.

◆ ScheduleUpdate()

TaskHandle Quantum.Physics2D.PhysicsEngine2D.Api.ScheduleUpdate ( ICollisionCallbacks2D  callbacks,
FP  dt,
TaskHandle  taskHandle,
bool  resetScene = true 
)
inline

Schedules all tasks that compose the 2D Physics Update loop. If the frame map changed, the static part of the physics engine is also reset.

Parameters
callbacksA listener of physics collision callbacks.
dtDelta-time of the physics update loop
taskHandleHandle of the last task scheduled in the graph.
resetSceneIf a task to clear the physics scene should be scheduled before all other tasks. The physics scene is automatically reset as soon as a frame simulation begins, so resetting it again is not necessary unless there are multiple physics updates being scheduled in the same frame, in which case all physics updates after the first one should have this value set to true.
Returns
The task handle of the last task scheduled by the physics engine.

◆ ScheduleReset()

TaskHandle Quantum.Physics2D.PhysicsEngine2D.Api.ScheduleReset ( TaskHandle  taskHandle)
inline

Schedules a task to reset the physics state. Useful when performing multiple physics updates per frame, in which case it should be scheduled in between Updates.

Parameters
taskHandleHandle of the last task scheduled in the graph.
Returns
The task handle of the last task scheduled by this method.

◆ ResetMap()

void Quantum.Physics2D.PhysicsEngine2D.Api.ResetMap ( )
inline

Resets 2D physics scene map asset guid.

◆ GetQueryHits()

HitCollection Quantum.Physics2D.PhysicsEngine2D.Api.GetQueryHits ( int  index)
inline

Obsolete. Use 'GetQueryHits(in PhysicsQueryRef)' overload instead.

◆ TryGetQueryHits()

bool Quantum.Physics2D.PhysicsEngine2D.Api.TryGetQueryHits ( int  index,
out HitCollection  queryHits 
)
inline

Obsolete. Use 'TryGetQueryHits(in PhysicsQueryRef, out HitCollection)' overload instead.

◆ CheckOverlap() [1/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( HitCollection *  hits,
Shape2D *  shape,
Transform2D *  transform,
Hit *  hit 
)
inline

Checks if the shape of the hit overlaps another shape and add the results in a HitCollection.

Parameters
hitsA previously allocated persistent HitCollection, to which the query hits will be added. For allocating a persistent HitCollection, see AllocatePersistentHitCollection.
shapeThe 2D shape to be overlapped.
transformA 2D transform component pointer, with Position and Rotation info of the shape overlap.
hitA 2D hit as reference to an entity that has shape and transform to be overlapped.
Returns
Return if the shapes are in overlap.

◆ CheckOverlap() [2/26]

HitCollection Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D *  shape,
Transform2D *  transform,
Hit *  hit 
)
inline

Checks if the shape of the hit overlaps another shape.

Parameters
shapeThe 2D shape to be overlapped.
transformA 2D transform component pointer, with Position and Rotation info of the shape overlap.
hitA 2D hit as reference to an entity that has shape and transform to be overlapped
Returns
A temporary HitCollection with the query hits, automatically freed when the current frame simulation ends.

◆ CheckOverlap() [3/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( HitCollection *  hits,
Shape2D *  shapeA,
Transform2D *  transformA,
Shape2D *  shapeB,
Transform2D *  transformB 
)
inline

Checks if two 2D shapes overlap, compound shapes included, and adds a hit for each overlapping pair of their primitive shapes.

Parameters
hitsA previously allocated persistent HitCollection, to which the hits will be added. For allocating a persistent HitCollection, see AllocatePersistentHitCollection.
shapeAThe 2D shape to be overlapped.
transformAThe transform of the entity that owns shapeA .
shapeBThe 2D shape that will overlap.
transformBThe transform of the entity that owns shapeB .
Returns
If this call added any hit.

The hits do not identify the overlapping parts. For part-level results, check each pair of parts with CheckOverlap(Shape2D*, Transform2D*, Shape2D*, Transform2D*, out CollisionResultInfo2D).

◆ CheckOverlap() [4/26]

HitCollection Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D *  shapeA,
Transform2D *  transformA,
Shape2D *  shapeB,
Transform2D *  transformB 
)
inline

Checks if two 2D shapes overlap, compound shapes included, with a hit for each overlapping pair of their primitive shapes.

Parameters
shapeAThe 2D shape to be overlapped.
transformAThe transform of the entity that owns shapeA .
shapeBThe 2D shape that will overlap.
transformBThe transform of the entity that owns shapeB .
Returns
A temporary HitCollection with the hits, automatically freed when the current frame simulation ends.

The hits do not identify the overlapping parts. For part-level results, check each pair of parts with CheckOverlap(Shape2D*, Transform2D*, Shape2D*, Transform2D*, out CollisionResultInfo2D).

◆ CheckOverlap() [5/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D *  shapeA,
Transform2D *  transformA,
Shape2D *  shapeB,
Transform2D *  transformB,
out CollisionResultInfo2D  result 
)
inline

Checks if two 2D primitive shapes overlap.

Parameters
shapeAThe 2D shape to be overlapped.
transformAThe transform of the entity that owns shapeA .
shapeBThe 2D shape that will overlap.
transformBThe transform of the entity that owns shapeB .
resultA CollisionResultInfo2D struct that contains the penetration, normal and computed contact points.
Returns
Return if the shapes are in overlap.

◆ CheckOverlap() [6/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D.BoxShape  boxShapeA,
Transform2D *  transformA,
Shape2D.BoxShape  boxShapeB,
Transform2D *  transformB,
out CollisionResultInfo2D  result 
)
inline

Checks if a box shape overlaps with another box shape.

Parameters
boxShapeAThe 2D box shape to be overlapped.
transformAA 2D transform component pointer, with Position and Rotation info of the overlapped box shape.
boxShapeBThe 2D box shape that will overlap.
transformBA 2D transform component pointer, with Position and Rotation info of the box shape that will overlap.
resultA CollisionResultInfo2D struct that contains the penetration, normal and computed contact points.
Returns
Return if the shapes are in overlap.

◆ CheckOverlap() [7/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D.CircleShape  circleShapeA,
FPVector2  circlePositionA,
Shape2D.CircleShape  circleShapeB,
FPVector2  circlePositionB,
out CollisionResultInfo2D  result 
)
inline

Checks if a circle shape overlaps with another circle shape.

Parameters
circleShapeAThe 2D circle shape to be overlapped.
circlePositionAThe position in which the circle shape is overlapped.
circleShapeBThe 2D shape that will overlap.
circlePositionBThe position at which the circle shape will overlap.
resultA CollisionResultInfo2D struct that contains the penetration, normal and computed contact points.
Returns
Return if the shapes are in overlap.

◆ CheckOverlap() [8/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D.CircleShape  circleShape,
FPVector2  circlePosition,
Shape2D.BoxShape  boxShape,
Transform2D *  boxTransform,
out CollisionResultInfo2D  result 
)
inline

Checks if a circle shape overlaps with a box shape.

Parameters
circleShapeThe 2D circle shape to be overlapped.
circlePositionThe position in which the circle shape is overlapped.
boxShapeThe 2D box shape that will overlap.
boxTransformA 2D transform component pointer, with Position and Rotation info of the box shape that will overlap.
resultA CollisionResultInfo2D struct that contains the penetration, normal and computed contact points.
Returns
Return if the shapes are in overlap.

◆ CheckOverlap() [9/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D.BoxShape  boxShape,
Transform2D *  boxTransform,
Shape2D.CircleShape  circleShape,
FPVector2  circlePosition,
out CollisionResultInfo2D  result 
)
inline

Checks if a box shape overlaps with a circle shape.

Parameters
boxShapeThe 2D box shape to be overlapped.
boxTransformA 2D transform component pointer, with Position and Rotation info of the overlapped box shape.
circleShapeThe 2D circle shape that will overlap.
circlePositionThe position at which the circle shape will overlap.
resultA CollisionResultInfo2D struct that contains the penetration, normal and computed contact points.
Returns
Return if the shapes are in overlap.

◆ CheckOverlap() [10/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D.BoxShape  boxShape,
Transform2D *  boxTransform,
Shape2D.EdgeShape  edgeShape,
Transform2D *  edgeTransform,
out CollisionResultInfo2D  result 
)
inline

Checks if a box shape overlaps with edge box shape.

Parameters
boxShapeThe 2D box shape to be overlapped.
boxTransformA 2D transform component pointer, with Position and Rotation info of the overlapped box shape.
edgeShapeThe 2D edge shape that will overlap.
edgeTransformA 2D transform component pointer, with Position and Rotation info of the edge shape that will overlap.
resultA CollisionResultInfo2D struct that contains the penetration, normal and computed contact points.
Returns
Return if the shapes are in overlap.

◆ CheckOverlap() [11/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D.EdgeShape  edgeShape,
Transform2D *  edgeTransform,
Shape2D.BoxShape  boxShape,
Transform2D *  boxTransform,
out CollisionResultInfo2D  result 
)
inline

Checks if a edge shape overlaps with a box shape.

Parameters
edgeShapeThe 2D edge shape to be overlapped.
edgeTransformA 2D transform component pointer, with Position and Rotation info of the overlapped edge shape.
boxShapeThe 2D box shape that will overlap.
boxTransformA 2D transform component pointer, with Position and Rotation info of the box shape that will overlap.
resultA CollisionResultInfo2D struct that contains the penetration, normal and computed contact points.
Returns
Return if the shapes are in overlap.

◆ CheckOverlap() [12/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D.CapsuleShape  capsuleShape,
Transform2D *  capsuleTransform,
Shape2D.BoxShape  boxShape,
Transform2D *  boxTransform,
out CollisionResultInfo2D  result 
)
inline

Checks if a capsule shape overlaps with a box shape.

Parameters
capsuleShapeThe 2D capsule shape to be overlapped.
capsuleTransformA 2D transform component pointer, with Position and Rotation info of the overlapped capsule shape.
boxShapeThe 2D box shape that will overlap.
boxTransformA 2D transform component pointer, with Position and Rotation info of the box shape that will overlap.
resultA CollisionResultInfo2D struct that contains the penetration, normal and computed contact points.
Returns
Return if the shapes are in overlap.

◆ CheckOverlap() [13/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D.BoxShape  boxShape,
Transform2D *  boxTransform,
Shape2D.CapsuleShape  capsuleShape,
Transform2D *  capsuleTransform,
out CollisionResultInfo2D  result 
)
inline

Checks if a box shape overlaps with a capsule shape.

Parameters
boxShapeThe 2D box shape to be overlapped.
boxTransformA 2D transform component pointer, with Position and Rotation info of the overlapped box shape.
capsuleShapeThe 2D capsule shape that will overlap.
capsuleTransformA 2D transform component pointer, with Position and Rotation info of the capsule shape that will overlap.
resultA CollisionResultInfo2D struct that contains the penetration, normal and computed contact points.
Returns
Return if the shapes are in overlap.

◆ CheckOverlap() [14/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D.CapsuleShape  capsuleShapeA,
Transform2D *  capsuleTransformA,
Shape2D.CapsuleShape  capsuleShapeB,
Transform2D *  capsuleTransformB,
out CollisionResultInfo2D  result 
)
inline

Checks if a capsule shape overlaps with another capsule shape.

Parameters
capsuleShapeAThe 2D capsule shape to be overlapped.
capsuleTransformAA 2D transform component pointer, with Position and Rotation info of the overlapped capsule shape.
capsuleShapeBThe 2D capsule shape that will overlap.
capsuleTransformBA 2D transform component pointer, with Position and Rotation info of the capsule shape that will overlap.
resultA CollisionResultInfo2D struct that contains the penetration, normal and computed contact points.
Returns
Return if the shapes are in overlap.

◆ CheckOverlap() [15/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D.CapsuleShape  capsuleShape,
Transform2D *  capsuleTransform,
Shape2D.CircleShape  circleShape,
FPVector2  circlePosition,
out CollisionResultInfo2D  result 
)
inline

Checks if a capsule shape overlaps with a circle shape.

Parameters
capsuleShapeThe 2D capsule shape to be overlapped.
capsuleTransformA 2D transform component pointer, with Position and Rotation info of the overlapped capsule shape.
circleShapeThe 2D circle shape that will overlap.
circlePositionThe position at which the circle shape will overlap.
resultA CollisionResultInfo2D struct that contains the penetration, normal and computed contact points.
Returns
Return if the shapes are in overlap.

◆ CheckOverlap() [16/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D.CircleShape  circleShape,
FPVector2  circlePosition,
Shape2D.CapsuleShape  capsuleShape,
Transform2D *  capsuleTransform,
out CollisionResultInfo2D  result 
)
inline

Checks if a circle shape overlaps with a capsule shape.

Parameters
circleShapeThe 2D circle shape to be overlapped.
circlePositionThe position in which the circle shape is overlapped.
capsuleShapeThe 2D capsule shape that will overlap.
capsuleTransformA 2D transform component pointer, with Position and Rotation info of the capsule shape that will overlap.
resultA CollisionResultInfo2D struct that contains the penetration, normal and computed contact points.
Returns
Return if the shapes are in overlap.

◆ CheckOverlap() [17/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D.CapsuleShape  capsuleShape,
Transform2D *  capsuleTransform,
Shape2D.EdgeShape  edgeShape,
Transform2D *  edgeTransform,
out CollisionResultInfo2D  result 
)
inline

Checks if a capsule shape overlaps with a edge shape.

Parameters
capsuleShapeThe 2D capsule shape to be overlapped.
capsuleTransformA 2D transform component pointer, with Position and Rotation info of the overlapped capsule shape.
edgeShapeThe 2D edge shape that will overlap.
edgeTransformA 2D transform component pointer, with Position and Rotation info of the edge shape that will overlap.
resultA CollisionResultInfo2D struct that contains the penetration, normal and computed contact points.
Returns
Return if the shapes are in overlap.

◆ CheckOverlap() [18/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D.EdgeShape  edgeShape,
Transform2D *  edgeTransform,
Shape2D.CapsuleShape  capsuleShape,
Transform2D *  capsuleTransform,
out CollisionResultInfo2D  result 
)
inline

Checks if a edge shape overlaps with a capsule shape.

Parameters
edgeShapeThe 2D edge shape to be overlapped.
edgeTransformA 2D transform component pointer, with Position and Rotation info of the overlapped edge shape.
capsuleShapeThe 2D capsule shape that will overlap.
capsuleTransformA 2D transform component pointer, with Position and Rotation info of the capsule shape that will overlap.
resultA CollisionResultInfo2D struct that contains the penetration, normal and computed contact points.
Returns
Return if the shapes are in overlap.

◆ CheckOverlap() [19/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D.CircleShape  circleShape,
FPVector2  circlePosition,
Shape2D.EdgeShape  edgeShape,
Transform2D *  edgeTransform,
out CollisionResultInfo2D  result 
)
inline

Checks if a circle shape overlaps with a edge shape.

Parameters
circleShapeThe 2D circle shape to be overlapped.
circlePositionThe position in which the circle shape is overlapped.
edgeShapeThe 2D edge shape that will overlap.
edgeTransformA 2D transform component pointer, with Position and Rotation info of the edge shape that will overlap.
resultA CollisionResultInfo2D struct that contains the penetration, normal and computed contact points.
Returns
Return if the shapes are in overlap.

◆ CheckOverlap() [20/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D.EdgeShape  edgeShape,
Transform2D *  edgeTransform,
Shape2D.CircleShape  circleShape,
FPVector2  circlePosition,
out CollisionResultInfo2D  result 
)
inline

Checks if a edge shape overlaps with a circle shape.

Parameters
edgeShapeThe 2D edge shape to be overlapped.
edgeTransformA 2D transform component pointer, with Position and Rotation info of the overlapped edge shape.
circleShapeThe 2D circle shape that will overlap.
circlePositionThe position at which the circle shape will overlap.
resultA CollisionResultInfo2D struct that contains the penetration, normal and computed contact points.
Returns
Return if the shapes are in overlap.

◆ CheckOverlap() [21/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D.EdgeShape  edgeShapeA,
Transform2D *  edgeTransformA,
Shape2D.EdgeShape  edgeShapeB,
Transform2D *  edgeTransformB,
out CollisionResultInfo2D  result 
)
inline

Checks if a edge shape overlaps with another edge shape.

Parameters
edgeShapeAThe 2D edge shape to be overlapped.
edgeTransformAA 2D transform component pointer, with Position and Rotation info of the overlapped edge shape.
edgeShapeBThe 2D edge shape that will overlap.
edgeTransformBA 2D transform component pointer, with Position and Rotation info of the edge shape that will overlap.
resultA CollisionResultInfo2D struct that contains the penetration, normal and computed contact points.
Returns
Return if the shapes are in overlap.

◆ CheckOverlap() [22/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D.CapsuleShape  capsuleShape,
Transform2D *  capsuleTransform,
Shape2D.PolygonShape  polygonShape,
Transform2D *  polygonTransform,
out CollisionResultInfo2D  result 
)
inline

Checks if a capsule shape overlaps with a polygon shape.

Parameters
capsuleShapeThe 2D capsule shape to be overlapped.
capsuleTransformA 2D transform component pointer, with Position and Rotation info of the overlapped capsule shape.
polygonShapeThe 2D polygon shape that will overlap.
polygonTransformA 2D transform component pointer, with Position and Rotation info of the polygon shape that will overlap.
resultA CollisionResultInfo2D struct that contains the penetration, normal and computed contact points.
Returns
Return if the shapes are in overlap.

◆ CheckOverlap() [23/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D.CircleShape  circleShape,
FPVector2  circlePosition,
Shape2D.PolygonShape  polygonShape,
Transform2D *  polygonTransform,
out CollisionResultInfo2D  result 
)
inline

Checks if a circle shape overlaps with a polygon shape.

Parameters
circleShapeThe 2D circle shape to be overlapped.
circlePositionThe position in which the circle shape is overlapped.
polygonShapeThe 2D polygon shape that will overlap.
polygonTransformA 2D transform component pointer, with Position and Rotation info of the polygon shape that will overlap.
resultA CollisionResultInfo2D struct that contains the penetration, normal and computed contact points.
Returns
Return if the shapes are in overlap.

◆ CheckOverlap() [24/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D.BoxShape  boxShape,
Transform2D *  boxTransform,
Shape2D.PolygonShape  polygonShape,
Transform2D *  polygonTransform,
out CollisionResultInfo2D  result 
)
inline

Checks if a box shape overlaps with a polygon shape.

Parameters
boxShapeThe 2D box shape to be overlapped.
boxTransformA 2D transform component pointer, with Position and Rotation info of the overlapped box shape.
polygonShapeThe 2D polygon shape that will overlap.
polygonTransformA 2D transform component pointer, with Position and Rotation info of the polygon shape that will overlap.
resultA CollisionResultInfo2D struct that contains the penetration, normal and computed contact points.
Returns
Return if the shapes are in overlap.

◆ CheckOverlap() [25/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D.EdgeShape  edgeShape,
Transform2D *  edgeTransform,
Shape2D.PolygonShape  polygonShape,
Transform2D *  polygonTransform,
out CollisionResultInfo2D  result 
)
inline

Checks if a edge shape overlaps with a polygon shape.

Parameters
edgeShapeThe 2D edge shape to be overlapped.
edgeTransformA 2D transform component pointer, with Position and Rotation info of the overlapped edge shape.
polygonShapeThe 2D polygon shape that will overlap.
polygonTransformA 2D transform component pointer, with Position and Rotation info of the polygon shape that will overlap.
resultA CollisionResultInfo2D struct that contains the penetration, normal and computed contact points.
Returns
Return if the shapes are in overlap.

◆ CheckOverlap() [26/26]

bool Quantum.Physics2D.PhysicsEngine2D.Api.CheckOverlap ( Shape2D.PolygonShape  polygonAssetA,
Transform2D *  transformA,
Shape2D.PolygonShape  polygonAssetB,
Transform2D *  transformB,
out CollisionResultInfo2D  result 
)
inline

Checks if a polygon shape overlaps with another polygon shape.

Parameters
polygonAssetAThe 2D polygon shape to be overlapped.
transformAA 2D transform component pointer, with Position and Rotation info of the overlapped polygon shape.
polygonAssetBThe 2D polygon shape that will overlap.
transformBA 2D transform component pointer, with Position and Rotation info of the polygon shape that will overlap.
resultA CollisionResultInfo2D struct that contains the penetration, normal and computed contact points.
Returns
Return if the shapes are in overlap.

◆ SetStaticColliderEnabled()

void Quantum.Physics2D.PhysicsEngine2D.Api.SetStaticColliderEnabled ( int  staticColliderIndex,
bool  enabled 
)
inline

Set a toggleable 2D static collider enabled state to enabled . Disabled static colliders are not considered for collisions or on query resolutions.

The static collider state is only changed on Verified frames.

Parameters
staticColliderIndexThe index of the collider in the Map StaticColliders2D array.
enabledIf the static should be enabled (true) or disabled (false).
Exceptions
InvalidOperationExceptionIf the static collider is baked as Immutable.
ArgumentOutOfRangeExceptionIf the provided staticColliderIndex is not in the range of static colliders loaded in the current Physics static scene.

◆ IsStaticColliderEnabled()

bool Quantum.Physics2D.PhysicsEngine2D.Api.IsStaticColliderEnabled ( int  staticColliderIndex)
inline

Returns the current state of a 2D static collider.

Parameters
staticColliderIndexThe index of the collider in the Map StaticColliders2D array.
Returns
false if the static is not Immutable and is currently disabled, true otherwise.
Exceptions
ArgumentOutOfRangeExceptionIf the provided staticColliderIndex is not in the range of static colliders loaded in the current Physics static scene.

Property Documentation

◆ Map

Map Quantum.Physics2D.PhysicsEngine2D.Api.Map
get

Retrieves the map asset currently used on the physics scene.

The map currently used by the physics scene is only updated during verified simulations, so this map can be different from the frame Map during predictions, when the latter is changed.