Been writing some code to store some info into FVectors.
//ArmsBasePostion is a FVector is declared as so in the .h file
UPROPERTY()
FVector ArmsBasePostion;
//called in my beginplay
ArmsBasePostion = FPSArms->RelativeLocation;
but this isnt working it keeps tossing an error on left operator “=”
does work so im a little confused why the latter does not work. seems kinda dumb to have to keep breaking part any FVector to set them into another FVector.
anyone see any reason for this to not be working as it should thanks in advance
I looked into FVector struct and it appears that it does have an operator for =, however its only available if IMPLEMENT_ASSIGNMENT_OPERATOR_MANUALLY is defined.
#ifdef IMPLEMENT_ASSIGNMENT_OPERATOR_MANUALLY
/**
* Copy another FVector into this one
*
* @param Other The other vector.
* @return Reference to vector after copy.
*/
FORCEINLINE FVector& operator=(const FVector& Other);
#endif
I noticed that this is defined in the UnrealMathUtility and it’s commented out
//#define IMPLEMENT_ASSIGNMENT_OPERATOR_MANUALLY
I am not sure why this is. Maybe someone in the community can comment on this.
Either way, you can edit UnrealMathUtility and un-comment that line (Not sure what side affects this may cause), do the workaround you mentioned above, or implement a Vector adapter that extends Vector class and add this feature.
// Note: Not tested
struct FMyVector : public FVector
{
/* Constructors
*
*/
// Copy and pasted from Vector.h
FORCEINLINE FMyVector& FMyVector::operator=(const FMyVector& Other)
{
this->X = Other.X;
this->Y = Other.Y;
this->Z = Other.Z;
return *this;
}
}