x

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"

FPackedNormal to FVector Unreal 4.12 Issue

It looks like a couple of new items have been added to FPackedNormal:

 void operator=(const FVector4& InVector);
 operator FVector4() const;

So, when I call

 FVector Test(SomeFPackedNormal);

I get this error thrown up:

 error C2668: 'FVector::FVector': ambiguous call to overloaded function
 note: could be 'FVector::FVector(FVector &&)'
 note: or       'FVector::FVector(const FVector &)'
 note: or       'FVector::FVector(EForceInit)'
 note: or       'FVector::FVector(FIntPoint)'
 note: or       'FVector::FVector(FIntVector)'
 note: or       'FVector::FVector(const FLinearColor &)'
 note: or       'FVector::FVector(const FVector4 &)'
  note: or       'FVector::FVector(float)'
  note: while trying to match the argument list '(FPackedNormal)'
 error C2668: 'FVector::FVector': ambiguous call to overloaded function
  note: could be 'FVector::FVector(FVector &&)'
  note: or       'FVector::FVector(const FVector &)'
  note: or       'FVector::FVector(EForceInit)'
  note: or       'FVector::FVector(FIntPoint)'
  note: or       'FVector::FVector(FIntVector)'
  note: or       'FVector::FVector(const FVector4 &)'
  note: or       'FVector::FVector(float)'
  note: while trying to match the argument list '(FPackedNormal)'

This was also not the case before in 4.11. So, it seems like the new equality overloads make it unsure whether to convert to FVector or FVector4?

Product Version: UE 4.12
Tags:
more ▼

asked Jul 07 '16 at 03:12 PM in Bug Reports

avatar image

Brandelan
210 12 17 24

avatar image Doug E ♦♦ STAFF Jul 08 '16 at 05:27 PM

Hey Brandelan-

With

 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test)
 FVector Rando;
 
 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test)
 FPackedNormal MoreRando;

in the header and Rando(MoreRando); in the constructor, I get the same error in 4.12.5 and 4.11.2 of "term does not evaluate to a function taking 1 arguments". Can you provide the code you're using to take advantage of FPackedNormal?

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

2 answers: sort voted first

Hey Brandelan-

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will follow up.

Cheers

Doug Wilson

more ▼

answered Jul 27 '16 at 01:53 PM

avatar image Brandelan Jul 27 '16 at 03:02 PM

I still have the issue. All I've been able to do is work around it. When I have code where I have to convert FPackedNormal back to an FVector:

     FPackedNormal newItem(FVector(1,1,1));
 
     FVector test2(newItem);


I get this error:

 error C2668: 'FVector::FVector': ambiguous call to overloaded function
 2>  c:\program files\epic games\4.12\engine\source\runtime\core\public\math\Vector.h(969): note: could be 'FVector::FVector(FVector &&)'
 2>  c:\program files\epic games\4.12\engine\source\runtime\core\public\math\Vector.h(969): note: or       'FVector::FVector(const FVector &)'
 2>  c:\program files\epic games\4.12\engine\source\runtime\core\public\math\Vector.h(1227): note: or       'FVector::FVector(EForceInit)'
 2>  c:\program files\epic games\4.12\engine\source\runtime\core\public\math\Vector.h(1221): note: or       'FVector::FVector(FIntPoint)'
 2>  c:\program files\epic games\4.12\engine\source\runtime\core\public\math\Vector.h(1215): note: or       'FVector::FVector(FIntVector)'
 2>  c:\program files\epic games\4.12\engine\source\runtime\core\public\math\Vector.h(1209): note: or       'FVector::FVector(const FLinearColor &)'
 2>  C:\Program Files\Epic Games\4.12\Engine\Source\Runtime\Core\Public\Math\UnrealMath.h(65): note: or       'FVector::FVector(const FVector4 &)'
 2>  c:\program files\epic games\4.12\engine\source\runtime\core\public\math\Vector.h(1197): note: or       'FVector::FVector(float)'

avatar image Doug E ♦♦ STAFF Jul 29 '16 at 05:33 PM

I tried adding the two lines from your previous comment into the header file / constructor / and BeginPlay() functions of an actor class. Compiling with the code in the header file gave syntax errors and the other two both returned "Unresolved External" errors. I also tried this code in a 4.11 project with the same result. If possible, could you provide a sample project where you are receiving errors on compile?

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

Sure. I'm pretty sure I just referenced code from the UProceduralMeshComponent already existing in the engine:

 /** One vertex for the procedural mesh, used for storing data internally */
 USTRUCT()
 struct FDynamicMeshVertex
 {
 GENERATED_USTRUCT_BODY()
 
 /** Vertex position */
 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Vertex)
 FVector Position;
 
 /** Vertex position */
 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Vertex)
 FVector2D UV0;
 
 /** Vertex tangent */
 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Vertex)
 FPackedNormal TangentX;
 
 /** Vertex tangent */
 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Vertex)
 FPackedNormal TangentZ;
 
 UPROPERTY()
 FColor Color;
 
 
 FDynamicMeshVertex()
 : Position(0.f, 0.f, 0.f)
 , TangentX(FVector(1.f, 0.f, 0.f))
 , TangentZ(FVector(0.f, 0.f, 1.f)),
 UV0(0.f, 0.f),
 Color(FColor(255, 255, 255))
 {}
 
 FVector GetTangentY()
 {
 return (FVector(TangentZ) ^ FVector(TangentX)) * ((float)TangentZ.Vector.W / 127.5f - 1.0f);
 }
 };

That worked for me in 4.11 and 4.10 if I recall correctly. It's just the GetTangentY function.

more ▼

answered Jul 08 '16 at 06:48 PM

avatar image

Brandelan
210 12 17 24

avatar image Doug E ♦♦ STAFF Jul 11 '16 at 04:36 PM

I tried to test this but did not get any compile error with my code. In my header file I declared my FPackedNormal as a

 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test)
 FPackedNormal PackedNorm;

When I added the line FVector(PackedNorm); in my constructor I was able to compile successfully. Can you let me know if I missed anything in my setup as well as provide the exact error you're getting? Are you getting this error in Visual Studio or the editor?If this is in the editor, what exactly are you doing to call the code?

(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