docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method PointLineNearestPoint

    PointLineNearestPoint(float3, float3, float3, out float)

    Returns the nearest point on a finite line segment to a point.

    Declaration
    public static float3 PointLineNearestPoint(float3 p, float3 a, float3 b, out float lineParam)
    Parameters
    Type Name Description
    float3 p

    The point to compare to.

    float3 a

    The line start point.

    float3 b

    The line end point.

    float lineParam

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

    Returns
    Type Description
    float3

    The nearest point on a line segment to another point.

    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)