Skip to content

Instantly share code, notes, and snippets.

@flagoworld
Last active December 24, 2015 06:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flagoworld/6760158 to your computer and use it in GitHub Desktop.
Save flagoworld/6760158 to your computer and use it in GitHub Desktop.
Damaging a ship works like this, i hope...
//Energy = radiation energy released from impact, MJ
//Shield = shield absorbtion capacity, MJ
//Hull = amount of stress the hull can receive before collapsing, MJ
shield -= energy
if(shield < 0)
{
energy = -shield;
shield = 0;
}
hull -= 0.5f * mass * velocity * velocity / 10e9f + energy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment