Hello,
I want to determine which part of a Skeletal Mesh was clicked by the player.
I got this setup in C++:
myMesh = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("myMesh"));
myMesh->AttachTo(RootComponent);
myMesh->OnClicked.AddDynamic(this, &AMyProduct::clicked);
myMesh->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
myMesh->SetSimulatePhysics(false);
//myMesh->SetCollisionProfileName(TEXT("BlockAll"));
myMesh->SetCollisionResponseToAllChannels(ECR_Block);
// On Mesh-Clicked
void AMyProduct::clicked(UPrimitiveComponent* TouchedComponent)
{
if (GEngine)GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT("CLICK: %s"), *TouchedComponent->GetName()));
}
It only returns the Skeletal Mesh Component “myMesh” as the clicked Component, not which part of the Mesh was clicked.
I am looking for a way to get the specific Bone or Collision-Body that was clicked.
Does anyone have an idea?
Thanks,