Photon Quantum 3.0.0

Classes | Enumerations | Functions
2D Physics API

Groups the 2D Physics classes. More...

Classes

class  Quantum.Physics2D.PhysicsEngine2D.Api
 2D Physics API More...
 
struct  Quantum.Shape2D.BoxShape
 Defines a 2D box in its local space. In order to create a Shape2D of type Shape2DType.Box, use Shape2D.CreateBox.

See also
Shape2D, Shape2DType
More...
 
struct  Quantum.Shape2D.CapsuleShape
 Defines a 2D capsule in its local space. In order to create a Shape2D of type Shape2DType.Capsule, use Shape2D.CreateCapsule.

See also
Shape2D, Shape2DType
More...
 
struct  Quantum.CharacterController2D
 A component for kinematic character controller prototyping that uses a circle as a shape. You can quickly add this to an entity and set a CharacterController2DConfig, then call the CharacterController2D.Move(FrameBase, EntityRef, FPVector2, IKCCCallbacks2D, int?, bool?, FP?) method in a system update. More...
 
struct  Quantum.CharacterController2DMovement
 Result of a 2D KCC raw movement query. More...
 
struct  Quantum.Shape2D.CircleShape
 Defines a 2D circle in its local space. In order to create a Shape2D of type Shape2DType.Circle, use Shape2D.CreateCircle.

See also
Shape2D, Shape2DType
More...
 
struct  Quantum.CollisionInfo2D
 Info about a collision between two 2D physics colliders. More...
 
struct  Quantum.Physics2D.CollisionResultInfo2D
 A structure for containing all the result information from the collision between two shapes. More...
 
struct  Quantum.CollisionInfo2D.ContactPointIterator2D
 A helper for safety interaction through the contact point buffer. More...
 
struct  Quantum.Shape2D.EdgeShape
 Defines a 2D edge in its local space. In order to create a Shape2D of type Shape2DType.Edge, use Shape2D.CreateEdge.

See also
Shape2D, Shape2DType
More...
 
struct  Quantum.ExitInfo2D
 Info about two entities that were colliding in the 2D Physics. More...
 
struct  Quantum.Physics2D.Hit
 Information returned from a valid hit of a physics query. More...
 
struct  Quantum.Physics2D.HitCollection
 Collection of hits returned from a physics query. More...
 
interface  Quantum.Core.ICollisionCallbacks2D
 Interface for receiving 2D collision callbacks More...
 
interface  Quantum.IKCCCallbacks2D
 The interface receives the interaction callbacks from the character controller system. More...
 
interface  Quantum.ISignalOnCollision2D
 Interface for receiving callbacks once per frame while two non-trigger 2D colliders are touching. More...
 
interface  Quantum.ISignalOnCollisionEnter2D
 Interface for receiving callbacks once two non-trigger 2D colliders start touching. More...
 
interface  Quantum.ISignalOnCollisionExit2D
 Interface for receiving callbacks once two non-trigger 2D colliders stop touching. More...
 
interface  Quantum.ISignalOnTrigger2D
 Interface for receiving callbacks once per frame while a non-trigger and a trigger 2D colliders are touching. More...
 
interface  Quantum.ISignalOnTriggerEnter2D
 Interface for receiving callbacks once a non-trigger and a trigger 2D colliders start touching. More...
 
interface  Quantum.ISignalOnTriggerExit2D
 Interface for receiving callbacks once a non-trigger and a trigger 2D colliders stop touching. More...
 
struct  Quantum.MapStaticCollider2D
 The data structure to hold 2D static colliders for a Quantum map. Static colliders are baked into the map and are used for efficient collision detection. More...
 
class  Quantum.MapStaticCollider2DPolygonData
 Stores 2D polygon collider data used on static collider MapStaticCollider2D. More...
 
struct  Quantum.PhysicsBody2D
 Adds physics motion to an entity with a PhysicsCollider2D driven by the built-in physics systems. You can customize how the movement of the physics body will works by changing the Mass, GravityScale or Drag. A Kinematic body will not have linear and angular velocities integrated, but those values are still perceived and taken into account when resolving the collision with other dynamic bodies. More...
 
struct  Quantum.PhysicsCallbacks2D
 A component that tracks the collisions (trigger and non-trigger) this entity is involved in. The tracked metadata is used to raise physics callbacks according to the callback Flags set. More...
 
struct  Quantum.PhysicsCollider2D
 A component with a shape used to represent 2D physics objects in the physics simulation. You can use flags and layers to setup how the object interacts with other colliders. More...
 
class  Quantum.PolygonCollider
 The asset that contains data of a convex polygon. More...
 
struct  Quantum.Shape2D.PolygonShape
 References a Polygin shape by the AssetRef<T> of its Quantum.PolygonCollider asset. More...
 
struct  Quantum.Shape2D
 Defines a 2D shape with Type and data disposed in a union-like structure. All shapes have a UserTag, BroadRadius and Centroid. All non-compound shapes have a LocalTransform and their Centroid always match their local transform position. More...
 
