FMath::SphereDistToLine

Find closest point on a Sphere to a Line.

Windows
MacOS
Linux

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Math/UnrealMathUtility.h

Include

#include "Math/UnrealMathUtility.h"

Source

/Engine/Source/Runtime/Core/Private/Math/UnrealMath.cpp

Syntax

static void SphereDistToLine
(
    FVector SphereOrigin,
    float SphereRadius,
    FVector LineOrigin,
    FVector LineDir,
    FVector & OutClosestPoint
)

Remarks

Find closest point on a Sphere to a Line. When line intersects Sphere, then closest point to LineOrigin is returned.

Parameters

Parameter

Description

SphereOrigin

Origin of Sphere

SphereRadius

Radius of Sphere

LineOrigin

Origin of line

LineDir

Direction of line. Needs to be normalized!!

OutClosestPoint

Closest point on sphere to given line.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss