Photon Quantum 3.0.0

Classes | Enumerations | Functions
3D Physics API

Groups the 3D Physics classes. More...

Classes

class  Quantum.Physics3D.PhysicsEngine3D.Api
 3D Physics API More...
 
struct  Quantum.Shape3D.BoxShape
 Defines a 3D box shape in its local space. In order to create a Shape3D of type Shape3DType.Box, use Shape3D.CreateBox.

See also
Shape3D, Shape3DType
More...
 
struct  Quantum.Shape3D.CapsuleShape
 Defines a 3D capsule shape in its local space. In order to create a Shape3D of type Shape3DType.Capsule, use Shape3D.CreateCapsule.

See also
Shape3D, Shape3DType
More...
 
struct  Quantum.TriangleMesh.CellBounds
 The bounds of a cell. More...
 
struct  Quantum.CharacterController3D
 A component for kinematic character controller prototyping that uses a sphere as a shape. You can quickly add this to an entity and set a CharacterController3DConfig, then call the CharacterController3D.Move(FrameBase, EntityRef, FPVector3, IKCCCallbacks3D, int?, bool?, FP?) method in a system update. More...
 
struct  Quantum.CharacterController3DMovement
 Result of a 3D KCC raw movement query. More...
 
struct  Quantum.CollisionInfo3D
 Info about a collision between two 3D physics colliders. More...
 
class  Quantum.DynamicMap
 Used to dynamically edit and manage mesh colliders and their triangles at runtime. This is particularly useful in games with procedurally generated content or user-generated levels, where the environment can change dynamically. More...
 
struct  Quantum.EditMeshScope
 Scope for editing triangles of a mesh collider. More...
 
struct  Quantum.ExitInfo3D
 Info about two entities that were colliding in the 3D Physics. More...
 
struct  Quantum.Physics3D.Hit3D
 Information returned from a valid hit of a physics query. More...
 
struct  Quantum.Physics3D.HitCollection3D
 Collection of hit information returned from a physics query. More...
 
interface  Quantum.Core.ICollisionCallbacks3D
 Interface for receiving 3D collision callbacks More...
 
interface  Quantum.IKCCCallbacks3D
 The interface receives the interaction callbacks from the character controller system. More...
 
interface  Quantum.ISignalOnCollision3D
 Interface for receiving callbacks once per frame while two non-trigger 3D colliders are touching. More...
 
interface  Quantum.ISignalOnCollisionEnter3D
 Interface for receiving callbacks once two non-trigger 3D colliders start touching. More...
 
interface  Quantum.ISignalOnCollisionExit3D
 Interface for receiving callbacks once two non-trigger 3D colliders stop touching. More...
 
interface  Quantum.ISignalOnTrigger3D
 Interface for receiving callbacks once per frame while a non-trigger and a trigger 3D colliders are touching. More...
 
interface  Quantum.ISignalOnTriggerEnter3D
 Interface for receiving callbacks once a non-trigger and a trigger 3D colliders start touching. More...
 
interface  Quantum.ISignalOnTriggerExit3D
 Interface for receiving callbacks once a non-trigger and a trigger 3D colliders stop touching. More...
 
struct  Quantum.MapStaticCollider3D
 The data structure to hold 3D static colliders for a Quantum map. Static colliders are baked into the map and are used for efficient collision detection. More...
 
struct  Quantum.Shape3D.MeshShape
 References a static Mesh collider by its index. More...
 
struct  Quantum.MeshUnmanagedTrianglesRef
 A lightweight reference to a mesh in unmanaged memory. More...
 
struct  Quantum.PhysicsBody3D
 Adds physics motion to an entity with a PhysicsCollider3D 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.PhysicsCallbacks3D
 
struct  Quantum.PhysicsCollider3D
 A component with a shape used to represent 3D physics objects in the physics simulation. You can use flags and layers to setup how the object interacts with other colliders. More...
 
struct  Quantum.Shape3D
 Defines a 3D 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.Shape3DConfig
 The base settings for building a Shape3D. More...
 
struct  Quantum.Shape3D.SphereShape
 Defines a sphere shape in its local space. In order to create a Shape3D of type Shape3DType.Sphere, use Shape3D.CreateSphere.

