docs.unity3d.com
    Show / Hide Table of Contents

    Interface ILineRenderable

    Get line points and hit point info for rendering.

    Namespace: UnityEngine.XR.Interaction.Toolkit
    Syntax
    public interface ILineRenderable

    Methods

    GetLinePoints(ref Vector3[], out Int32)

    Gets the polygonal chain represented by a list of endpoints which form line segments to approximate the curve. Positions are in world space coordinates.

    Declaration
    bool GetLinePoints(ref Vector3[] linePoints, out int numPoints)
    Parameters
    Type Name Description
    Vector3[] linePoints

    When this method returns, contains the sample points if successful.

    Int32 numPoints

    When this method returns, contains the number of sample points if successful.

    Returns
    Type Description
    Boolean

    Returns true if the sample points form a valid line, such as by having at least two points. Otherwise, returns false.

    TryGetHitInfo(out Vector3, out Vector3, out Int32, out Boolean)

    Gets the current ray cast hit information, if a hit occurs. It returns the world position and the normal vector of the hit point, and its position in linePoints.

    Declaration
    bool TryGetHitInfo(out Vector3 position, out Vector3 normal, out int positionInLine, out bool isValidTarget)
    Parameters
    Type Name Description
    Vector3 position

    When this method returns, contains the world position of the ray impact point if a hit occurred.

    Vector3 normal

    When this method returns, contains the world normal of the surface the ray hit if a hit occurred.

    Int32 positionInLine

    When this method returns, contains the index of the sample endpoint within the list of points returned by GetLinePoints(ref Vector3[], out Int32) where a hit occurred. Otherwise, a value of 0 if no hit occurred.

    Boolean isValidTarget

    When this method returns, contains whether both a hit occurred and it is a valid target for interaction.

    Returns
    Type Description
    Boolean

    Returns true if a hit occurs, implying the ray cast hit information is valid. Otherwise, returns false.

    See Also

    XRInteractorLineVisual
    XRRayInteractor
    Back to top
    Terms of use
    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