Bullet Penetration and Projectile Physics
13
14
In the content browser, create 2 physical material assets. In the tutorial these are called Physmat_Concrete and Physmat_Wood.
Open a material in the material editor. If you included Starter Content in your project, you can find M_Concrete_Poured for example. Change its Phys Material property to Physmat_Concrete.
Repeat for a wood material eg M_Wood_Pine.
15
16
17
Add a Structure asset to the project (Blueprints->Structure). In the example this is named PenetrationDataStruct.
Add 5 float variables to the structure: JoulesPerCM, ImpactAngleCoefficient, ImpactAngleConstant, VelocityCoefficient, and VelocityConstant.
Add a DataTable asset to your project and add 2 rows. The row names correspond to the names of the physical material assets created earlier. Some example data values are pictured.
18
In the FirstPersonProjectile blueprint, GetNewSpeed function, add a section which varies the JoulesPerCM based on the Physical Material hit. A local variable is useful for the scenario that no match is found.
You may now test that the projectile loses energy differently depending on the material penetrated through.
20
The formula to find the chance of penetration is pictured. In this case clamp is intended to restrict values to the range of 0-1.
Create a function named DecideWhetherToPenetrate. It should carry out the pictured formula and return a boolean.
21
Insert the DecideWhetherToPenetrate function into the event graph. You should now be able to test that each aspect of the function works correctly.