Thank You very much solving this Issue, already 3 days I were trying to solve this, Thank You very very much.
Finally I got randomized locations from the 5 rows of the data table and duplicated are automatically deleted. Amazing.
interesting what magic is used by blueprint library to do this comparison? I generated the native code for this function and it is using simple method.
case 87:
{
if(::IsValid(ItemGroupRef))
{
ItemGroupRef->GetAllTransforms(/*out*/ Available);
}
RandomLocation(/*out*/ Available, /*out*/ Location);
}
case 88:
{
int Int_ArrayFind_Return = FCustomThunkTemplates::Array_Find(UsedLocations, Location);
bool bIntEqualEqual_Ret = UKismetMathLibrary::EqualEqual_IntInt(Int_ArrayFind_Return, -1);
if (!bIntEqualEqual_Ret)
{
__CurrentState = 87;
break;
}
}
They are comparing memory as far as I can tell. Your code will still not do what you initially wanted it to do, not without a loop. Also, from what I see you are only using the location of the components, so your issues could be solved by just having an array of FVector that would have the locations from the transforms. But yeah, like I said, itâs very easy to do in blueprint using shuffle. If you switch to an array of FVector you can also write a simple shuffle function to solve basically all your issues and make the code a lot more readable
Itâs just that from what Iâve seen you only use the location part of the Transforms, so you could ignore the rest and just store the location in the array
I mean instead of having an array of FTransform, have an array of FVector, and in your get all transforms function just do GetComponentLocation instead of GetComponentToWorld. If youâre not planning to use the rotations or scales of the components then you donât need the transform really, location should be fine
FVector does have the == operator overloaded as well, so Contains will work out of the box, and you can easily write a shuffle function after that, similar to this post. Once you have the shuffled locations, then you just iterate through them using a for loop and spawn what you want to spawn
To be honest I donât see why the shuffle method wouldnât work on the FTransform array as well.
Sir I finally fixed it, now it works perfectly as expected, Thank You once again , this is actually I solved by your help , I am still using your solution but just getting Locations and commented Rotation/Scale