UKismetMathLibrary::Vector_GetProjection
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Projects the 2D components of a vector based on Z to give a perspective-style homogeneous divide: returns (X/Z, Y/Z, 1). Used in custom projection math or screen-space coordinate conversion.
Caveats & Gotchas
- • Division by Z occurs internally. If Z is 0 or very close to zero, the result will be infinite or very large. Always verify Z != 0 before calling this.
- • This is NOT the same as projecting onto a plane or projecting one vector onto another vector — those operations use different functions.
- • Rarely needed in standard gameplay code; mainly useful in custom rendering pipelines or manual perspective transforms.
Signature
static UE_INL_API FVector Vector_GetProjection(FVector A); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FVector | The 3D vector to project. | — |
Return Type
FVector Example
Manual perspective divide for a projected point C++
// A contains homogeneous clip-space coords (Xclip, Yclip, Zclip)
FVector ClipSpace = FVector(0.5f, 0.3f, 2.0f);
if (!FMath::IsNearlyZero(ClipSpace.Z))
{
FVector Projected = UKismetMathLibrary::Vector_GetProjection(ClipSpace);
// Projected = (0.25, 0.15, 1.0)
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?