Struct DistanceHit
Namespace: Unity.Physics
Syntax
public struct DistanceHit : IQueryResult
Fields
QueryColliderKey
Collider key of the query collider
Declaration
public ColliderKey QueryColliderKey
Field Value
Type | Description |
---|---|
ColliderKey | If the query input uses composite collider, this field will have the collider key of it's leaf which participated in the hit, otherwise the value will be undefined. |
Properties
ColliderKey
Declaration
public ColliderKey ColliderKey { readonly get; set; }
Property Value
Type | Description |
---|---|
ColliderKey | Returns ColliderKey of queried leaf collider |
Implements
Distance
Declaration
public readonly float Distance { get; }
Property Value
Type | Description |
---|---|
Single | Distance at which the hit occurred. |
Entity
Declaration
public Entity Entity { readonly get; set; }
Property Value
Type | Description |
---|---|
Entity | Returns Entity of queried body |
Implements
Fraction
Fraction in distance queries represents the actual distance where the hit occurred, NOT the percentage of max distance
Declaration
public float Fraction { readonly get; set; }
Property Value
Type | Description |
---|---|
Single | Distance at which the hit occurred. |
Implements
Material
Declaration
public Material Material { readonly get; set; }
Property Value
Type | Description |
---|---|
Material | Returns Material of queried leaf collider |
Implements
Position
The point in query space where the hit occurred.
Declaration
public float3 Position { readonly get; set; }
Property Value
Type | Description |
---|---|
float3 | Returns the position of the point where the hit occurred. |
RigidBodyIndex
Declaration
public int RigidBodyIndex { readonly get; set; }
Property Value
Type | Description |
---|---|
Int32 | Returns RigidBodyIndex of queried body. |
Implements
SurfaceNormal
Declaration
public float3 SurfaceNormal { readonly get; set; }
Property Value
Type | Description |
---|---|
float3 | Returns the normal of the point where the hit occurred. |