RealDocs

FMath::SegmentPlaneIntersection

function Core Since 4.0
#include "Math/UnrealMathUtility.h"
Access: public Specifiers: static

Description

Tests whether a line segment intersects a plane and returns the intersection point. Returns false if the segment is parallel to (or lies entirely on) the plane.

Caveats & Gotchas

  • The segment must actually cross the plane — if both endpoints are on the same side, the function returns false. Use GetTForSegmentPlaneIntersect if you need the parametric T value beyond [0,1] range.
  • out_IntersectionPoint is only valid when the function returns true. Reading it on false return is undefined.
  • FPlane's W component encodes the distance from the origin along the normal. Constructing FPlane from three points or from a normal and a point are the two common paths — FPlane(Normal, Point) is the simpler.

Signature

static CORE_API bool SegmentPlaneIntersection(const FVector& StartPoint, const FVector& EndPoint, const FPlane& Plane, FVector& out_IntersectionPoint)

Parameters

Name Type Description Default
StartPoint const FVector& Start of the segment.
EndPoint const FVector& End of the segment.
Plane const FPlane& The plane to test intersection against.
out_IntersectionPoint FVector& Receives the intersection point if the function returns true.

Return Type

bool

Example

Find where a projectile path crosses a water surface plane C++
FPlane WaterPlane(FVector::UpVector, WaterSurfaceZ);
FVector HitPoint;
if (FMath::SegmentPlaneIntersection(ProjectileStart, ProjectileEnd, WaterPlane, HitPoint))
{
    SpawnSplashEffect(HitPoint);
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.