Take Damage based on which collision primitive was hit

Hi

I would like to build a damage system for a spaceship which have many parts (bridge, engineering, etc), which is not that different from a character with multiple body parts. If I understood the documentation right, the damage events are handled on the actor/pawn level. My pawn has a static mesh, which have N number of collision components, defined in Maya.

I would like to ask for a method to apply the damage to these “components”, when the pawn has been hit.

Thanks for reading :slight_smile:

TakeDamage() takes a parameter called DamageEvent (of type FDamageEvent).
This parameter has a method called “GetBestHitInfo” which has an out parameter called “OutHitInfo” which contains all the information you need, e.g.

float AYourCharacter::TakeDamage(float Damage, FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser)
{
		Damage = Super::TakeDamage(Damage, DamageEvent, EventInstigator, DamageCauser);
		
		/***********************/
		/*** Get Hit details ***/
		/***********************/
		FHitResult hitRes;
		FVector impulseDir;
		DamageEvent.GetBestHitInfo(this, DamageCauser, hitRes, impulseDir);
		
		// Do stuff
		hitRes.Component...
}

See the documentation for more details.