Information returned from a valid hit of a physics query. More...
Public Member Functions | |
override Int32 | GetHashCode () |
Overrides the hash code generation of this type. More... | |
Shape2D * | GetShape (FrameBase f) |
Gets the shape of the entity. If the entity is a compound, it returns the specific shape of the compound. More... | |
ref MapStaticCollider2D | GetStaticCollider (FrameBase f) |
Gets a reference to the static collider hit. Does not perform additional safety checks. More... | |
ref MapStaticCollider2D | GetStaticCollider (FrameThreadSafe f) |
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... | |
ref StaticColliderData | GetStaticData (FrameThreadSafe f) |
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.StaticColliders2D array of the referenced map. More... | |
bool | TryGetShape (FrameBase f, out Shape2D *shape) |
Checks if the hit is valid and outs the shape of the entity. Otherwise, it will return false. If the entity is a compound, it returns the specific shape of the compound. More... | |
bool | TryGetStaticCollider (FrameBase f, out MapStaticCollider2D collider) |
Tries to access the static collider that was hit. More... | |
bool | TryGetStaticCollider (FrameThreadSafe f, out MapStaticCollider2D collider) |
bool | TryGetStaticData (FrameBase f, out StaticColliderData data) |
Tries to access the data of the static collider that was hit (MapStaticCollider2D.StaticData). More... | |
bool | TryGetStaticData (FrameThreadSafe f, out StaticColliderData data) |
Static Public Member Functions | |
static void | Serialize (void *ptr, FrameSerializer serializer) |
Serializes a Hit 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... | |
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... | |
Static Public Attributes | |
const int | SIZE = SecondInfo + sizeof(Int32) * 2 |
The size of the struct in bytes. 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 | IsStatic [get] |
If the collider hit by the query is 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.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... | |
AssetRef< Map > | 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.
Gets the shape of the entity. If the entity is a compound, it returns the specific shape of the compound.
f | The frame. |
Checks if the hit is valid and outs the shape of the entity. Otherwise, it will return false. If the entity is a compound, it returns the specific shape of the compound.
f | The frame. |
shape | The shape pointer. |
|
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 ). |
false
if the collider hit is not static or the collide index or referenced map are not valid. true
otherwise.
|
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 ). |
false
if the collider hit is not static or the collide index or referenced map are not valid. true
otherwise.
|
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. |
|
inlinestatic |
|
inline |
Overrides the hash code generation of this type.
|
static |
The size of the struct in bytes.
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 |
If the collider hit by the query is static.
|
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.
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
).