RealDocs

UKismetMathLibrary::Vector_NormalUnsafe

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

Description

Returns a unit-length copy of the vector without checking for zero length. Faster than Normal() but will produce NaN or infinity if the vector is (near-)zero.

Caveats & Gotchas

  • Passing a zero or near-zero vector produces NaN components, which silently corrupt any downstream math and can cause hard-to-trace crashes. Only use this when you have already verified the vector is non-degenerate.
  • In shipping builds the extra division is usually negligible. Prefer Normal() or GetSafeNormal() unless profiling has shown normalization to be a hotspot, and only switch after adding an explicit IsNearlyZero() guard upstream.

Signature

static UE_INL_API FVector Vector_NormalUnsafe(const FVector& A);

Parameters

Name Type Description Default
A const FVector& The vector to normalize. Must be non-zero.

Return Type

FVector

Example

Use after a known-valid direction C++
// Direction is guaranteed non-zero (set from a physics impact)
FVector ImpactDir = HitResult.ImpactNormal; // already unit from physics
FVector Reflected = UKismetMathLibrary::GetReflectionVector(
    UKismetMathLibrary::Vector_NormalUnsafe(LaserDir), ImpactDir);

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.