Photon Quantum 3.0.0

Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
Quantum.Physics3D.Hit3D Struct Reference

Information returned from a valid hit of a physics query. More...

Public Member Functions

override int GetHashCode ()
 Overrides the hash code generation of this type. More...
 
Shape3DGetShape (FrameBase f)
 Gets the shape of the collider hit by the query. More...
 
ref MapStaticCollider3D GetStaticCollider (FrameBase f)
 Gets a reference to the static collider hit. Does not perform additional safety checks. More...
 
ref MapStaticCollider3D GetStaticCollider (FrameThreadSafe f)
 Gets the static collider hit by the query. More...
 
ref StaticColliderData GetStaticData (FrameBase f)
 Gets a reference to the data of the static collider hit (MapStaticCollider3D.StaticData). Does not perform additional safety checks. More...
 
ref StaticColliderData GetStaticData (FrameThreadSafe f)
 Gets the static collider data of the collision hit in the specified frame. More...
 
void SetHitEntity (EntityRef entity)
 Sets the entity that was hit. Automatically resets StaticColliderIndex to -1. More...
 
void SetHitStaticCollider (int staticColliderIndex, AssetRef< Map > mapRef)
 Sets the index of the static collider hit on the Map.StaticColliders3D array of the referenced map. More...
 
bool TryGetShape (FrameBase f, out Shape3D *shape)
 Tries to get the shape of the collider hit by the query. More...
 
bool TryGetStaticCollider (FrameBase f, out MapStaticCollider3D collider)
 Tries to access the static collider that was hit. More...
 
bool TryGetStaticCollider (FrameThreadSafe f, out MapStaticCollider3D collider)
 Tries to retrieve the static collider associated with the hit in the given frame. More...
 
bool TryGetStaticData (FrameBase f, out StaticColliderData data)
 Tries to access the data of the static collider that was hit (MapStaticCollider3D.StaticData). More...
 
bool TryGetStaticData (FrameThreadSafe f, out StaticColliderData data)
 Tries to retrieve the static collider data associated with the hit. More...
 

Static Public Member Functions

static void Serialize (void *ptr, FrameSerializer serializer)
 Serializes a Hit3D into a FrameSerializer. More...
 

Public Attributes

FP CastDistanceNormalized
 A normalized value (0 to 1) of the feature being casted when the hit occurs, relative to its full cast distance. More...
 
FPVector3 Normal
 The surface normal of the hit. More...
 
FP OverlapPenetration
 The penetration of a shape overlap query on the collider that was hit. More...
 
FPVector3 Point
 The point in world space where the collider is hit by the query. More...
 
ushort ShapeUserTag
 The Shape3D.UserTag field of the shape hit by the query. More...
 

Static Public Attributes

const int SIZE = FirstVector3 + FPVector3.SIZE * 2 + sizeof(Int64)
 The size of the struct in bytes. More...
 

Properties

EntityRefEntity [get]
 The reference of the entity hit by the query, EntityRef.None if hitting a static collider (IsDynamic false). More...
 
Boolean IsDynamic [get]
 If the collider hit by the query is not static, i.e. it belongs to an Entity. More...
 
Boolean IsStatic [get]
 If the collider hit was static. More...
 
Boolean? IsTrigger [get, set]
 If the collider hit by the query is Trigger. More...
 
int StaticColliderIndex [get]
 0-based index of the static collider on the Map.StaticColliders3D array of the map referenced by StaticColliderMapRef. If the hit IsDynamic, this value is -1. Tip: use TryGetStaticCollider(FrameBase, out MapStaticCollider3D), TryGetStaticData(FrameBase, out StaticColliderData), GetStaticCollider(FrameBase) or GetStaticData(FrameBase) in order to safely and conveniently access info about a static collider hit. More...
 
AssetRef< MapStaticColliderMapRef [get]
 The reference to the map used by the physics engine when a static collider is hit. Otherwise, this value is default (hit IsDynamic). More...
 
Int32 TriangleIndex [get, set]
 The index of the triangle touched by a query. More...
 

Detailed Description

Information returned from a valid hit of a physics query.

Member Function Documentation

◆ GetShape()

