RealDocs

UKismetMathLibrary::Divide_Vector4Vector4

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

Description

Returns the element-wise division of two FVector4 values: {A.X/B.X, A.Y/B.Y, A.Z/B.Z, A.W/B.W}.

Caveats & Gotchas

  • No divide-by-zero protection is applied. If any component of B is zero, the corresponding result component will be +/-Inf or NaN. Always guard with Vector4_IsNAN on the result if B is runtime data.
  • W component is divided as well. If B.W is 0.0 (a direction vector) and A.W is non-zero, you will get a NaN in W — a common gotcha when mixing point and direction vectors.

Signature

static UE_INL_API FVector4 Divide_Vector4Vector4(const FVector4& A, const FVector4& B)

Parameters

Name Type Description Default
A const FVector4& Dividend vector.
B const FVector4& Divisor vector.

Return Type

FVector4

Example

Normalize each component by a per-axis scale C++
FVector4 Value(10.0, 20.0, 30.0, 1.0);
FVector4 Divisor(10.0, 10.0, 10.0, 1.0);
FVector4 Result = UKismetMathLibrary::Divide_Vector4Vector4(Value, Divisor);
// Result == (1.0, 2.0, 3.0, 1.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.