Struct RaycastQuery | Magic Leap XR Plugin | 6.0.0
docs.unity3d.com
    Show / Hide Table of Contents

    Struct RaycastQuery

    Represents a raycast query.

    Namespace: UnityEngine.XR.MagicLeap
    Syntax
    public struct RaycastQuery : IEquatable<RaycastQuery>

    Constructors

    RaycastQuery(Ray, Boolean)

    Constructs a "single-point" raycast query, i.e., width and height are both 1.

    Declaration
    public RaycastQuery(Ray ray, bool collideWithUnobserved = false)
    Parameters
    Type Name Description
    Ray ray

    The ray, in session space, to cast.

    Boolean collideWithUnobserved

    If true, a ray will temrinate when encountering an unobserved area and return a surface or the ray will continue until it ends or hits an observed surface.

    RaycastQuery(Ray, Vector3, Int32, Int32, Single, Boolean)

    Constructs a raycast query.

    Declaration
    public RaycastQuery(Ray ray, Vector3 up, int width, int height, float horizontalFov, bool collideWithUnobserved)
    Parameters
    Type Name Description
    Ray ray

    The ray, in session space, to cast.

    Vector3 up

    If multiple rays are to be fired (i.e., width or height are greater than 1), this is used to determine the coordinate system used to calculate the directions of those rays; therefore must be orthogonal to the direction vector. This parameter is has no effect on a single-point raycast.

    Int32 width

    The number of horizontal rays to cast. Must be at least 1.

    Int32 height

    The number of vertical rays to cast. Must be at least 1.

    Single horizontalFov

    The horizontal field of view, in degrees. When width or height are greater than 1, this is used to determine the frustum in which to cast multiple rays.

    Boolean collideWithUnobserved

    If true, a ray will temrinate when encountering an unobserved area and return a surface or the ray will continue until it ends or hits an observed surface.

    Remarks

    If width or height are greater than 1, width * height rays are cast from the ray origin within a frustum defined by horizontalFov and up.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown if width is less than 1.

    ArgumentOutOfRangeException

    Thrown if height is less than 1.

    ArgumentException

    Thrown if width or height is greater than 1 but up is not orthogonal to the ray's direction.

    ArgumentException

    Thrown if width or height is greater than 1, but up is zero.

    Properties

    collideWithUnobserved

    If true, a ray will temrinate when encountering an unobserved area and return a surface or the ray will continue until it ends or hits an observed surface.

    Declaration
    public bool collideWithUnobserved { get; }
    Property Value
    Type Description
    Boolean

    height

    The number of vertical rays to cast.

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

    horizontalFov

    The horizontal field of view, in degrees. When width or height are greater than 1, this is used to determine the frustum in which to cast multiple rays.

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

    ray

    A Ray, in session space.

    Declaration
    public Ray ray { get; }
    Property Value
    Type Description
    Ray

    up

    If multiple rays are to be fired (i.e., width or height are greater than 1), this is used to determine the coordinate system used to calculate the directions of those rays; therefore must be orthogonal to the direction vector. This parameter is has no effect on a single-point raycast.

    Declaration
    public Vector3 up { get; }
    Property Value
    Type Description
    Vector3

    width

    The number of horizontal rays to cast.

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

    Methods

    Equals(Object)

    IEquatable interface. Compares for equality.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj

    The object to compare for equality.

    Returns
    Type Description
    Boolean

    true if obj is of type RaycastQuery and compares equal with Equals(RaycastQuery).

    Overrides
    ValueType.Equals(Object)

    Equals(RaycastQuery)

    IEquatable interface. Comapres for equality.

    Declaration
    public bool Equals(RaycastQuery other)
    Parameters
    Type Name Description
    RaycastQuery other

    The RaycastQuery to compare against.

    Returns
    Type Description
    Boolean

    true if all fields of this RaycastQuery compare equal to other.

    GetHashCode()

    Computes a hash code suitable for use in a Dictionary or HashSet.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    A hash code suitable for use in a Dictionary or HashSet.

    Overrides
    ValueType.GetHashCode()

    Operators

    Equality(RaycastQuery, RaycastQuery)

    Comapres for equality. Same as Equals(RaycastQuery).

    Declaration
    public static bool operator ==(RaycastQuery lhs, RaycastQuery rhs)
    Parameters
    Type Name Description
    RaycastQuery lhs

    The left-hand side of the comparison.

    RaycastQuery rhs

    The right-hand side of the comparison.

    Returns
    Type Description
    Boolean

    true if all fields of this RaycastQuery compare equal to other.

    Inequality(RaycastQuery, RaycastQuery)

    Comapres for inequality. Same as !Equals(RaycastQuery).

    Declaration
    public static bool operator !=(RaycastQuery lhs, RaycastQuery rhs)
    Parameters
    Type Name Description
    RaycastQuery lhs

    The left-hand side of the comparison.

    RaycastQuery rhs

    The right-hand side of the comparison.

    Returns
    Type Description
    Boolean

    true if any of the fields of this RaycastQuery are not equal to other.

    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