class  Quantum.Shape2DConfig
 The base settings for building a Shape2D. More...
 
struct  Quantum.Physics2D.PhysicsEngine2D.Api.ThreadSafeApi
 Struct to provide thread-safe access to the physics functions. More...
 
struct  Quantum.TriggerInfo2D
 Info about a collision between a trigger and a non-trigger 2D physics colliders. More...
 

Enumerations

enum  Quantum.PhysicsBody2D.ConfigFlags : byte
 The flags to set up how the physics body will behave in the physics systems. More...
 
enum  Quantum.Shape2DType : byte
 Defines the geometry used by the Shape2D. More...
 

Functions

PhysicsQueryRef Quantum.Physics2D.PhysicsEngine2D.Api.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 Quantum.Physics2D.PhysicsEngine2D.Api.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 Quantum.Physics2D.PhysicsEngine2D.Api.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 Quantum.Physics2D.PhysicsEngine2D.Api.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 Quantum.Physics2D.PhysicsEngine2D.Api.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 Quantum.Physics2D.PhysicsEngine2D.Api.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...
 
HitCollectionQuantum.Physics2D.PhysicsEngine2D.Api.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...
 
static PhysicsBody2D Quantum.PhysicsBody2D.CreateDynamic (FP mass, FP drag, FP angularDrag, Boolean allowSleeping, Boolean awakenByKinematics=false, Boolean freezeRotation=false, FPVector2? centerOfMass=null, NullableFP gravityScale=default)
 Creates a dynamic PhysicsBody2D. More...
 
static PhysicsBody2D Quantum.PhysicsBody2D.CreateKinematic ()
 Creates a kinematic PhysicsBody2D. The mass, drag and angular drag are not considered in kinematic interactions and have 0 as value. More...
 
void Quantum.Physics2D.PhysicsEngine2D.Api.FreePersistentHitCollection (HitCollection *collection)
 Free a persistent HitCollection previously allocated on the heap. To allocate a persistent collection of 2D hits, use AllocatePersistentHitCollection. More...
 
bool Quantum.Physics2D.PhysicsEngine2D.Api.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...
 
HitCollection Quantum.Physics2D.PhysicsEngine2D.Api.GetQueryHits (in PhysicsQueryRef queryRef)
 Gets the results of a broad-phase query added to the 2D physics scene. More...
 
void Quantum.PhysicsBody2D.InitBody (FP bodyMass, FP drag, FP angularDrag, ConfigFlags bodyConfig, FPVector2? centerOfMass=null, NullableFP gravityScale=default)
 Initializes a PhysicsBody2D component with custom settings. More...
 
bool Quantum.Physics2D.PhysicsEngine2D.Api.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...
 
HitQuantum.Physics2D.PhysicsEngine2D.Api.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 Quantum.Physics2D.PhysicsEngine2D.Api.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 Quantum.Physics2D.PhysicsEngine2D.Api.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 Quantum.Physics2D.PhysicsEngine2D.Api.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...
 
void Quantum.ISignalOnCollision2D.OnCollision2D (Frame f, CollisionInfo2D info)
 Called once per frame while two non-trigger 2D colliders are touching. More...
 
void Quantum.ISignalOnCollisionEnter2D.OnCollisionEnter2D (Frame f, CollisionInfo2D info)
 Called once two non-trigger 2D colliders start touching. More...
 
void Quantum.ISignalOnCollisionExit2D.OnCollisionExit2D (Frame f, ExitInfo2D info)
 Called once two non-trigger 2D colliders stop touching. More...
 
void Quantum.ISignalOnTrigger2D.OnTrigger2D (Frame f, TriggerInfo2D info)
 Called once per frame while a non-trigger and a trigger 2D colliders are touching. More...
 
void Quantum.ISignalOnTriggerEnter2D.OnTriggerEnter2D (Frame f, TriggerInfo2D info)
 Called once a non-trigger and a trigger 2D colliders start touching. More...
 
void Quantum.ISignalOnTriggerExit2D.OnTriggerExit2D (Frame f, ExitInfo2D info)
 Called once a non-trigger and a trigger 2D colliders stop touching. More...
 
