   Doing Damage ?
  Hi guys,I''m trying to write a robust damage system but don''t really know what to compute.It should be based on incoming direction (head-on, just grazing, etc.) and incoming speed; and maybe the mass of the objects also.First of all, if an object hits head-on at (say) 100/units-sec will it be more or less damaging than a hit at 45 degrees going 200/units-sec ? What''s more damaging, speed or direction ?What am I trying to compute ? It would be nice to have a single return value.Also, I''m talking about simple objects (particle-like), so I don''t have to worry about whether or not the object pierces or ''breaks through'' the object it hits, and there is no friction or angular velocity.Thanks. 
  I don''t know what you mean when you say 45 degree angle.  Particles in physics cannot collide any way but directly.  An object has to have size and shape to be hit in any sort of ''orientation''.  If you are doing that, then simple trig will get you through most calculations, although "damage" is not a physical quantity.  Force is what you want to figure out, and if you truly want to determine the amount of it acting on a body then it depends on the mass, amount of deformation, and time in contact.If you want to determine the motion of objects after the collision then mass and velocity are used to determine momentum before and after the collision.  What level of physics are you educated to by the way? A physics text could help out a great deal, or more specifically a physics of games book. ;  You can calculate damage based on speed and then scale it based on the incidence angle (dot product). Its a neat idea in concept but its difficult to execute if the model has complex shapes. If their armor has a ridge on it, and it hit the ridge it could incorrectly scale based on that ridge.Its a lot of work but my only suggestion is to make a visible model and then work with an entirely different (And geometrically much simpler) model to calculate damage scales. ;  Hi, when I say a 45 degree angle I just mean not a direct hit; kind of like hail falling from the sky on your car; wouldn''t a hail ball falling directly down do more damage to the hood of your car than if someone threw one sideways at it and it skimmed the hood (like skipping stones on the water) ? Also, the hail ball will not go through the hood, that''s what I meant about it not breaking through.I already know how to bounce the pellets off, I just need a solid way to compute some damage. I''m treating the pellets as a big group of particles with a center of mass. If someone was wearing metal armor and you threw a metal ball directly at his chest it will damage the armor more than if it glanced him, so I was looking for some guidelines as to how to compute reasonable damage.I don''t know what level of physics I''m educated at, I never finished college. I have Fundamentals of Physics (extended edition) by Halliday et all.;  Oh I thought you meant everything was considered a particle in your game.  But since its not then what you want is easy stuff.  All you need to do is use vectors of trajectory and the normal of the object to calculate the angle between them.  Then the 'damage' that you're looking to calculate would be the maximum damage (i.e. a dead-on hit) times the cosine of that angle.  | <- this is your object's normal vector||......./ <- this is your trajectory path|...../|  a /|.../|./  |/_______ <- this is your objectThe cosine of angle (a), as shown in the crude diagram, (ascii is great isn't it?) can be multiplied to your max damage and will change it to a reasonable interpretation of an actual impact.So using your example, an object hitting head-on at 100 units/sec will cause 100 damage.  An object hitting at a 45 degree angle going 200 units/sec will cause 200*cos(45), or approximately 141 damage.Hope this helps :DCosmic [edited by - Cosmic One on February 10, 2004 5:06:08 PM] [edited by - Cosmic One on February 10, 2004 5:06:53 PM]