Shape3D* Quantum.Physics3D.Hit3D.GetShape ( FrameBase  f)
inline

Gets the shape of the collider hit by the query.

Parameters
fThe Frame.
Returns
The shape of the collider.

◆ TryGetShape()

bool Quantum.Physics3D.Hit3D.TryGetShape ( FrameBase  f,
out Shape3D shape 
)
inline

Tries to get the shape of the collider hit by the query.

Parameters
fThe frame.
shapeThe shape of the collider, if found.
Returns
True if the shape was retrieved successfully, false otherwise.

◆ SetHitEntity()

void Quantum.Physics3D.Hit3D.SetHitEntity ( EntityRef  entity)
inline

Sets the entity that was hit. Automatically resets StaticColliderIndex to -1.

Parameters
entityThe entity reference.

◆ SetHitStaticCollider()

void Quantum.Physics3D.Hit3D.SetHitStaticCollider ( int  staticColliderIndex,
AssetRef< Map mapRef 
)
inline

Sets the index of the static collider hit on the Map.StaticColliders3D array of the referenced map.

Parameters
staticColliderIndexA valid index of the static collider on the array of the map.
mapRefA reference to the map where the static collider hit is located.

◆ TryGetStaticCollider() [1/2]

bool Quantum.Physics3D.Hit3D.TryGetStaticCollider ( FrameBase  f,
out MapStaticCollider3D  collider 
)
inline

Tries to access the static collider that was hit.

Parameters
fCurrent frame.
colliderA copy of the static collider data found. Default if the metadata is not valid (returns false).
Returns
false if the collider hit is not static or the collide index or referenced map are not valid. true otherwise.

◆ TryGetStaticCollider() [2/2]

bool Quantum.Physics3D.Hit3D.TryGetStaticCollider ( FrameThreadSafe  f,
out MapStaticCollider3D  collider 
)
inline

Tries to retrieve the static collider associated with the hit in the given frame.

Parameters
fThe frame from which to retrieve the static collider.
colliderThe static collider associated with the hit, if found. Otherwise, it will be set to default.
Returns
True if the static collider is found and retrieved successfully; otherwise, false.

◆ TryGetStaticData() [1/2]

bool Quantum.Physics3D.Hit3D.TryGetStaticData ( FrameBase  f,
out StaticColliderData  data 
)
inline

Tries to access the data of the static collider that was hit (MapStaticCollider3D.StaticData).

Parameters
fCurrent frame.
dataA copy of the static collider data found. Default if the metadata is not valid (returns false).
Returns
false if the collider hit is not static or the collide index or referenced map are not valid. true otherwise.

◆ TryGetStaticData() [2/2]

bool Quantum.Physics3D.Hit3D.TryGetStaticData ( FrameThreadSafe  f,
out StaticColliderData  data 
)
inline

Tries to retrieve the static collider data associated with the hit.

Parameters
fThe FrameThreadSafe object.
dataWhen this method returns, contains the static collider data associated with the hit, if the hit is a static hit; otherwise, the value is default.
Returns
true if the hit is a static hit and the static collider data is retrieved successfully; otherwise, false.

◆ GetStaticCollider() [1/2]

ref MapStaticCollider3D Quantum.Physics3D.Hit3D.GetStaticCollider ( FrameBase  f)
inline

Gets a reference to the static collider hit. Does not perform additional safety checks.

Parameters
fCurrent frame.
Exceptions
NullReferenceExceptionIf the StaticColliderMapRef does not reference a valid asset.
IndexOutOfRangeExceptionIf the hit is not static (IsDynamic) or the collider index is not valid for the array of static colliders on the referenced map.
Returns
A reference to the static collider hit.

◆ GetStaticCollider() [2/2]

ref MapStaticCollider3D Quantum.Physics3D.Hit3D.GetStaticCollider ( FrameThreadSafe  f)
inline

Gets the static collider hit by the query.

Parameters
fThe FrameThreadSafe.
Returns
The static collider.

◆ GetStaticData() [1/2]

ref StaticColliderData Quantum.Physics3D.Hit3D.GetStaticData ( FrameBase  f)
inline

