Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

assigning a FVector to another Fvector broken?

Been writing some code to store some info into FVectors. 

 //ArmsBasePostion is a FVector is declared as so in the .h file  
   FVector ArmsBasePostion;

 //called in my beginplay
 ArmsBasePostion = FPSArms->RelativeLocation;

but this isnt working it keeps tossing an error  on left operator "="

on the other hand 

    ArmsBasePostion.X = FPSArms->RelativeLocation.X;
     ArmsBasePostion.Y = FPSArms->RelativeLocation.Y;
     ArmsBasePostion.Z = FPSArms->RelativeLocation.Z;

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

Product Version: UE 4.18
more ▼

asked Jan 13 '18 at 06:56 PM in C++ Programming

avatar image

37 10 14 18

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first


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.

     * Copy another FVector into this one
     * @param Other The other vector.
     * @return Reference to vector after copy.
     FORCEINLINE FVector& operator=(const FVector& Other);

I noticed that this is defined in the UnrealMathUtility and it's commented out


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;

more ▼

answered Jan 13 '18 at 08:12 PM

avatar image

151 4 11 14

avatar image invayne Jan 13 '18 at 09:08 PM

ok ty for the info probably something they for got to undo when they where messing around in there.

avatar image Impulse21 Jan 13 '18 at 10:37 PM

No Problem. Yeah, that might be the case. I would like to know more on the design decision to wrap that operator around that define.

Anyhow, happy coding!!! :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question