RealDocs

UKismetMathLibrary::ProjectPointOnToPlane

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

Description

Snaps a point onto an infinite plane defined by a base point and a normal, returning the closest point on the plane surface.

Caveats & Gotchas

  • PlaneNormal must be a unit vector; passing a non-normalized normal scales the result incorrectly. Call GetSafeNormal() on it first if unsure.
  • This operates on a world-space point, not a direction. To flatten a direction vector onto a plane, use ProjectVectorOnToPlane instead.

Signature

static UE_INL_API FVector ProjectPointOnToPlane(FVector Point, FVector PlaneBase, FVector PlaneNormal);

Parameters

Name Type Description Default
Point FVector The point to snap onto the plane.
PlaneBase FVector Any point that lies on the plane.
PlaneNormal FVector Normal direction of the plane (must be unit length).

Return Type

FVector

Example

Constrain a world position to a ground plane C++
FVector ActorPos = GetActorLocation();
FVector GroundPoint = FVector::ZeroVector;
FVector GroundNormal = FVector::UpVector;
FVector Projected = UKismetMathLibrary::ProjectPointOnToPlane(ActorPos, GroundPoint, GroundNormal);
// Projected.Z == 0

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.