Download

Vector conversion errors

Greetings,
Been working on a double precision vector system for ue4, seem to have fixed the majority of the issues arising but im stuck on one.
I need a conversion from the double Vectors back to the float Vectors but the issue is that its throwing a error on compile,

“left of ‘.X’ must have class/struct/union \engine\source\runtime\core\public\Math\VectorF.h”

same with Y and Z, then says “use of undefined type FVector” but its included at the start of the header and VS has no issue jumping to the definition of it.

code section


FORCEINLINE FVector2::FVector2(const FVector V)
    : X(V.X), Y(V.Y), Z(V.Z)
{
    DiagnosticCheckNaN();
}


thanks

I’m not quite sure what your issue is, but I suspect it’s to do with accessibility of FVector from where your code is.

As an aside, I’d probably name the type ‘FVectorDouble’, since FVector2 sounds a lot like a 2d vector.

The proper include should be \engine\source\runtime\core\public\Math\Vector.h

not sure where VectorF.h comes from.

Edit:Changed FVector2 to FVectorFloat and VectorF.h to VectorFloat.h to help.

VectorFloat is a copy of the original float vectors which has FVectorFloat as the struct, FVector is the double version
The code is in the same public/Math as the rest of the vector.h files, ive tried adding #include math/vector.h into the VectorFloat.h but it still gives me the same issue

It seems if i remove the include of “vectorFloat.h” from Vector.h it produces a similar error within vector.h but says that FVectorFloat is undefined, but VS can still jump to the definition.

source link https://github.com/Rareden/UnrealEng…48396229f53252

Conversion snippet from Vector.h, (doubles one) that is also producing the error


FORCEINLINE FVector::FVector(const FVectorFloat& V)
    : X(V.X), Y(V.Y), Z(V.Z)
{
    DiagnosticCheckNaN();
}


EDIT:well i fixed it, turns out i had to define that in the .h that its converting from, not to.