docs.unity3d.com
    Show / Hide Table of Contents

    Struct ColliderCastHit

    A hit from a collider cast query.

    Inherited Members
    ValueType.Equals(Object)
    ValueType.GetHashCode()
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Namespace: Unity.Physics
    Syntax
    public struct ColliderCastHit : 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

    Gets or sets the collider key.

    Declaration
    public ColliderKey ColliderKey { get; set; }
    Property Value
    Type Description
    ColliderKey

    Returns ColliderKey of queried leaf collider.

    Implements
    IQueryResult.ColliderKey

    Entity

    Gets or sets the entity.

    Declaration
    public Entity Entity { get; set; }
    Property Value
    Type Description
    Entity

    Returns Entity of queried body.

    Implements
    IQueryResult.Entity

    Fraction

    Fraction of the distance along the Ray where the hit occurred.

    Declaration
    public float Fraction { get; set; }
    Property Value
    Type Description
    Single

    Returns a value between 0 and 1.

    Implements
    IQueryResult.Fraction

    Material

    Gets or sets the material.

    Declaration
    public Material Material { get; set; }
    Property Value
    Type Description
    Material

    Returns Material of queried leaf collider.

    Implements
    IQueryResult.Material

    Position

    The point in query space where the hit occurred.

    Declaration
    public float3 Position { get; set; }
    Property Value
    Type Description
    float3

    Returns the position of the point where the hit occurred.

    RigidBodyIndex

    Gets or sets the zero-based index of the rigid body.

    Declaration
    public int RigidBodyIndex { get; set; }
    Property Value
    Type Description
    Int32

    Returns RigidBodyIndex of queried body.

    Implements
    IQueryResult.RigidBodyIndex

    SurfaceNormal

    Gets or sets the surface normal.

    Declaration
    public float3 SurfaceNormal { get; set; }
    Property Value
    Type Description
    float3

    Returns the normal of the point where the hit occurred.

    Methods

    ToString()

    Convert this object into a string representation.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    A string that represents this object.

    Overrides
    ValueType.ToString()
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023