UKismetMathLibrary::PointsAreCoplanar
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Determines whether a set of points all lie approximately on the same plane, within a tolerance. Any three points or fewer are always considered coplanar.
Caveats & Gotchas
- • With three or fewer points the function returns true unconditionally, since any three non-collinear points define a plane.
- • The Tolerance parameter is a distance-like threshold, not a percentage — its meaningful scale depends on how large your point cloud's coordinates are, so a value tuned for small meshes may be too strict for level-scale geometry.
- • This is an O(n) check against a plane fitted from the first few points, not a least-squares best-fit plane, so pathological point orderings can affect the result.
Signature
static bool PointsAreCoplanar(const TArray<FVector>& Points, float Tolerance = 0.1f) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Points | const TArray<FVector>& | The set of points to test for coplanarity. | — |
| Tolerance | float | Larger numbers allow more variance from a perfect plane before the test fails. | 0.1f |
Return Type
bool Example
Validate a flat floor selection C++
TArray<FVector> FloorPoints = { FVector(0,0,0), FVector(100,0,0), FVector(100,100,0), FVector(0,100,5) };
bool bIsFlat = UKismetMathLibrary::PointsAreCoplanar(FloorPoints, 2.0f);
if (!bIsFlat)
{
UE_LOG(LogTemp, Warning, TEXT("Selected floor points are not flat enough"));
} Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?