Photon Quantum 2.1.1

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

2D Physics API More...

Public Member Functions

int 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...
 
int 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...
 
int 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...
 
int 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...
 
int 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...
 
int 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...
 
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...
 
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 (int index)
 Gets the results of a broad-phase query added to the 2D physics scene. More...
 
bool IsStaticColliderEnabled (int staticColliderIndex)
 Returns the current state of a 2D static collider. More...
 
HitLinecast (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)
 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)
 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)
 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)
 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)
 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...
 
HitRaycast (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)
 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)
 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 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...
 
HitShapeCast (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...
 
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)
 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...
 
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)
 Queries the 2D physics scene with a shape cast, adding all hits to a persistent collection. More...
 
bool TryGetQueryHits (int index, out HitCollection queryHits)
 Tries to get the results of a broad-phase query added to the 2D physics scene. More...
 

Properties

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

Detailed Description

2D Physics API

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.

◆ 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.