Gets a reference to the data of the static collider hit (MapStaticCollider3D.StaticData). Does not perform additional safety checks.

Parameters
fCurrent frame.
Exceptions
NullReferenceExceptionIf the StaticColliderMapRef does not reference a valid asset.
IndexOutOfRangeExceptionIf the hit is not static (IsDynamic) or the collider index is not valid for the array of static colliders on the referenced map.
Returns
A reference to the static collider hit.

◆ GetStaticData() [2/2]

ref StaticColliderData Quantum.Physics3D.Hit3D.GetStaticData ( FrameThreadSafe  f)
inline

Gets the static collider data of the collision hit in the specified frame.

Parameters
fThe frame containing the collision data.
Returns
The static collider data of the collision.

◆ Serialize()

static void Quantum.Physics3D.Hit3D.Serialize ( void *  ptr,
FrameSerializer  serializer 
)
inlinestatic

Serializes a Hit3D into a FrameSerializer.

Parameters
ptrThe pointer to the Hit3D.
serializerThe FrameSerializer instance into which the struct will be serialized.

◆ GetHashCode()

override int Quantum.Physics3D.Hit3D.GetHashCode ( )
inline

Overrides the hash code generation of this type.

Returns
A hash code of the current state of this instance.

Member Data Documentation

◆ SIZE

const int Quantum.Physics3D.Hit3D.SIZE = FirstVector3 + FPVector3.SIZE * 2 + sizeof(Int64)
static

The size of the struct in bytes.

◆ ShapeUserTag

ushort Quantum.Physics3D.Hit3D.ShapeUserTag

The Shape3D.UserTag field of the shape hit by the query.

◆ OverlapPenetration

FP Quantum.Physics3D.Hit3D.OverlapPenetration

The penetration of a shape overlap query on the collider that was hit.

This field is not computed unless QueryOptions.ComputeDetailedInfo is used in the query options and only applies to Shape Overlap queries. It overlaps in memory and is mutually exclusive with CastDistanceNormalized.

◆ CastDistanceNormalized

FP Quantum.Physics3D.Hit3D.CastDistanceNormalized

A normalized value (0 to 1) of the feature being casted when the hit occurs, relative to its full cast distance.

This field only applies to Ray, Line or Shape casts. It overlaps in memory and is mutually exclusive with OverlapPenetration.

◆ Point

FPVector3 Quantum.Physics3D.Hit3D.Point

The point in world space where the collider is hit by the query.

◆ Normal

FPVector3 Quantum.Physics3D.Hit3D.Normal

The surface normal of the hit.

This field is not computed unless QueryOptions.ComputeDetailedInfo is used in the query options.

Property Documentation

◆ IsDynamic

Boolean Quantum.Physics3D.Hit3D.IsDynamic
get

If the collider hit by the query is not static, i.e. it belongs to an Entity.

◆ IsStatic

Boolean Quantum.Physics3D.Hit3D.IsStatic
get

If the collider hit was static.

◆ StaticColliderIndex

int Quantum.Physics3D.Hit3D.StaticColliderIndex
get

0-based index of the static collider on the Map.StaticColliders3D array of the map referenced by StaticColliderMapRef. If the hit IsDynamic, this value is -1. Tip: use TryGetStaticCollider(FrameBase, out MapStaticCollider3D), TryGetStaticData(FrameBase, out StaticColliderData), GetStaticCollider(FrameBase) or GetStaticData(FrameBase) in order to safely and conveniently access info about a static collider hit.

◆ StaticColliderMapRef

AssetRef<Map> Quantum.Physics3D.Hit3D.StaticColliderMapRef
get

The reference to the map used by the physics engine when a static collider is hit. Otherwise, this value is default (hit IsDynamic).

◆ IsTrigger

Boolean? Quantum.Physics3D.Hit3D.IsTrigger
getset

If the collider hit by the query is Trigger.

◆ TriangleIndex

Int32 Quantum.Physics3D.Hit3D.TriangleIndex
getset

The index of the triangle touched by a query.

◆ Entity

EntityRef? Quantum.Physics3D.Hit3D.Entity
get

The reference of the entity hit by the query, EntityRef.None if hitting a static collider (IsDynamic false).