Among the 6 parameters in OnComponentBeginOverlap, what does OtherBodyIndex mean?

void AMyClass::OnCompBeginOverlap(
    UPrimitiveComponent* OverlappedComponent,
    AActor* OtherActor,
    UPrimitiveComponent* OtherComp,
    int32 OtherBodyIndex,
    bool bFromSweep,
    const FHitResult& SweepResult)
{
    // ....
}

What does int32 OtherBodyIndex mean?

In skinned mesh components (skeletal mesh component is derived from this component) they are used to get the bone name.

Look for this code in CharacterMovementComponent.cpp:11150

		FName BoneName = NAME_None;
		if (OtherBodyIndex != INDEX_NONE)
		{
			BoneName = ((USkinnedMeshComponent*)OtherComp)->GetBoneName(OtherBodyIndex);
		}

If the OtherComp is a USkinnedMeshComponent the body index refers to the bone index.

1 Like