Get Component of Skeletal Mesh


I managed to get OnClick()-Event working with Skeletal Mesh in C++ for USkeletalMeshComponent* myMesh:

myMesh->OnClicked.AddDynamic(this, &AMyProduct::clicked);

but the function

void AMyObject::clicked(UPrimitiveComponent* TouchedComponent)
	//if (GEngine)GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT("CLICK: %s"), *TouchedComponent->GetName()));


only checks if ANY part of the Mesh is clicked, not which.
Is it possible to check which Component of the Mesh is clicked? Like Arm, Head or Body?

Thank you for any feedback,



it is possible to get the DebugName or other Properties of each Body,
but i still cant figure out, how to check if this Body was clicked.

I’m not sure if there is a more detailed on-click callback, but you could do it a bit differently. What you want to do is draw a line from the camera out into the world so it intersects the origin of the camera and the point where the mouse is (mapped from the screen into the 3D world as a point on the camera’s near plane). Getting a line trace from the camera has been explained many times so here’s the first hit I found. If that’s not enough, you can do a search. Then you can just look at which bone was hit in the trace results.