RealDocs

UKismetMathLibrary::NegateVector

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

Description

Returns the negation of a vector, i.e. {-A.X, -A.Y, -A.Z}. Flips the direction of a vector without changing its magnitude.

Caveats & Gotchas

  • Negating a zero vector returns FVector::ZeroVector, which is safe, but negating a NaN-containing vector propagates the NaN — sanitize inputs before calling if the source is not guaranteed clean.
  • In Blueprint this node is used frequently as an alternative to multiplying by -1, but the two are functionally identical; prefer NegateVector for clarity when the intent is purely direction reversal.

Signature

static UE_INL_API FVector NegateVector(FVector A);

Parameters

Name Type Description Default
A FVector The vector to negate.

Return Type

FVector

Example

Compute bounce reflection by negating surface normal component C++
FVector IncomingVelocity = Projectile->GetVelocity();
// Reflect off a flat floor (invert Z)
FVector Reflected = IncomingVelocity;
Reflected.Z = UKismetMathLibrary::NegateVector(FVector(0.f, 0.f, IncomingVelocity.Z)).Z;

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.