I would recommend using tags, there is a node, ActorHasTag, that returns a boolean value based on whether and actor or component has tag. This way you just put a tag on each actor you want to be able to attach to your truck and the truck check to make sure the actor that has that tag. You can add tags to both Actors and Components and there is a ComponentHasTag node as well so make sure you add the tag at the right level.
You can either add tags through code or directly through blueprint, just go to the details panel and search for tags. One last note, be sure to name the tags something easy to spell and remember as the input tag you use for these nodes must match exactly and they are case sensitive.
If this answers you’re question, please remember to come back to accept it and markyour question as resolved, I hope it all works out for your and best of luck!
I posted a link to the unreal docs on the node here: https://docs.unrealengine.com/en-US/BlueprintAPI/Utilities/ActorHasTag/index.html
In C++ it looks like this:
//My Actor Class cpp
//In the constructor
AMyActorClass::AMyActorClass(){
Tags.Add(TEXT("MyTag"));
}
//My truck .cpp
void MyTruck::AttachToWheel(AActor* ActorToAttach){
if(ActorToAttach->ActorHasTag(TEXT("MyTag"))
{
//Attach actor to wheel socket
}
else{
//Don't attach actor to wheel socket
}
}