Information returned from a valid hit of a physics query. More...
Public Member Functions | |
ref MapStaticCollider2D | GetStaticCollider (FrameBase f) |
Gets a reference to the static collider hit. Does not perform additional safety checks. More... | |
ref StaticColliderData | GetStaticData (FrameBase f) |
Gets a reference to the data of the static collider hit (MapStaticCollider2D.StaticData). Does not perform additional safety checks. More... | |
void | SetHitEntity (EntityRef entity) |
Sets the entity that was hit. Automatically resets StaticColliderIndex to -1. More... | |
void | SetHitStaticCollider (int staticColliderIndex, AssetRefMap mapRef) |
Sets the index of the static collider hit on the Map.StaticColliders2D array of the referenced map. More... | |
bool | TryGetStaticCollider (FrameBase f, out MapStaticCollider2D collider) |
Tries to access the static collider that was hit. More... | |
bool | TryGetStaticData (FrameBase f, out StaticColliderData data) |
Tries to access the data of the static collider that was hit (MapStaticCollider2D.StaticData). 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... | |
FPVector2 | Normal |
The surface normal of the hit. More... | |
FP | OverlapPenetration |
The penetration of a shape overlap query on the collider that was hit. More... | |
FPVector2 | Point |
The point in world space where the collider is hit by the query. More... | |
ushort | ShapeUserTag |
The Shape2D.UserTag field of the shape hit by the query. More... | |
Properties | |
EntityRef? | Entity [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? | 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.StaticColliders2D array of the map referenced by StaticColliderMapRef. If the hit IsDynamic, this value is -1. Tip: use TryGetStaticCollider(FrameBase, out MapStaticCollider2D), TryGetStaticData(FrameBase, out StaticColliderData), GetStaticCollider(FrameBase) or GetStaticData(FrameBase) in order to safely and conveniently access info about a static collider hit. More... | |
AssetRefMap | 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). More... | |
Information returned from a valid hit of a physics query.
|
inline |
Sets the entity that was hit. Automatically resets StaticColliderIndex to -1.
entity | The entity reference. |
|
inline |
Sets the index of the static collider hit on the Map.StaticColliders2D array of the referenced map.
staticColliderIndex | A valid index of the static collider on the array of the map. |
mapRef | A reference to the map where the static collider hit is located. |
|
inline |
Tries to access the static collider that was hit.
f | Current frame. |
collider | A copy of the static collider data found. Default if the metadata is not valid (returns false). |
|
inline |
Tries to access the data of the static collider that was hit (MapStaticCollider2D.StaticData).
f | Current frame. |
data | A copy of the static collider data found. Default if the metadata is not valid (returns false). |
|
inline |
Gets a reference to the static collider hit. Does not perform additional safety checks.
f | Current frame. |
NullReferenceException | If the StaticColliderMapRef does not reference a valid asset. |
IndexOutOfRangeException | If the hit is not static (IsDynamic) or the collider index is not valid for the array of static colliders on the referenced map. |
|
inline |
Gets a reference to the data of the static collider hit (MapStaticCollider2D.StaticData). Does not perform additional safety checks.
f | Current frame. |
NullReferenceException | If the StaticColliderMapRef does not reference a valid asset. |
IndexOutOfRangeException | If the hit is not static (IsDynamic) or the collider index is not valid for the array of static colliders on the referenced map. |
ushort Quantum.Physics2D.Hit.ShapeUserTag |
The Shape2D.UserTag field of the shape hit by the query.
FP Quantum.Physics2D.Hit.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.
FP Quantum.Physics2D.Hit.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.
FPVector2 Quantum.Physics2D.Hit.Point |
The point in world space where the collider is hit by the query.
FPVector2 Quantum.Physics2D.Hit.Normal |
The surface normal of the hit.
This field is not computed unless QueryOptions.ComputeDetailedInfo is used in the query options.
|
get |
If the collider hit by the query is not static, i.e. it belongs to an Entity.
|
get |
0-based index of the static collider on the Map.StaticColliders2D array of the map referenced by StaticColliderMapRef. If the hit IsDynamic, this value is -1. Tip: use TryGetStaticCollider(FrameBase, out MapStaticCollider2D), TryGetStaticData(FrameBase, out StaticColliderData), GetStaticCollider(FrameBase) or GetStaticData(FrameBase) in order to safely and conveniently access info about a static collider hit.
|
get |
The reference to the map used by the physics engine when a static collider is hit. Otherwise, this value is default (hit IsDynamic).
|
getset |
If the collider hit by the query is Trigger.
|
get |
The reference of the entity hit by the query, EntityRef.None if hitting a static collider (IsDynamic false).