HitCollection Quantum.Physics2D.PhysicsEngine2D.Api.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 Quantum.Physics2D.PhysicsEngine2D.Api.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 Quantum.Physics2D.PhysicsEngine2D.Api.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 Quantum.Physics2D.PhysicsEngine2D.Api.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 Quantum.Physics2D.PhysicsEngine2D.Api.OverlapShape (Transform2D transform, Shape2D shape, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Queries the 2D physics scene with a shape overlap. More...
 
HitCollection Quantum.Physics2D.PhysicsEngine2D.Api.OverlapShape (Transform2D transform, Transform2DVertical transformVertical, Shape2D shape, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Queries the 2D physics scene with a shape overlap. More...
 
HitQuantum.Physics2D.PhysicsEngine2D.Api.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 Quantum.Physics2D.PhysicsEngine2D.Api.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 Quantum.Physics2D.PhysicsEngine2D.Api.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 Quantum.Physics2D.PhysicsEngine2D.Api.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 Quantum.Physics2D.PhysicsEngine2D.Api.SetCallbacks (EntityRef entity, CallbackFlags flags)
 Sets which 2D physics collision callbacks will be called for the entity . More...
 
HitQuantum.Physics2D.PhysicsEngine2D.Api.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...
 
void Quantum.Physics2D.PhysicsEngine2D.Api.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 Quantum.Physics2D.PhysicsEngine2D.Api.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 Quantum.Physics2D.PhysicsEngine2D.Api.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 Quantum.Physics2D.PhysicsEngine2D.Api.TryGetQueryHits (in PhysicsQueryRef queryRef, out HitCollection queryHits)
 Tries to get the results of a broad-phase query added to the 2D physics scene. More...
 

Detailed Description

Groups the 2D Physics classes.

Enumeration Type Documentation

◆ ConfigFlags

The flags to set up how the physics body will behave in the physics systems.

Enumerator
Default 

IsAllowedToSleep | IsAwakenedByForces | ResetInertiaOnAdded | ResetCenterOfMassOnAdded

IsKinematic 

Prevents linear and angular velocities from being integrated.

FreezeRotation 

Prevents the physics update to apply changes to the rotation.

IsAllowedToSleep 

Allows the physics body to sleep after some time at rest.

IsAwakenedByForces 

Allows sleeping physic bodies to be awakened by dynamic interactions.

IsAwakenedByKinematics 

Allows sleeping physic bodies to be awakened by kinematic interaction.

ResetInertiaOnAdded 

Allows the physics body to compute the inertia automatically when it is added to an entity.

ResetCenterOfMassOnAdded 

Resets the CenterOfMass to the shape Shape2D.Centroid when the physics body is added to an entity.

UseContinuousCollisionDetection 

Prevents the physics body from passing through other objects when at high velocity.

◆ Shape2DType

enum Quantum.Shape2DType : byte
strong

Defines the geometry used by the Shape2D.

Enumerator
None 

Represents a shape of none of the supported types. This is the default shape type and will produce errors if used in a collider or query.

Circle 

2D circle shape

Polygon 

2D convex polygon shape

Box 

2D box shape

Edge 

2D edge shape

Compound 

2D shape compound of multiple other shapes

Capsule 

2D capsule shape

Function Documentation

◆ SetCallbacks()

void Quantum.Physics2D.PhysicsEngine2D.Api.SetCallbacks ( EntityRef  entity,
CallbackFlags  flags 
)
inline

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

For receiving the callbacks, set the CallbackFlags and implement the corresponding signal on a system.

Parameters
entityAn entity with a PhysicsCollider2D component attached.
flagsThe CallbackFlags of the desired collision callbacks.
frame.Physics2D.SetCallbacks(entity, CallbackFlags.OnDynamicCollision | CallbackFlags.OnStaticTriggerEnter);

◆ AllocatePersistentHitCollection()

HitCollection* Quantum.Physics2D.PhysicsEngine2D.Api.AllocatePersistentHitCollection ( int  defaultCapacity = 64)
inline

Allocates a persistent HitCollection on the heap with an initial capacity. To free an allocated persistent collection of 2D hits, use FreePersistentHitCollection.

Parameters
defaultCapacityThe initial Hit buffer capacity allocated for the hit collection.
Returns
A pointer to the allocated hit collection.

◆ FreePersistentHitCollection()

void Quantum.Physics2D.PhysicsEngine2D.Api.FreePersistentHitCollection ( HitCollection collection)
inline

Free a persistent HitCollection previously allocated on the heap. To allocate a persistent collection of 2D hits, use AllocatePersistentHitCollection.

Parameters
collectionA pointer to the persistent hit collection to be freed.
Exceptions
InvalidOperationExceptionThrown when the hit collection was not allocated as persistent.

◆ IsValidQueryRef()

bool Quantum.Physics2D.PhysicsEngine2D.Api.IsValidQueryRef ( in PhysicsQueryRef  queryRef)
inline

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.

Parameters
queryRefThe query ref to be checked.
Returns
true if the query ref is valid and query results can be retrieved from it this frame. false otherwise.

◆ GetQueryHits()

HitCollection Quantum.Physics2D.PhysicsEngine2D.Api.GetQueryHits ( in PhysicsQueryRef  queryRef)
inline

Gets the results of a broad-phase query added to the 2D physics scene.

Parameters
queryRefBroad-phase Query reference. Returned when adding a broad-phase query to the physics engine.
Returns
A HitCollection with the query hits.

◆ TryGetQueryHits()

bool Quantum.Physics2D.PhysicsEngine2D.Api.TryGetQueryHits ( in PhysicsQueryRef  queryRef,
out HitCollection  queryHits 
)
inline

Tries to get the results of a broad-phase query added to the 2D physics scene.

Parameters
queryRefBroad-phase Query reference. Returned when adding a broad-phase query to the physics engine.
queryHitsThe HitCollection with the query hits. Default if the index is not valid.
Returns
true if the index is valid, false otherwise.

◆ GetAllQueriesHits()

bool Quantum.Physics2D.PhysicsEngine2D.Api.GetAllQueriesHits ( out HitCollection queriesHits,
out int  queriesCount 
)
inline

Gets all the results for all the broad-phase queries added to the 2D physics scene this frame.

Parameters
queriesHitsA buffer of HitCollection with queriesCount elements, one for each broad-phase query added.
queriesCountThe number of elements in the queriesHits buffer, also matching the number on broad-phase queries added.
Returns
true if at least one broad-phase query has been added from a system that runs before the physics engine.

Example of how to iterate over added broad-phase queries results.

if (f.Physics2D.GetAllQueriesHits(out var queriesHits, out var queriesCount)) {
for (var i = 0; i < queriesCount; i++) {
var queryHits = queriesHits + i;
Log.Info($"Preemptive query {i} has {queryHits->Count} hits.");
}
}

◆ AddRaycastQuery()

PhysicsQueryRef Quantum.Physics2D.PhysicsEngine2D.Api.AddRaycastQuery ( FPVector2  origin,
FPVector2  direction,
FP  distance,
bool  firstHitOnly = false,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll,
FP  verticalPosition = default,
FP  verticalHeight = default 
)
inline

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.

Parameters
originThe ray origin point, in a 2D world space.
directionThe direction of the ray, not normalized internally.
distanceThe ray distance from the origin point on the specified direction.
firstHitOnlyIf the query results should return only the closest hit to the ray origin or all hits (default).
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
verticalPositionThe position of the query on the vertical axis, on a 2.5D context.
verticalHeightThe height of the query from the vertical position on the positive sense of the vertical axis.
Returns
The index of the injected query, to be used when retrieving the results with GetQueryHits.

If using vertical position and/or height, make sure "Use Vertical Transform" is set on the Simulation Config.

◆ AddLinecastQuery()

PhysicsQueryRef Quantum.Physics2D.PhysicsEngine2D.Api.AddLinecastQuery ( FPVector2  start,
FPVector2  end,
bool  firstHitOnly = false,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll,
FP  verticalPosition = default,
FP  verticalHeight = default 
)
inline

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.

Parameters
startThe line start point, in a 2D world space.
endThe line end point, in a 2D world space.
firstHitOnlyIf the query results should return only the closest hit to the line start or all hits (default).
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
verticalPositionThe position of the query on the vertical axis, on a 2.5D context.
verticalHeightThe height of the query from the vertical position on the positive sense of the vertical axis.
Returns
The index of the injected query, to be used when retrieving the results with GetQueryHits.

If using vertical position and/or height, make sure "Use Vertical Transform" is set on the Simulation Config.

◆ Raycast() [1/2]

Hit? Quantum.Physics2D.PhysicsEngine2D.Api.Raycast ( FPVector2  origin,
FPVector2  direction,
FP  distance,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll,
FP  verticalPosition = default,
FP  verticalHeight = default 
)
inline

Queries the 2D physics scene with a ray cast and returns the closest hit to the ray origin, if any.

Parameters
originThe ray origin point, in a 2D world space.
directionThe direction of the ray, not normalized internally.
distanceThe ray distance from the origin point on the specified direction.
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
verticalPositionThe position of the query on the vertical axis, on a 2.5D context.
verticalHeightThe height of the query from the vertical position on the positive sense of the vertical axis.
Returns
A nullable Hit with the closest hit to the ray origin, if any.

If using vertical position and/or height, make sure "Use Vertical Transform" is set on the Simulation Config.

◆ Raycast() [2/2]

void Quantum.Physics2D.PhysicsEngine2D.Api.Raycast ( HitCollection collection,
FPVector2  origin,
FPVector2  direction,
FP  distance,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll,
FP  verticalPosition = default,
FP  verticalHeight = default 
)
inline

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.

Parameters
collectionA previously allocated persistent HitCollection, to which the query hits will be added. For allocating a persistent HitCollection, see AllocatePersistentHitCollection.
originThe ray origin point, in a 2D world space.
directionThe direction of the ray, not normalized internally.
distanceThe ray distance from the origin point on the specified direction.
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
verticalPositionThe position of the query on the vertical axis, on a 2.5D context.
verticalHeightThe height of the query from the vertical position on the positive sense of the vertical axis.

If using vertical position and/or height, make sure "Use Vertical Transform" is set on the Simulation Config.

◆ Linecast() [1/2]

Hit? Quantum.Physics2D.PhysicsEngine2D.Api.Linecast ( FPVector2  start,
FPVector2  end,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll,
FP  verticalPosition = default,
FP  verticalHeight = default 
)
inline

Queries the 2D physics scene with a line cast and returns the closest hit to the line start, if any.

Parameters
startThe line start point, in a 2D world space.
endThe line end point, in a 2D world space.
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
verticalPositionThe position of the query on the vertical axis, on a 2.5D context.
verticalHeightThe height of the query from the vertical position on the positive sense of the vertical axis.
Returns
A nullable Hit with the closest hit to the line start, if any.

If using vertical position and/or height, make sure "Use Vertical Transform" is set on the Simulation Config.

◆ Linecast() [2/2]

void Quantum.Physics2D.PhysicsEngine2D.Api.Linecast ( HitCollection collection,
FPVector2  start,
FPVector2  end,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll,
FP  verticalPosition = default,
FP  verticalHeight = default 
)
inline

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.

Parameters
collectionA previously allocated persistent HitCollection, to which the query hits will be added. For allocating a persistent HitCollection, see AllocatePersistentHitCollection.
startThe line start point, in a 2D world space.
endThe line end point, in a 2D world space.
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
verticalPositionThe position of the query on the vertical axis, on a 2.5D context.
verticalHeightThe height of the query from the vertical position on the positive sense of the vertical axis.

If using vertical position and/or height, make sure "Use Vertical Transform" is set on the Simulation Config.

◆ RaycastAll() [1/2]

HitCollection Quantum.Physics2D.PhysicsEngine2D.Api.RaycastAll ( FPVector2  origin,
FPVector2  direction,
FP  distance,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll,
FP  verticalPosition = default,
FP  verticalHeight = default 
)
inline

Queries the 2D physics scene with a ray cast, returning all hits.

Parameters
originThe ray origin point, in a 2D world space.
directionThe direction of the ray, not normalized internally.
distanceThe ray distance from the origin point on the specified direction.
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
verticalPositionThe position of the query on the vertical axis, on a 2.5D context.
verticalHeightThe height of the query from the vertical position on the positive sense of the vertical axis.
Returns
A temporary HitCollection with the query hits, automatically freed when the current frame simulation ends.

If using vertical position and/or height, make sure "Use Vertical Transform" is set on the Simulation Config.

◆ RaycastAll() [2/2]

void Quantum.Physics2D.PhysicsEngine2D.Api.RaycastAll ( HitCollection collection,
FPVector2  origin,
FPVector2  direction,
FP  distance,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll,
FP  verticalPosition = default,
FP  verticalHeight = default 
)
inline

Queries the 2D physics scene with a ray cast, adding all hits to a persistent collection.

Parameters
collectionA previously allocated persistent HitCollection, to which the query hits will be added. For allocating a persistent HitCollection, see AllocatePersistentHitCollection.
originThe ray origin point, in a 2D world space.
directionThe direction of the ray, not normalized internally.
distanceThe ray distance from the origin point on the specified direction.
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
verticalPositionThe position of the query on the vertical axis, on a 2.5D context.
verticalHeightThe height of the query from the vertical position on the positive sense of the vertical axis.

If using vertical position and/or height, make sure "Use Vertical Transform" is set on the Simulation Config.

◆ LinecastAll() [1/2]

HitCollection Quantum.Physics2D.PhysicsEngine2D.Api.LinecastAll ( FPVector2  start,
FPVector2  end,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll,
FP  verticalPosition = default,
FP  verticalHeight = default 
)
inline

Queries the 2D physics scene with a line cast, returning all hits.

Parameters
startThe line start point, in a 2D world space.
endThe line end point, in a 2D world space.
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
verticalPositionThe position of the query on the vertical axis, on a 2.5D context.
verticalHeightThe height of the query from the vertical position on the positive sense of the vertical axis.
Returns
A temporary HitCollection with the query hits, automatically freed when the current frame simulation ends.

If using vertical position and/or height, make sure "Use Vertical Transform" is set on the Simulation Config.

◆ LinecastAll() [2/2]

void Quantum.Physics2D.PhysicsEngine2D.Api.LinecastAll ( HitCollection collection,
FPVector2  start,
FPVector2  end,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll,
FP  verticalPosition = default,
FP  verticalHeight = default 
)
inline

Queries the 2D physics scene with a line cast, adding all hits to a persistent collection.

Parameters
collectionA previously allocated persistent HitCollection, to which the query hits will be added. For allocating a persistent HitCollection, see AllocatePersistentHitCollection.
startThe line start point, in a 2D world space.
endThe line end point, in a 2D world space.
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
verticalPositionThe position of the query on the vertical axis, on a 2.5D context.
verticalHeightThe height of the query from the vertical position on the positive sense of the vertical axis.

If using vertical position and/or height, make sure "Use Vertical Transform" is set on the Simulation Config.

◆ AddShapeCastQuery()

PhysicsQueryRef Quantum.Physics2D.PhysicsEngine2D.Api.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 
)
inline

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.

Parameters
startThe cast start point, in a 2D world space.
rotationThe rotation of the shape, in radians.
shapeThe 2D shape to be casted.
translationThe cast direction and distance, from the cast start point.
firstHitOnlyIf the query results should return only the hit with the smallest Hit.CastDistanceNormalized or all hits (default).
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
verticalPositionThe position of the query on the vertical axis, on a 2.5D context.
verticalHeightThe height of the query from the vertical position on the positive sense of the vertical axis.
Returns
The index of the injected query, to be used when retrieving the results with GetQueryHits.

If using vertical position and/or height, make sure "Use Vertical Transform" is set on the Simulation Config.

◆ ShapeCast() [1/2]

Hit? Quantum.Physics2D.PhysicsEngine2D.Api.ShapeCast ( FPVector2  start,
FP  rotation,
Shape2D shape,
FPVector2  translation,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll,
FP  verticalPosition = default,
FP  verticalHeight = default 
)
inline

Queries the 2D physics scene with a shape cast and returns the hit with the shortest Hit.CastDistanceNormalized, if any.

Parameters
startThe cast start, in a 2D world space.
rotationThe rotation of the shape, in radians.
shapeThe 2D shape to be casted.
translationThe cast direction and distance, from the cast start point.
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
verticalPositionThe position of the query on the vertical axis, on a 2.5D context.
verticalHeightThe height of the query from the vertical position on the positive sense of the vertical axis.
Returns
A nullable Hit with the smallest Hit.CastDistanceNormalized, if any.

If using vertical position and/or height, make sure "Use Vertical Transform" is set on the Simulation Config.

◆ ShapeCast() [2/2]

void Quantum.Physics2D.PhysicsEngine2D.Api.ShapeCast ( HitCollection collection,
FPVector2  start,
FP  rotation,
Shape2D shape,
FPVector2  translation,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll,
FP  verticalPosition = default,
FP  verticalHeight = default 
)
inline

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.

Parameters
collectionA previously allocated persistent HitCollection, to which the query hits will be added. For allocating a persistent HitCollection, see AllocatePersistentHitCollection.
startThe cast start, in a 2D world space.
rotationThe rotation of the shape, in radians.
shapeThe 2D shape to be casted.
translationThe cast direction and distance, from the cast start point.
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
verticalPositionThe position of the query on the vertical axis, on a 2.5D context.
verticalHeightThe height of the query from the vertical position on the positive sense of the vertical axis.
Returns
A nullable Hit with the smallest Hit.CastDistanceNormalized, if any.

If using vertical position and/or height, make sure "Use Vertical Transform" is set on the Simulation Config.

◆ ShapeCastAll() [1/2]

HitCollection Quantum.Physics2D.PhysicsEngine2D.Api.ShapeCastAll ( FPVector2  start,
FP  rotation,
Shape2D shape,
FPVector2  translation,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll,
FP  verticalPosition = default,
FP  verticalHeight = default 
)
inline

Queries the 2D physics scene with a shape cast, returning all hits.

Parameters
startThe cast start, in a 2D world space.
rotationThe rotation of the shape, in radians.
shapeThe 2D shape to be casted.
translationThe cast direction and distance, from the cast start point.
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
verticalPositionThe position of the query on the vertical axis, on a 2.5D context.
verticalHeightThe height of the query from the vertical position on the positive sense of the vertical axis.
Returns
A temporary HitCollection with the query hits, automatically freed when the current frame simulation ends.

If using vertical position and/or height, make sure "Use Vertical Transform" is set on the Simulation Config.

◆ ShapeCastAll() [2/2]

void Quantum.Physics2D.PhysicsEngine2D.Api.ShapeCastAll ( HitCollection collection,
FPVector2  start,
FP  rotation,
Shape2D shape,
FPVector2  translation,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll,
FP  verticalPosition = default,
FP  verticalHeight = default 
)
inline

Queries the 2D physics scene with a shape cast, adding all hits to a persistent collection.

Parameters
collectionA previously allocated persistent HitCollection, to which the query hits will be added. For allocating a persistent HitCollection, see AllocatePersistentHitCollection.
startThe cast start, in a 2D world space.
rotationThe rotation of the shape, in radians.
shapeThe 2D shape to be casted.
translationThe cast direction and distance, from the cast start point.
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
verticalPositionThe position of the query on the vertical axis, on a 2.5D context.
verticalHeightThe height of the query from the vertical position on the positive sense of the vertical axis.
Returns
A temporary HitCollection with the query hits, automatically freed when the current frame simulation ends.

If using vertical position and/or height, make sure "Use Vertical Transform" is set on the Simulation Config.

◆ AddOverlapShapeQuery() [1/3]

PhysicsQueryRef Quantum.Physics2D.PhysicsEngine2D.Api.AddOverlapShapeQuery ( Transform2D  transform,
Transform2DVertical  transformVertical,
Shape2D  shape,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

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.

Parameters
transformA 2D transform component, with Position and Rotation info of the shape overlap.
transformVerticalA vertical transform component, with Vertical Position and Height info of the shape overlap on a 2.5D context.
shapeThe 2D shape to be overlapped.
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
Returns
The index of the injected query, to be used when retrieving the results with GetQueryHits.

When using a vertical transform, make sure "Use Vertical Transform" is set on the Simulation Config.

◆ AddOverlapShapeQuery() [2/3]

PhysicsQueryRef Quantum.Physics2D.PhysicsEngine2D.Api.AddOverlapShapeQuery ( Transform2D  transform,
Shape2D  shape,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

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.

Parameters
transformA 2D transform component, with Position and Rotation info of the shape overlap.
shapeThe 2D shape to be overlapped.
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
Returns
The index of the injected query, to be used when retrieving the results with GetQueryHits.

◆ AddOverlapShapeQuery() [3/3]

PhysicsQueryRef Quantum.Physics2D.PhysicsEngine2D.Api.AddOverlapShapeQuery ( FPVector2  position,
FP  rotation,
Shape2D  shape,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll,
FP  verticalPosition = default,
FP  verticalHeight = default 
)
inline

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.

Parameters
positionThe position in which the shape is overlapped.
rotationThe rotation of the shape, in radians.
shapeThe 2D shape to be overlapped.
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
verticalPositionThe position of the query on the vertical axis, on a 2.5D context.
verticalHeightThe height of the query from the vertical position on the positive sense of the vertical axis.
Returns
The index of the injected query, to be used when retrieving the results with GetQueryHits.

If using vertical position and/or height, make sure "Use Vertical Transform" is set on the Simulation Config.

◆ OverlapShape() [1/6]

void Quantum.Physics2D.PhysicsEngine2D.Api.OverlapShape ( HitCollection collection,
Transform2D  transform,
Transform2DVertical  transformVertical,
Shape2D  shape,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

Queries the 2D physics scene with a shape overlap.

Parameters
collectionA previously allocated persistent HitCollection, to which the query hits will be added. For allocating a persistent HitCollection, see AllocatePersistentHitCollection.
transformA 2D transform component, with Position and Rotation info of the shape overlap.
transformVerticalA vertical transform component, with Vertical Position and Height info of the shape overlap on a 2.5D context.
shapeThe 2D shape to be overlapped.
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
Exceptions
InvalidOperationExceptionThrown if the hit collection is not persistent.

When using vertical transform, make sure "Use Vertical Transform" is set on the Simulation Config.

◆ OverlapShape() [2/6]

void Quantum.Physics2D.PhysicsEngine2D.Api.OverlapShape ( HitCollection collection,
Transform2D  transform,
Shape2D  shape,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

Queries the 2D physics scene with a shape overlap.

Parameters
collectionA previously allocated persistent HitCollection, to which the query hits will be added. For allocating a persistent HitCollection, see AllocatePersistentHitCollection.
transformA 2D transform component, with Position and Rotation info of the shape overlap.
shapeThe 2D shape to be overlapped.
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
Exceptions
InvalidOperationExceptionThrown if the hit collection is not persistent.

◆ OverlapShape() [3/6]

void Quantum.Physics2D.PhysicsEngine2D.Api.OverlapShape ( HitCollection collection,
FPVector2  position,
FP  rotation,
Shape2D  shape,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll,
FP  verticalPosition = default,
FP  verticalHeight = default 
)
inline

Queries the 2D physics scene with a shape overlap.

Parameters
collectionA previously allocated persistent HitCollection, to which the query hits will be added. For allocating a persistent HitCollection, see AllocatePersistentHitCollection.
positionThe position in which the shape is overlapped.
rotationThe rotation of the shape, in radians.
shapeThe 2D shape to be overlapped.
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
verticalPositionThe position of the query on the vertical axis, on a 2.5D context.
verticalHeightThe height of the query from the vertical position on the positive sense of the vertical axis.
Exceptions
InvalidOperationExceptionThrown if the hit collection is not persistent.

If using vertical position and/or height, make sure "Use Vertical Transform" is set on the Simulation Config.

◆ OverlapShape() [4/6]

HitCollection Quantum.Physics2D.PhysicsEngine2D.Api.OverlapShape ( Transform2D  transform,
Transform2DVertical  transformVertical,
Shape2D  shape,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

Queries the 2D physics scene with a shape overlap.

Parameters
transformA 2D transform component, with Position and Rotation info of the shape overlap.
transformVerticalA vertical transform component, with Vertical Position and Height info of the shape overlap on a 2.5D context.
shapeThe 2D shape to be overlapped.
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
Returns
A temporary HitCollection with the query hits, automatically freed when the current frame simulation ends.

When using vertical transform, make sure "Use Vertical Transform" is set on the Simulation Config.

◆ OverlapShape() [5/6]

HitCollection Quantum.Physics2D.PhysicsEngine2D.Api.OverlapShape ( Transform2D  transform,
Shape2D  shape,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

Queries the 2D physics scene with a shape overlap.

Parameters
transformA 2D transform component, with Position and Rotation info of the shape overlap.
shapeThe 2D shape to be overlapped.
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
Returns
A temporary HitCollection with the query hits, automatically freed when the current frame simulation ends.

◆ OverlapShape() [6/6]

HitCollection Quantum.Physics2D.PhysicsEngine2D.Api.OverlapShape ( FPVector2  position,
FP  rotation,
Shape2D  shape,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll,
FP  verticalPosition = default,
FP  verticalHeight = default 
)
inline

Queries the 2D physics scene with a shape overlap.

Parameters
positionThe position in which the shape is overlapped.
rotationThe rotation of the shape, in radians.
shapeThe 2D shape to be overlapped.
layerMaskA mask that specifies which layers will be checked against. By default, all layers are considered. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property.
optionsThe QueryOptions used by the query. By default, all types of colliders are checked against and detailed info (hit point, penetration and normal) is not computed.
verticalPositionThe position of the query on the vertical axis, on a 2.5D context.
verticalHeightThe height of the query from the vertical position on the positive sense of the vertical axis.
Returns
A temporary HitCollection with the query hits, automatically freed when the current frame simulation ends.

If using vertical position and/or height, make sure "Use Vertical Transform" is set on the Simulation Config.

◆ CreateDynamic()

static PhysicsBody2D Quantum.PhysicsBody2D.CreateDynamic ( FP  mass,
FP  drag,
FP  angularDrag,
Boolean  allowSleeping,
Boolean  awakenByKinematics = false,
Boolean  freezeRotation = false,
FPVector2 centerOfMass = null,
NullableFP  gravityScale = default 
)
inlinestatic

Creates a dynamic PhysicsBody2D.

Parameters
massThe mass of the physics body.
dragThe drag of the physics body.
angularDragThe angular drag of the physics body.
allowSleepingAllows the physics body to sleep.
awakenByKinematicsAllows the physics body to be awaken by an interaction with kinematic bodies.
freezeRotationFreezes rotation of the physics body.
centerOfMassThe center of mass position relative to the transform's origin.
gravityScaleThe multiplier for the gravity force applied for this physics body.
Returns
A PhysicsBody2D component.

◆ CreateKinematic()

static PhysicsBody2D Quantum.PhysicsBody2D.CreateKinematic ( )
inlinestatic

Creates a kinematic PhysicsBody2D. The mass, drag and angular drag are not considered in kinematic interactions and have 0 as value.

Returns
A PhysicsBody2D component.

◆ InitBody()

void Quantum.PhysicsBody2D.InitBody ( FP  bodyMass,
FP  drag,
FP  angularDrag,
ConfigFlags  bodyConfig,
FPVector2 centerOfMass = null,
NullableFP  gravityScale = default 
)
inline

Initializes a PhysicsBody2D component with custom settings.

Parameters
bodyMassThe mass of the physics body.
dragThe drag of the physics body.
angularDragThe angular drag of the physics body.
bodyConfigThe ConfigFlags used in the physics body.
centerOfMassThe center of mass position relative to the transform's origin.
gravityScaleThe multiplier for the gravity force applied for this physics body.

◆ OnCollision2D()

void Quantum.ISignalOnCollision2D.OnCollision2D ( Frame  f,
CollisionInfo2D  info 
)

Called once per frame while two non-trigger 2D colliders are touching.

Parameters
fThe frame in which the collision happened.
infoThe CollisionInfo2D with data about the collision.

◆ OnCollisionEnter2D()

void Quantum.ISignalOnCollisionEnter2D.OnCollisionEnter2D ( Frame  f,
CollisionInfo2D  info 
)

Called once two non-trigger 2D colliders start touching.

Parameters
fThe frame in which the collision happened.
infoThe CollisionInfo2D with data about the collision.

◆ OnCollisionExit2D()

void Quantum.ISignalOnCollisionExit2D.OnCollisionExit2D ( Frame  f,
ExitInfo2D  info 
)

Called once two non-trigger 2D colliders stop touching.

Parameters
fThe frame in which the entities stopped touching.
infoThe ExitInfo2D with the entities that were touching.

◆ OnTrigger2D()

void Quantum.ISignalOnTrigger2D.OnTrigger2D ( Frame  f,
TriggerInfo2D  info 
)

Called once per frame while a non-trigger and a trigger 2D colliders are touching.

Parameters
fThe frame in which the collision happened.
infoThe TriggerInfo2D with data about the trigger collision.

◆ OnTriggerEnter2D()

void Quantum.ISignalOnTriggerEnter2D.OnTriggerEnter2D ( Frame  f,
TriggerInfo2D  info 
)

Called once a non-trigger and a trigger 2D colliders start touching.

Parameters
fThe frame in which the collision happened.
infoThe TriggerInfo2D with data about the trigger collision.

◆ OnTriggerExit2D()

void Quantum.ISignalOnTriggerExit2D.OnTriggerExit2D ( Frame  f,
ExitInfo2D  info 
)

Called once a non-trigger and a trigger 2D colliders stop touching.

Parameters
fThe frame in which the entities stopped touching.
infoThe ExitInfo2D with the entities that were touching.
Quantum.CallbackFlags
CallbackFlags
Represents which collision callbacks will be called for an entity.
Definition: PhysicsCommon.Enums.cs:13