See also
Shape3D, Shape3DType
More...
 
struct  Quantum.Shape3D.TerrainShape
 References a static Terrain shape by its Quantum.TerrainCollider asset. More...
 
struct  Quantum.Physics3D.PhysicsEngine3D.Api.ThreadSafeApi
 Struct to provide thread-safe access to the physics functions. More...
 
class  Quantum.TriangleMesh
 The data representation of all static triangles in the scene. More...
 
struct  Quantum.TriangleReference
 Represents a reference to a triangle in the triangle mesh. More...
 
struct  Quantum.TriggerInfo3D
 Info about a collision between a trigger and a non-trigger 3D physics colliders. More...
 

Enumerations

enum  Quantum.PhysicsBody3D.ConfigFlags : byte
 The flags to set up how the physics body will behave in the physics systems. More...
 
enum  Quantum.RotationFreezeFlags : byte
 The flags to set up the rotation axis that will be not changed by the physics body movement. More...
 
enum  Quantum.Shape3DType : byte
 Defines the geometry used by the Shape3D. More...
 

Functions

PhysicsQueryRef Quantum.Physics3D.PhysicsEngine3D.Api.AddLinecastQuery (FPVector3 start, FPVector3 end, bool firstHitOnly=false, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Adds a broad-phase line cast query to the 3D physics scene. In order to be resolved, must be added from a system that runs prior to the Physics System. More...
 
PhysicsQueryRef Quantum.Physics3D.PhysicsEngine3D.Api.AddOverlapShapeQuery (FPVector3 position, FPQuaternion rotation, Shape3D shape, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Adds a broad-phase shape overlap query to the 3D physics scene. In order to be resolved, must be added from a system that runs prior to the Physics System. More...
 
PhysicsQueryRef Quantum.Physics3D.PhysicsEngine3D.Api.AddOverlapShapeQuery (Transform3D transform, Shape3D shape, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Adds a broad-phase shape overlap query to the 3D physics scene. In order to be resolved, must be added from a system that runs prior to the Physics System. More...
 
PhysicsQueryRef Quantum.Physics3D.PhysicsEngine3D.Api.AddRaycastQuery (FPVector3 origin, FPVector3 direction, FP distance, bool firstHitOnly=false, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Adds a broad-phase ray cast query to the 3D physics scene. In order to be resolved, must be added from a system that runs prior to the Physics System. More...
 
PhysicsQueryRef Quantum.Physics3D.PhysicsEngine3D.Api.AddShapeCastQuery (FPVector3 start, FPQuaternion rotation, Shape3D *shape, FPVector3 translation, bool firstHitOnly=false, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Adds a broad-phase shape cast query to the 3D physics scene. In order to be resolved, must be added from a system that runs prior to the Physics System. More...
 
HitCollection3DQuantum.Physics3D.PhysicsEngine3D.Api.AllocatePersistentHitCollection3D (int defaultCapacity=64)
 Allocates a persistent HitCollection3D on the heap with an initial capacity. To free an allocated persistent collection of 3D hits, use FreePersistentHitCollection3D. More...
 
static PhysicsBody3D Quantum.PhysicsBody3D.CreateDynamic (FP mass, FP drag, FP angularDrag, Boolean allowSleeping, Boolean awakenByKinematics=false, RotationFreezeFlags flags=default, FPVector3? centerOfMass=null, NullableFP gravityScale=default)
 Creates a dynamic PhysicsBody3D. More...
 
void Quantum.Physics3D.PhysicsEngine3D.Api.FreePersistentHitCollection3D (HitCollection3D *collection)
 Free a persistent HitCollection3D previously allocated on the heap. To allocate a persistent collection of 3D hits, use AllocatePersistentHitCollection3D. More...
 
bool Quantum.Physics3D.PhysicsEngine3D.Api.GetAllQueriesHits (out HitCollection3D *queriesHits, out int queriesCount)
 Gets all the results for all the broad-phase queries added to the 3D physics scene this frame. More...
 
HitCollection3D Quantum.Physics3D.PhysicsEngine3D.Api.GetQueryHits (in PhysicsQueryRef queryRef)
 Gets the results of a broad-phase query added to the 3D physics scene. More...
 
void Quantum.PhysicsBody3D.InitBody (FP bodyMass, FP drag, FP angularDrag, ConfigFlags bodyConfig, RotationFreezeFlags rotationFlags, FPVector3? centerOfMass=null, NullableFP gravityScale=default)
 Initializes a PhysicsBody3D component with custom settings. More...
 
bool Quantum.Physics3D.PhysicsEngine3D.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...
 
Hit3DQuantum.Physics3D.PhysicsEngine3D.Api.Linecast (FPVector3 start, FPVector3 end, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Queries the 3D physics scene with a line cast and returns the closest hit to the line start, if any. More...
 
void Quantum.Physics3D.PhysicsEngine3D.Api.Linecast (HitCollection3D *collection, FPVector3 start, FPVector3 end, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Queries the 3D physics scene with a line cast and adds the closest hit to the line start, if any, to a persistent collection of hits. More...
 
HitCollection3D Quantum.Physics3D.PhysicsEngine3D.Api.LinecastAll (FPVector3 start, FPVector3 end, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Queries the 3D physics scene with a line cast, returning all hits. More...
 
void Quantum.Physics3D.PhysicsEngine3D.Api.LinecastAll (HitCollection3D *collection, FPVector3 start, FPVector3 end, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Queries the 3D physics scene with a line cast, returning all hits. More...
 
void Quantum.ISignalOnCollision3D.OnCollision3D (Frame f, CollisionInfo3D info)
 Called once per frame while two non-trigger 3D colliders are touching. More...
 
void Quantum.ISignalOnCollisionEnter3D.OnCollisionEnter3D (Frame f, CollisionInfo3D info)
 Called once two non-trigger 3D colliders start touching. More...
 
void Quantum.ISignalOnCollisionExit3D.OnCollisionExit3D (Frame f, ExitInfo3D info)
 Called once two non-trigger 3D colliders stop touching. More...
 
void Quantum.ISignalOnTrigger3D.OnTrigger3D (Frame f, TriggerInfo3D info)
 Called once per frame while a non-trigger and a trigger 3D colliders are touching. More...
 
void Quantum.ISignalOnTriggerEnter3D.OnTriggerEnter3D (Frame f, TriggerInfo3D info)
 Called once a non-trigger and a trigger 3D colliders start touching. More...
 
void Quantum.ISignalOnTriggerExit3D.OnTriggerExit3D (Frame f, ExitInfo3D info)
 Called once a non-trigger and a trigger 3D colliders stop touching. More...
 
HitCollection3D Quantum.Physics3D.PhysicsEngine3D.Api.OverlapShape (FPVector3 position, FPQuaternion rotation, Shape3D shape, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Queries the 3D physics scene with a shape overlap. More...
 
void Quantum.Physics3D.PhysicsEngine3D.Api.OverlapShape (HitCollection3D *collection, FPVector3 position, FPQuaternion rotation, Shape3D shape, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Queries the 3D physics scene with a shape overlap. More...
 
void Quantum.Physics3D.PhysicsEngine3D.Api.OverlapShape (HitCollection3D *collection, Transform3D transform, Shape3D shape, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Queries the 3D physics scene with a shape overlap. More...
 
HitCollection3D Quantum.Physics3D.PhysicsEngine3D.Api.OverlapShape (Transform3D transform, Shape3D shape, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Queries the 3D physics scene with a shape overlap. More...
 
Hit3DQuantum.Physics3D.PhysicsEngine3D.Api.Raycast (FPVector3 origin, FPVector3 direction, FP distance, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Queries the 3D physics scene with a ray cast and returns the closest hit to the ray origin, if any. More...
 
void Quantum.Physics3D.PhysicsEngine3D.Api.Raycast (HitCollection3D *collection, FPVector3 origin, FPVector3 direction, FP distance, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Queries the 3D physics scene with a ray cast and adds the closest hit to the ray origin, if any, to a persistent collection of hits. More...
 
HitCollection3D Quantum.Physics3D.PhysicsEngine3D.Api.RaycastAll (FPVector3 origin, FPVector3 direction, FP distance, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Queries the 3D physics scene with a ray cast, returning all hits. More...
 
void Quantum.Physics3D.PhysicsEngine3D.Api.RaycastAll (HitCollection3D *collection, FPVector3 origin, FPVector3 direction, FP distance, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Queries the 3D physics scene with a ray cast, adding all hits to a persistent collection. More...
 
void Quantum.Physics3D.PhysicsEngine3D.Api.SetCallbacks (EntityRef entity, CallbackFlags flags)
 Sets which 3D physics collision callbacks will be called for the entity . More...
 
Hit3DQuantum.Physics3D.PhysicsEngine3D.Api.ShapeCast (FPVector3 start, FPQuaternion rotation, Shape3D *shape, FPVector3 translation, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Queries the 3D physics scene with a shape cast and returns the hit with the smallest Hit3D.CastDistanceNormalized, if any. More...
 
void Quantum.Physics3D.PhysicsEngine3D.Api.ShapeCast (HitCollection3D *collection, FPVector3 start, FPQuaternion rotation, Shape3D *shape, FPVector3 translation, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Queries the 3D physics scene with a shape cast and adds the hit with the shortest Hit3D.CastDistanceNormalized, if any, to a persistent collection of hits. More...
 
HitCollection3D Quantum.Physics3D.PhysicsEngine3D.Api.ShapeCastAll (FPVector3 start, FPQuaternion rotation, Shape3D *shape, FPVector3 translation, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Queries the 3D physics scene with a shape cast, returning all hits. More...
 
void Quantum.Physics3D.PhysicsEngine3D.Api.ShapeCastAll (HitCollection3D *collection, FPVector3 start, FPQuaternion rotation, Shape3D *shape, FPVector3 translation, int layerMask=-1, QueryOptions options=QueryOptions.HitAll)
 Queries the 3D physics scene with a shape cast, adding all hits to a persistent collection. More...
 
bool Quantum.Physics3D.PhysicsEngine3D.Api.TryGetQueryHits (in PhysicsQueryRef queryRef, out HitCollection3D queryHits)
 Tries to get the results of a broad-phase query added to the 3D physics scene. More...
 

Detailed Description

Groups the 3D Physics classes.

Enumeration Type Documentation

◆ RotationFreezeFlags

enum Quantum.RotationFreezeFlags : byte
strong

The flags to set up the rotation axis that will be not changed by the physics body movement.

Enumerator
None 

Default. No axis is frozen.

FreezeX 

Freezes the rotation on the X axis.

FreezeY 

Freezes the rotation on the Y axis.

FreezeZ 

Freezes the rotation on the Z axis.

FreezeAll 

Freezes the rotation on all axes.

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

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 Shape3D.Centroid when the physics body is added to an entity.

UseContinuousCollisionDetection 

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

◆ Shape3DType

enum Quantum.Shape3DType : byte
strong

Defines the geometry used by the Shape3D.

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.

Sphere 

3D sphere shape

Box 

3D box shape

Mesh 

3D mesh shape, convex or concave

Terrain 

3D terrain shape

Compound 

3D shape compound of multiple other shapes

Capsule 

3D capsule shape

Function Documentation

◆ SetCallbacks()

void Quantum.Physics3D.PhysicsEngine3D.Api.SetCallbacks ( EntityRef  entity,
CallbackFlags  flags 
)
inline

Sets which 3D physics collision callbacks will be called for the entity .

The entity must have a PhysicsCollider3D 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 PhysicsCollider3D component attached.
flagsThe CallbackFlags of the desired collision callbacks.
frame.Physics3D.SetCallbacks(entity, CallbackFlags.OnDynamicCollision | CallbackFlags.OnStaticTriggerEnter);

◆ AllocatePersistentHitCollection3D()

HitCollection3D* Quantum.Physics3D.PhysicsEngine3D.Api.AllocatePersistentHitCollection3D ( int  defaultCapacity = 64)
inline

Allocates a persistent HitCollection3D on the heap with an initial capacity. To free an allocated persistent collection of 3D hits, use FreePersistentHitCollection3D.

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

◆ FreePersistentHitCollection3D()

void Quantum.Physics3D.PhysicsEngine3D.Api.FreePersistentHitCollection3D ( HitCollection3D collection)
inline

Free a persistent HitCollection3D previously allocated on the heap. To allocate a persistent collection of 3D hits, use AllocatePersistentHitCollection3D.

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.Physics3D.PhysicsEngine3D.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()

HitCollection3D Quantum.Physics3D.PhysicsEngine3D.Api.GetQueryHits ( in PhysicsQueryRef  queryRef)
inline

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

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

◆ TryGetQueryHits()

bool Quantum.Physics3D.PhysicsEngine3D.Api.TryGetQueryHits ( in PhysicsQueryRef  queryRef,
out HitCollection3D  queryHits 
)
inline

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

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

◆ GetAllQueriesHits()

bool Quantum.Physics3D.PhysicsEngine3D.Api.GetAllQueriesHits ( out HitCollection3D queriesHits,
out int  queriesCount 
)
inline

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

Parameters
queriesHitsA buffer of HitCollection3D 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.Physics3D.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.Physics3D.PhysicsEngine3D.Api.AddRaycastQuery ( FPVector3  origin,
FPVector3  direction,
FP  distance,
bool  firstHitOnly = false,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

Adds a broad-phase ray cast query to the 3D 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 3D 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.
Returns
The index of the injected query, to be used when retrieving the results with GetQueryHits.

◆ AddLinecastQuery()

PhysicsQueryRef Quantum.Physics3D.PhysicsEngine3D.Api.AddLinecastQuery ( FPVector3  start,
FPVector3  end,
bool  firstHitOnly = false,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

Adds a broad-phase line cast query to the 3D 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 3D world space.
endThe line end point, in a 3D 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.
Returns
The index of the injected query, to be used when retrieving the results with GetQueryHits.

◆ Raycast() [1/2]

Hit3D? Quantum.Physics3D.PhysicsEngine3D.Api.Raycast ( FPVector3  origin,
FPVector3  direction,
FP  distance,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

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

Parameters
originThe ray origin point, in a 3D 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.
Returns
A nullable Hit3D with the closest hit to the ray origin, if any.

◆ Raycast() [2/2]

void Quantum.Physics3D.PhysicsEngine3D.Api.Raycast ( HitCollection3D collection,
FPVector3  origin,
FPVector3  direction,
FP  distance,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

Queries the 3D 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 HitCollection3D, to which the query hits will be added. For allocating a persistent HitCollection, see AllocatePersistentHitCollection3D.
originThe ray origin point, in a 3D 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.

◆ Linecast() [1/2]

Hit3D? Quantum.Physics3D.PhysicsEngine3D.Api.Linecast ( FPVector3  start,
FPVector3  end,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

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

Parameters
startThe line start point, in a 3D world space.
endThe line end point, in a 3D 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.
Returns
A nullable Hit3D with the closest hit to the line start, if any.

◆ Linecast() [2/2]

void Quantum.Physics3D.PhysicsEngine3D.Api.Linecast ( HitCollection3D collection,
FPVector3  start,
FPVector3  end,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

Queries the 3D 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 HitCollection3D, to which the query hits will be added. For allocating a persistent HitCollection, see AllocatePersistentHitCollection3D.
startThe line start point, in a 3D world space.
endThe line end point, in a 3D 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.

◆ RaycastAll() [1/2]

HitCollection3D Quantum.Physics3D.PhysicsEngine3D.Api.RaycastAll ( FPVector3  origin,
FPVector3  direction,
FP  distance,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

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

Parameters
originThe ray origin point, in a 3D 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.
Returns
A temporary HitCollection3D with the query hits, automatically freed when the current frame simulation ends.

◆ RaycastAll() [2/2]

void Quantum.Physics3D.PhysicsEngine3D.Api.RaycastAll ( HitCollection3D collection,
FPVector3  origin,
FPVector3  direction,
FP  distance,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

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

Parameters
collectionA previously allocated persistent HitCollection3D, to which the query hits will be added. For allocating a persistent HitCollection, see AllocatePersistentHitCollection3D.
originThe ray origin point, in a 3D 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.

◆ LinecastAll() [1/2]

HitCollection3D Quantum.Physics3D.PhysicsEngine3D.Api.LinecastAll ( FPVector3  start,
FPVector3  end,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

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

Parameters
startThe line start point, in a 3D world space.
endThe line end point, in a 3D 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.
Returns
A temporary HitCollection3D with the query hits, automatically freed when the current frame simulation ends.

◆ LinecastAll() [2/2]

void Quantum.Physics3D.PhysicsEngine3D.Api.LinecastAll ( HitCollection3D collection,
FPVector3  start,
FPVector3  end,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

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

Parameters
collectionA previously allocated persistent HitCollection3D, to which the query hits will be added. For allocating a persistent HitCollection, see AllocatePersistentHitCollection3D.
startThe line start point, in a 3D world space.
endThe line end point, in a 3D 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.

◆ AddShapeCastQuery()

PhysicsQueryRef Quantum.Physics3D.PhysicsEngine3D.Api.AddShapeCastQuery ( FPVector3  start,
FPQuaternion  rotation,
Shape3D shape,
FPVector3  translation,
bool  firstHitOnly = false,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

Adds a broad-phase shape cast query to the 3D 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 3D world space.
rotationThe quaternion rotation of the shape.
shapeThe 3D 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 Hit3D.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.
Returns
The index of the injected query, to be used when retrieving the results with GetQueryHits.

◆ ShapeCast() [1/2]

Hit3D? Quantum.Physics3D.PhysicsEngine3D.Api.ShapeCast ( FPVector3  start,
FPQuaternion  rotation,
Shape3D shape,
FPVector3  translation,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

Queries the 3D physics scene with a shape cast and returns the hit with the smallest Hit3D.CastDistanceNormalized, if any.

Parameters
startThe cast start, in a 3D world space.
rotationThe quaternion rotation of the shape.
shapeThe 3D 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.
Returns
A nullable Hit3D with the smallest Hit3D.CastDistanceNormalized, if any.

◆ ShapeCast() [2/2]

void Quantum.Physics3D.PhysicsEngine3D.Api.ShapeCast ( HitCollection3D collection,
FPVector3  start,
FPQuaternion  rotation,
Shape3D shape,
FPVector3  translation,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

Queries the 3D physics scene with a shape cast and adds the hit with the shortest Hit3D.CastDistanceNormalized, if any, to a persistent collection of hits.

Parameters
collectionA previously allocated persistent HitCollection3D, to which the query hits will be added. For allocating a persistent HitCollection, see AllocatePersistentHitCollection3D.
startThe cast start, in a 3D world space.
rotationThe quaternion rotation of the shape.
shapeThe 3D 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.

◆ ShapeCastAll() [1/2]

HitCollection3D Quantum.Physics3D.PhysicsEngine3D.Api.ShapeCastAll ( FPVector3  start,
FPQuaternion  rotation,
Shape3D shape,
FPVector3  translation,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

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

Parameters
startThe cast start, in a 3D world space.
rotationThe quaternion rotation of the shape.
shapeThe 3D 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.
Returns
A temporary HitCollection3D with the query hits, automatically freed when the current frame simulation ends.

◆ ShapeCastAll() [2/2]

void Quantum.Physics3D.PhysicsEngine3D.Api.ShapeCastAll ( HitCollection3D collection,
FPVector3  start,
FPQuaternion  rotation,
Shape3D shape,
FPVector3  translation,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

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

Parameters
collectionA previously allocated persistent HitCollection3D, to which the query hits will be added. For allocating a persistent HitCollection, see AllocatePersistentHitCollection3D.
startThe cast start, in a 3D world space.
rotationThe quaternion rotation of the shape.
shapeThe 3D 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.

◆ AddOverlapShapeQuery() [1/2]

PhysicsQueryRef Quantum.Physics3D.PhysicsEngine3D.Api.AddOverlapShapeQuery ( Transform3D  transform,
Shape3D  shape,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

Adds a broad-phase shape overlap query to the 3D physics scene. In order to be resolved, must be added from a system that runs prior to the Physics System.

Parameters
transformA 3D transform component, with Position and Rotation info of the shape overlap.
shapeThe 3D 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() [2/2]

PhysicsQueryRef Quantum.Physics3D.PhysicsEngine3D.Api.AddOverlapShapeQuery ( FPVector3  position,
FPQuaternion  rotation,
Shape3D  shape,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

Adds a broad-phase shape overlap query to the 3D 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 quaternion rotation of the shape.
shapeThe 3D 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.

◆ OverlapShape() [1/4]

void Quantum.Physics3D.PhysicsEngine3D.Api.OverlapShape ( HitCollection3D collection,
Transform3D  transform,
Shape3D  shape,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

Queries the 3D physics scene with a shape overlap.

Parameters
collectionA previously allocated persistent HitCollection3D, to which the query hits will be added. For allocating a persistent HitCollection, see AllocatePersistentHitCollection3D.
transformA 3D transform component, with Position and Rotation info of the shape overlap.
shapeThe 3D 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() [2/4]

void Quantum.Physics3D.PhysicsEngine3D.Api.OverlapShape ( HitCollection3D collection,
FPVector3  position,
FPQuaternion  rotation,
Shape3D  shape,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

Queries the 3D physics scene with a shape overlap.

Parameters
collectionA previously allocated persistent HitCollection3D, to which the query hits will be added. For allocating a persistent HitCollection, see AllocatePersistentHitCollection3D.
positionThe position in which the shape is overlapped.
rotationThe quaternion rotation of the shape.
shapeThe 3D 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/4]

HitCollection3D Quantum.Physics3D.PhysicsEngine3D.Api.OverlapShape ( Transform3D  transform,
Shape3D  shape,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

Queries the 3D physics scene with a shape overlap.

Parameters
transformA 3D transform component, with Position and Rotation info of the shape overlap.
shapeThe 3D 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 HitCollection3D with the query hits, automatically freed when the current frame simulation ends.

◆ OverlapShape() [4/4]

HitCollection3D Quantum.Physics3D.PhysicsEngine3D.Api.OverlapShape ( FPVector3  position,
FPQuaternion  rotation,
Shape3D  shape,
int  layerMask = -1,
QueryOptions  options = QueryOptions.HitAll 
)
inline

Queries the 3D physics scene with a shape overlap.

Parameters
positionThe 3D position in which the shape is overlapped.
rotationThe quaternion rotation of the shape.
shapeThe 3D 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 HitCollection3D with the query hits, automatically freed when the current frame simulation ends.

◆ CreateDynamic()

static PhysicsBody3D Quantum.PhysicsBody3D.CreateDynamic ( FP  mass,
FP  drag,
FP  angularDrag,
Boolean  allowSleeping,
Boolean  awakenByKinematics = false,
RotationFreezeFlags  flags = default,
FPVector3 centerOfMass = null,
NullableFP  gravityScale = default 
)
inlinestatic

Creates a dynamic PhysicsBody3D.

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.
flagsThe rotation freeze flags.
centerOfMassThe center of mass position relative to the transform's origin.
gravityScaleThe multiplier for the gravity force applied for this physics body.
Returns
A PhysicsBody3D component.

◆ InitBody()

void Quantum.PhysicsBody3D.InitBody ( FP  bodyMass,
FP  drag,
FP  angularDrag,
ConfigFlags  bodyConfig,
RotationFreezeFlags  rotationFlags,
FPVector3 centerOfMass = null,
NullableFP  gravityScale = default 
)
inline

Initializes a PhysicsBody3D 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.
rotationFlagsThe RotationFreezeFlags 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.

◆ OnCollision3D()

void Quantum.ISignalOnCollision3D.OnCollision3D ( Frame  f,
CollisionInfo3D  info 
)

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

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

◆ OnCollisionEnter3D()

void Quantum.ISignalOnCollisionEnter3D.OnCollisionEnter3D ( Frame  f,
CollisionInfo3D  info 
)

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

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

◆ OnCollisionExit3D()

void Quantum.ISignalOnCollisionExit3D.OnCollisionExit3D ( Frame  f,
ExitInfo3D  info 
)

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

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

◆ OnTrigger3D()

void Quantum.ISignalOnTrigger3D.OnTrigger3D ( Frame  f,
TriggerInfo3D  info 
)

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

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

◆ OnTriggerEnter3D()

void Quantum.ISignalOnTriggerEnter3D.OnTriggerEnter3D ( Frame  f,
TriggerInfo3D  info 
)

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

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

◆ OnTriggerExit3D()

void Quantum.ISignalOnTriggerExit3D.OnTriggerExit3D ( Frame  f,
ExitInfo3D  info 
)

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

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