docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method RayLineNearestPoint

    RayLineNearestPoint(float3, float3, float3, float3)

    Returns the nearest points between a ray and line segment.

    Declaration
    public static (float3 rayPoint, float3 linePoint) RayLineNearestPoint(float3 ro, float3 rd, float3 a, float3 b)
    Parameters
    Type Name Description
    float3 ro

    The ray origin point.

    float3 rd

    The ray direction (normalized vector).

    float3 a

    The line start point.

    float3 b

    The line end point.

    Returns
    Type Description
    (float3 rayPoint, float3 linePoint)

    Returns the nearest points between a ray and line segment.

    RayLineNearestPoint(float3, float3, float3, float3, out float, out float)

    Returns the nearest points on a ray and a line segment to one another.

    Declaration
    public static (float3 rayPoint, float3 linePoint) RayLineNearestPoint(float3 ro, float3 rd, float3 a, float3 b, out float rayParam, out float lineParam)
    Parameters
    Type Name Description
    float3 ro

    The ray origin point.

    float3 rd

    The ray direction (normalized vector).

    float3 a

    The line start point.

    float3 b

    The line end point.

    float rayParam

    The signed distance between point 'ro' and the projection of the line segment along the ray.

    float lineParam

    The signed distance between point 'a' and the projection of point 'p' on the line segment.

    Returns
    Type Description
    (float3 rayPoint, float3 linePoint)

    Returns the nearest points on a ray and a line segment to one another.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)