Ok so I have a space game, at the moment in the works.
I am having one issue with a weapon, or rather, I'm not sure how I should do this. However, this is how it works:
I have a 'ram' ship weapon, where your ship can damage if you 'ram' (run into) another ship. However, currently ram damage is depending how how 'fast' you are going.
However, the problem is, people bring up that it should get a relative velocity. What I mean is Ship 1 minus (or plus) Ship 2 velocity, but depending on heading/etc etc.
Generally, for example, If I was going 0.90GU/s behind a ship that was going 0.80GU/s if the heading was the same, the velocity would become only 0.10GU/s. However, if we were 'running into each other' with total opposite headings (Aka I'm going north and hes going south.) and we collided, the velocity woudl be 1.70GU/s.
However, the issue becomes when headings aren't exactly the same, maybe one ships going SE, and I'm charging him from the EAST. How would I determine the proper damage? My game uses basic X/Y, heading, current speed etc. Basicly speed however is determined by X/Y coords and such. There are a few other variables that relate to movement.
Does anyone have a good tip or idea/formula I should use here? I would think it would use heading and X/Y + current speed only to determine the relative velocity, but I'm not too sure. I'm not asking for a full code example, but rather, a formula or tip on how this should work thats more broken down/easy to understand.
I am new to game physics so I am learning myself. Thanks!