RealDocs

UKismetMathLibrary::LinePlaneIntersection

function Engine Blueprint Since unknown
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintPure

Description

Finds the point where a line segment crosses a plane, returning both the intersection point and the interpolation factor along the segment.

Caveats & Gotchas

  • T can fall outside the [0, 1] range when the plane intersects the infinite line but not the segment between LineStart and LineEnd — check T if you need to confirm the hit lies on the segment itself.
  • Returns false when the line is parallel to the plane (or nearly so), in which case T and Intersection are left unmodified and must not be read.
  • FPlane stores a normal and distance from origin, not two arbitrary points — construct it with FPlane(PlaneOrigin, PlaneNormal) if that's more convenient, or use LinePlaneIntersection_OriginNormal directly.

Signature

static bool LinePlaneIntersection(const FVector& LineStart, const FVector& LineEnd, const FPlane& APlane, float& T, FVector& Intersection)

Parameters

Name Type Description Default
LineStart const FVector& Start point of the line segment.
LineEnd const FVector& End point of the line segment.
APlane const FPlane& The plane to intersect against.
T float& Receives the interpolation factor along the line where the intersection occurs (0 = LineStart, 1 = LineEnd).
Intersection FVector& Receives the world-space point of intersection.

Return Type

bool

Example

Find where a trace line crosses a water plane C++
FPlane WaterPlane(FVector(0,0,WaterHeight), FVector::UpVector);
float T;
FVector HitPoint;
bool bHit = UKismetMathLibrary::LinePlaneIntersection(TraceStart, TraceEnd, WaterPlane, T, HitPoint);
if (bHit && T >= 0.f && T <= 1.f)
{
    SpawnSplashEffect(HitPoint);
}

Tags

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.