OnComponentHit event from a Skeletal Body/Bone?

Hi there,

is it possible to get the OnComponentHit event only from a given part of a USkeletalMeshComponent (e.g left hand, right leg, finger tip of a skeleton) ?

Using the Phasset tool, I can select various bodies to generate hit events.

And using MySkelMesh->OnComponentHit.AddDynamic(..) works fine, however I would like to have this trigger only when a selected part of the skeleton is in collision.

Thanks!

Seems that one can check for the bone in collision from the USkeletalMeshComponent. So

MySkelMesh->OnComponentHit.AddDynamic(..)

will trigger for any bone collision from the skeleton. And then we can check (const FHitResult& Hit) if it is the bone we are looking for:

// Collision callback
void MyClass::OnHit(AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
{
	// Bone in collision
	UE_LOG(LogTemp, Warning, TEXT("BoneName: %s"), *Hit.BoneName.ToString());

}

This is not true. Hit.BoneName returns the name of the bone not of its actor, but of the one with whom it collided. If the bullet flies in my “leg”, then I will only know that something has got into me, and where (bone) is not known. But the bullet Hit.BoneName will know exactly what is “the leg”. For some reason this feature is not included, see Runtime / Engine / Classes / GameFramework / Actor.cpp line 3816 for details.
Void AActor :: DispatchPhysicsCollisionHit (const FRigidBodyCollisionInfo & MyInfo, const FRigidBodyCollisionInfo & OtherInfo, const FCollisionImpactData & RigidCollisionData)
In particular line 3829
// @todo At the moment we only pass the first contact in the ContactInfos array. Maybe improve this?

Update:
It is possible to use ActorLineTraceSingle, the input parameters to take from OnHit and in the resulting const FHitResult & Hit obtained after digesting, we get our bone

PS In version 4.17, the DispatchPhysicsCollisionHit function became virtual and the name of the bone can be obtained from there

PS In version 4.17, the DispatchPhysicsCollisionHit function became virtual and the name of the bone can be obtained from there

Brilliant, thanks!