docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method GetNearestPoint

    GetNearestPoint(BezierCurve, Ray, int)

    Gets the point on a BezierCurve nearest to a ray.

    Declaration
    public static float3 GetNearestPoint(BezierCurve curve, Ray ray, int resolution = 16)
    Parameters
    Type Name Description
    BezierCurve curve

    The BezierCurve to compare.

    Ray ray

    The input ray.

    int resolution

    The number of line segments on this curve that are rasterized when testing for the nearest point. A higher value is more accurate, but slower to calculate.

    Returns
    Type Description
    float3

    Returns the nearest position on the curve to a ray.

    GetNearestPoint(BezierCurve, Ray, out float3, out float, int)

    Gets the point on a BezierCurve nearest to a ray.

    Declaration
    public static float GetNearestPoint(BezierCurve curve, Ray ray, out float3 position, out float interpolation, int resolution = 16)
    Parameters
    Type Name Description
    BezierCurve curve

    The BezierCurve to compare.

    Ray ray

    The input ray.

    float3 position

    The nearest position on the curve to a ray.

    float interpolation

    The ratio from range 0 to 1 along the curve at which the nearest point is located.

    int resolution

    The number of line segments that this curve will be rasterized to when testing for nearest point. A higher value will be more accurate, but slower to calculate.

    Returns
    Type Description
    float

    The distance from ray to nearest point on a BezierCurve.

    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)