Hi i am trying to code my demo in full C++ but i am stuck.
I am looking for the “Simulation Generate Hit Events” boolean on my mesh.
I already find “bGenerateOverlapEvents” for the overlapping event but where is the equivalent for the hit event ?
I did something like this :
mesh = PCIP.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("Mesh")); const ConstructorHelpers::FObjectFinder<UStaticMesh> MeshObj(TEXT("/Game/Meshes/SM_WallKey")); mesh->SetStaticMesh(MeshObj.Object); mesh->BodyInstance.SetCollisionProfileName("PhysicsBody"); mesh->OnComponentHit.AddDynamic(this, &AKeyWall::OnHit); RootComponent = mesh;
In fact at the beginning I thought the “OnComponentHit” was enough but when I tried it wasn’t (There is collide but my event didn’t fire)
After that i see if y a create a BP child of my class and check the “Simulation Generate Hit Events” my Hit event work perfectly.
If someone can explain me how to enable event on Hit.
Thanks in advance and sorry for my english