Modding Tutorials/Fire Geometry and Hitpoints

=Intro= It is EXTREMELY easy to get TOTALLY CHAOTIC damage results if you don't build your fire geometry and hitpoint (spheres) according to some very specific rules.

=The Rules=

All Fire Geometry

 * 1) Find Component all FG!
 * 2) Non-component'ed FG is ignored by the game by both the penetration and damage simulations.
 * 3) Convex Shell it all (required to get correct-facing normals). Just creating it inside Oxygen is not enough as only the Convex Shell command will yield correct normals.
 * 4) Otherwise: some angles faces of your fire geometry will ignore damage effects.
 * 5) Avoid overlapping the geometry if possible
 * 6) It may cause geometry to be missed by the penetration simulation, making your armor inaccurate; although it does not seem to do much harm to the damage simulation.
 * 7) Assign it a desired Material RVMAT (shortcut "e"), you don't/shouldn't give it a Texture.

If the fire geometry is armor

 * 1) Keep hitpoint spheres out of it as much as possible.
 * 2) Otherwise: partial penetration of armor will cause significant damage to the vehicle.

If the fire geometry is a damageable component

 * 1) The geometry should be encased as evenly as possible within a shell of hitpoint spheres. Damage is much more predictable if the spheres are "poking out" of the FG.
 * 2) You don't want giant spheres impinging on other geometry however, so it's best to use more spheres with a smaller radius.
 * 3) You generally don't want spheres in just part of your FG piece--unless you are trying to treat the un-sphered section as armor.
 * 4) Spheres inside FG and irregularly spaced: you will get inconsistent damage based on what angle and location you hit the FG at.

Hitpoint Vertices/Spheres

 * 1) Do NOT multi-assign hitpoint vertices; a vertex should belong to only one named selection.
 * 2) Avoid overlapping hitpoint spheres from different groups (e.g. Hull & Turret).
 * 3) It will not wreck things, but damage will end up going to both components to an extent you may not intend.

Crew Proxies

 * 1) Crew proxies must be included in the FG LOD--the same proxies as in the visual LOD's.
 * 2) Otherwise: crew cannot be damaged
 * 3) Note that the crew damage model may be simplified and apparently limited in the crew's animation config: boundingSphere (the default value of 1.0 possibly being too small to properly encompass the crew properly).

Bugs

 * 1) The CfgVehicles property viewGunnerInExternal / viewDriverInExternal is bugged and does not work for the driver of a vehicle, which apparently prevents this crew position from taking damage when buttoned up.
 * 2) Crew appear to ignore indirectHit damage and respond only to direct hits (and "hit" damage).

=Visual Guide=

The diagram above shows 3 different methods of assigning hitpoint spheres to fire geometry ("FG"). The red FG represents an area you want to receive damage, while the blue FG represents armor that should not cause damage when hit. The purple circles represent hitpoint spheres (P3D vertices with radii defined by hitpoint class config file).


 * A is the recommended way to handle FG. The damage FG consists of separate geometry encased in hitpoint spheres. Whenever the damage FG is hit, it will receive consistent, predictable damage.
 * B is not ideal but can still work. It is not as predictable in its damage results as "A". In this case, the area without hitpoint spheres is intended to function as armor--receiving minimal/no damage. The rest of the geometry is encased in hitpoint spheres as in "A".
 * C is not an acceptable approach. It combines several problems, and hits on geometry like this will produce very inconsistent damage results:
 * the damage FG is not fully encased in spheres
 * the spheres are not evenly placed within the FG
 * several of the spheres are submerged inside the FG

=How Damage Works=
 * Significant damage is caused when a projectile penetrates both hitpoint sphere(s) and fire geometry.
 * No damage is caused if fire geometry is not penetrated.
 * Minor damage is caused when fire geometry is penetrated even if no hitpoint sphere(s) are penetrated.

Formula for Hit Damage
(damage taken in %) = hit / armor
 * hit = "hit" value from cfgAmmo
 * armor =
 * Global damage: cfgVehicles global "armor" value
 * Local ('hitpoint' location) damage: [location armor value] = [cfgVehicles global "armor" value] x [HitPoints class "armor" coefficient]
 * Remember: cfgVehicles "armorStructural" value acts as a divisor to global damage: [final global damage] = damage / armorStructural

Formula for indirectHit Damage

 * Direct damage: same as hit above
 * i.e. (damage taken in %) = iHit / armor
 * Indirect damage: falls off to 4x indirectHitRange

Weapons Combining Hit and indirectHit

 * Direct damage: uses whichever property is larger, the two values are not added together
 * Indirect damage: same as indirectHit above
 * i.e. it is based on indirectHit value only (hit value does not affect it).