Why no Dot Product in FVector4?

Hi Epics, why we have no DotProduct function in FVector4 ? And no operator |. Recently tried to use fmath for some interesting math calculations and got this WTF moment.

I see FVector have some Dot3 and Dot4 functions, but their semantics is kinda strange, and i cannot use them from my code for some reason.

Hey -

I’ve entered a feature request to include a DotProject function for FVector4 (UE-26515). For the time being it would be possible to write a dotproduct function in the form of:

float DotProduct = (VectorA.W * VectorB.W) + (VectorA.X * VectorB.X) + (VectorA.Y *VectorB.Y) + (VectorA.Z * VectorB.Z); return DotProduct;


Because we wanted to make it clear whether it was using 3 or 4 elements of the FVector4, we have the Dot3 and Dot4 methods on FVector4. Those are the ones you should use, I think adding an additional DotProduct function would be confusing. I’m not sure why those are not usable in your code e.g.:

float Result = Dot4(VecA, VecB);

Ok, here I was stupid, Dot4 have global namespace, unlike FVector::DotProduct, and I was trying to call it FVector4::Dot4 or v4.Dot4 with no luck.

Also there is no documentation on Dot4, I think this difference from FVector is confusing more.