Binary ‘==’: no operator found? FTransform == FTransform

So it’s
Ftransform Location;
as var declaration, then that is what you have to convert , or better put the content of Location to an int.

So you just add the vector like here but with the name changed.
Here it shows you the indices representing int indexes made from vectors.
I don’t know if this method works out of unreal components, then you are going to have to use capture.

Anyway you just need to put the int index that you are trying to create out of your float points.

int yourintindex = Location.Add(xyz);
This works as long as you have an x,y,z float variables declared and used inside the array, maybe they are called something else so check that what ever they are named.

then do what ever with int yourindex to “==” with it.

Once you do that you are going to get the index out of your float and use that to compare. But I do not know if it works out of unreal components. If not you may want to add or convert in another form with capture or another form.

There are simple forms to convert.
Like:

But it may be unfrendly to unreal because unreal uses Fvector and especially Ftrasnform so you may not use raw C++ with these, so you have to use C++ like unreal likes with index points out of floats and captures. for the Fv or Ftr…

1 Like

how can I can check the index if it is duplicated using int index?

TArray<FTransform> Available{};
TArray<FTransform> UsedLocations{};
FTransform Location{};
int Index{};

RandomLocation(Available, Location); 
int Index = UsedLocations.Add(Location) ;

  if (UsedLocations.Find(Location) == -1)
  { 
     //Some code
  }

Already randomizing the locations by -1 formula to avoid duplicates.

void AMyGM::RandomLocation(TArray<FTransform> A,  FTransform& B)
{
	int32 ArrMaxLength{};
	ArrMaxLength = A.Num() - 1;
	FTransform GetByCopy{};
	GetByCopy = A[FMath::RandRange(0, ArrMaxLength)];
	B = GetByCopy;
}

The locations in the data table are vectors

if (UsedLocations.Find(Location) == -1) // this location variable is FTransform,

the == checks if it’s identical.
So this is what you are trying to do ?

 if (UsedLocations.Find(Your_int_index_variable) == -1)
  { 
     //Some code
  }

But What is used locations, another Ftransform as I see. You have to convert also Ftransform UsedLocations to int indexes.

So …

 if (Int array data that you converted.Find(Your_int_index_variable) == -1)

You may want to get indexes then store them to int type of array and then compare not with int variable but with the int array that you stored the indexes into.

Get indexes out of your Ftransforms both of them
Crete int arrays and store the indexes inside of them that you got from vectors
Use the arrays to compare with ==
As I see you are using the arrays to compare them not some simple index variable that contains one value maybe, so the array has the whole list.

1 Like

yes exactly

Good luck and do post back.

1 Like

So

if (Your_int_array with the values you had from check values.Find(Your_array with _index_variables from locations) == -1)
  { 
     //Some code
  }

Compare one array against the other but Int arrays not floats.
So if it works for you please let me know, I’ll use this too when I use relative possitions to check if the possitions have diffrrences after I switch from relative to world back.

1 Like

if it works I will accept this answer as solution :slight_smile:
I am currently trying

Sweet but I don’t need noble premium hahaha, just a solution to check possitions, I was interestid in this also, why I replied because I’m going to use transforms to transform landscapes that I have.

1 Like

Dont know what you want to achieve, but never use == for comparing float/double variables.
If you want compare FTransform then use FTransform::Equals function.

For example:

void SomeFunction(FTransform const& MyTransform)
{
  TArray<FTransform> Transforms = GetTransformsFromSomewhere();
  auto IsNearlyIdentical = [MyTransform](FTransform const& Other) noexcept -> bool {
    return Other.Equals(MyTransform);
  };
  if (Transforms.FindByPredicate(IsNearlyIdentical)) {
    // yay!
  }
}
1 Like

gives the same error: [Binary ‘==’: no operator found]

this Equals function also using the == from C++ in the end?

Post the modified code.

your solution I am still trying, the message was for @Emaer , his solution gives the same error as normal ==

So

You should have two int32 arrays.
TArray NameUsedLocations2{};
TArray Locations2{};

Then…

int first = Locations.Add Locations.Add (Fvector(Locations3));
int second = UsedLocations.Add (Fvector(YourUsedLocations3));

To create an index you have to create another Fvector array I think also for each because when you dump the data in it, it’s when you create an index.

So you may want to use 4 arrays Fvector or in your case Ftransform and 2 int arrays. You have dump data from fvector or in your case ftransform to other two who have the same type otherwise it’s going to give conversion errors.

So when you get the data in the arrays is when you create an index, but you already have an array with data, so you have to dump it in to an identical type and then when you dump it you get index. And with the index you store it into the other two arrays that are int.

4 arrays Locations, UsedLocations, Locations2 , UsedLocations2, then the other two that are int UsedLocations3 and Locations3.

To get the data as index you have to use float x,y,z. But since you alrady have the floats into the arrays you have to dump them in other arrays that are identical as type to get index on them, it’s when you dump data inside the array that you make an int index out of them. Then use the int variables to store to int arrays.

it is in compilation progress, my incredibuild has expired and the project is large, it will take some time to compile , I will share the result in any case

gives the same error: [Binary ‘==’: no operator found]

Unlikely, because FindByPredicate dont use operator== at all.

this Equals function also using the == from C++ in the end?

Nope. Equals function take second argument to specify tolerance. This argument is optional and is defaulted to machine epsilon-like.

1 Like

it is returning a bool and I think this is why it is complaining about the same error

Do this

TArray< FVector > Locations = TArray();
TArray< FVector > Locations 2= TArray();
TArray< FVector > UsedLocations = TArray();
TArray< FVector > UsedLocations2 = TArray();

TArray< Int32 >Locations3 = TArray();
TArray< Int32 >Used Locations3= TArray();

So you need to have these as first step I think.
After that you need to dump one into another with the int that stores a value.

So use the first array to insert to a second array and when you do you make an index:
int a1 = Locations.2.Add(Location);
int a2 = UsedLocations2.Add(UsedLocations);
Corrected some code.

Now you have some int indexes.

Try placing the int array instead of a local variable a1 for example
instead of int a1 to capture it directly inside the array maybe.

For Example

Locations3 = Locations.2.Add(Location));
There is no reason to give conversion error if you do this properly with integer values.

1 Like

I am waiting for this to get compiled, I think I did the same and hopefully it will not give the error

Also if you add individual variables that are int if it does not work directly with the int array to store directly into array rather than storing it first inside an int variable, it’s the same.

Location3.Add…name of the int variable
UsedLocation3.Add…name of the int variable

and now they are inside the int array and ready to ======. what ever you are trying to compare.

So you just do this.
int your_variable = Location2.Add(Location);
And when you dump one fvector array into another fvector you create an index int.

Or maybe like this
Your_location_int_array = Location2.Add(Location);

My post was not accepting <

So…

TArray< FVector > Locations = TArray();
TArray< FVector > Locations 2= TArray();
TArray< FVector > UsedLocations = TArray();
TArray< FVector > UsedLocations2 = TArray();

TArray< Int32 >Locations3 = TArray();
TArray< Int32 >Used Locations3= TArray();

Make sure the arrays have the type.
In your case it’s ```
< FTransform > not FVector

1 Like

this or “is inaccessible” means the property or method is not marked public, so you have to get them through a public method on FTransform.

1 Like