Found a solution, but its ugly.
Basically i spawn the actor then use Overlapping actors, if it finds one (and casts it to see if its the same class) it removes the spawned actor.
This is not a good solution because im sure its not optimal to spawn an actor just to check if it will collide with things.
Questions:
** 1.** Using GetOverlappingActors filter, how do i declare a class type. eg GetOverlappingActors(OutActors, ‘class AActor’) // What is the syntax for only looking at AActors that are overlapping? i can find all and then cast them but this seems less optimal.
2. How bad is this method to spawn and check collision? This is for a level generator and it will try 5 times with random set pieces till it finds one that fits over man iterations, so it will be looped alot, but only during BeginPlay().
3. In the code below i use Unique ID’s to check the pieces against each other, is this a valid method ? From my tests it seems to work fine for now.
Thanks
newmod->GetOverlappingActors(OutActors);
for (AActor* OverActor : OutActors)
{
AModule* casttest = Cast<AModule>(OverActor);
if (casttest != NULL)
{
if (OverActor->GetUniqueID() != newmod->GetUniqueID() && OverActor->GetUniqueID() != pendingexit->GetAttachParentActor()->GetUniqueID()) //Is not itself AND is not from its pending exit.
{
//WE GOT AN OVERLAP, call the police.
FoundSolution = false;
}
}
}