RealDocs

UKismetMathLibrary::Vector4_DotProduct3

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

Description

Returns the 3D dot product of two FVector4 values using only the XYZ components: A.X*B.X + A.Y*B.Y + A.Z*B.Z. The W component is ignored.

Caveats & Gotchas

  • Because W is ignored, this is the correct function to use when your Vector4 stores a 3D direction (W=0) or you only care about the spatial direction regardless of W.
  • The result is a double, but Blueprint pins may display it as float. If you need full precision for rendering or physics calculations, keep the result in a C++ double variable rather than routing it through Blueprint.

Signature

static UE_INL_API double Vector4_DotProduct3(const FVector4& A, const FVector4& B)

Parameters

Name Type Description Default
A const FVector4& First vector. W is ignored.
B const FVector4& Second vector. W is ignored.

Return Type

double

Example

Check whether two 3D directions stored as Vector4 point the same way C++
FVector4 Dir1(0.0, 0.0, 1.0, 0.0); // forward
FVector4 Dir2(0.0, 0.0, -1.0, 0.0); // backward
double Dot = UKismetMathLibrary::Vector4_DotProduct3(Dir1, Dir2);
// Dot == -1.0  (opposite directions)

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.