Thank you very muche for your fast answer. Yes, I tried it. And you are right, this attaches the actor to the other actor.
Unfortunately dose this do not have any effect to the mesh. How can I bind the mesh to the actors component?
I use for the “attacher”:
if(overlappingObjects.Num()>1){
AActor* BasicObject = overlappingObjects[0];
for(AActor* A:overlappingObjects){
if(BasicObject!= A){
A->AttachToActor(BasicObject,FAttachmentTransformRules(EAttachmentRule::KeepWorld, true));
}
}
}
And for the other object:
AStoneBrick::AStoneBrick()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
this->Scene = CreateDefaultSubobject<USceneComponent>(TEXT("Scene"));
this->RootComponent = Scene;
this->ObjectMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
this->ObjectMesh->AttachTo(RootComponent);
this->ObjectMesh->SetSimulatePhysics(true);
this->ObjectMesh->SetNotifyRigidBodyCollision(true);
}
**what am I doing wrong? **
Thank you very muche!