Hiho!
Im trying to learn a bit using the project, and cannot set up proper headshot&limb damage for the player (i enabled pvp damage). Any help on why it doesnt work would be appreciated.
- I added 2 new surface types in project settings for player head and limbs
- Added 2 new physical materials cloning PlayerBody, and set the new surfaces there
- Changed in player’s PhysicsAsset head and limb surface - click on head at 3d model, set playerhead material for simple collision physical material
- For PlayerPawn set collision preset to custom, enable (query and physics), object type to Pawn, and set weapon at trace responses to block.
- Changed some code:
SurvivalGame.h:
#define SURFACE_PLAYERHEAD SurfaceType5
#define SURFACE_PLAYERLIMB SurfaceType6
SWeaponInstant.cpp, changed DealDamage function a bit:
...
if (PhysMat && DmgType)
{
if (PhysMat->SurfaceType == SURFACE_ZOMBIEHEAD || PhysMat->SurfaceType == SURFACE_PLAYERHEAD)
{
ActualHitDamage *= DmgType->GetHeadDamageModifier();
}
else if (PhysMat->SurfaceType == SURFACE_ZOMBIELIMB || PhysMat->SurfaceType == SURFACE_PLAYERLIMB)
{
ActualHitDamage *= DmgType->GetLimbDamageModifier();
}
}