"An object in motion remains in motion unless acted upon by an outside force." Thank-you Sir Isaac Newton! At first this may seem to be contrary to what you'd expect, after all, if I roll a ball along the floor, it comes to a stop eventually, doesn't it? Well yes, that is true, but there's an outside force at work: friction. The force of friction between the ground and the ball (and also the air and the ball) acts to decrease the speed of the ball, causing it to come to rest at some point.
Now, if we take this discussion out into the vacuum of space (my favourite place!), we will no longer have this friction to deal with! Alright.. if there are any die-hards out there, they're probably thinking, "Lucky's stupid! There are still particles and friction in space!" Ok, well you just shut-up :) I know my astronomy, and I know my physics, but for our purposes the 3 particles per cubic meter of space (deep space) will cause negligible friction!
Where was I before those die-hards so rudely interrupted me? Oh yes, frictionless space. In space, when an object is given a little push it will continue to travel in that direction infinitely (unless acted upon by ANOTHER force)! Cool, huh? How do we calculate the resultant speed and direction? A couple of physics equations are all we need:
F = ma
V = Vo + at
V = Vo + (F/m)t
V = (5) + (20000/10000) * 5 = 15m/s
Suppose that our ship is travelling with a speed of "So" at an angle of "Theta" (with 0 being straight "up"). Suppose also that our ship (mass = "m") is facing an angle of "Phi" and is about to thrust with a force of "F" in that direction. The two resultant velocity "vectors" may not be parallel, we will have to sum their components (X and Y constituent segments) in order to determine the final velocity of the ship. Let VoSegX and VoSegY represent the components of the initial velocity, and FSegX and FSegY represent the components of the velocity due to thrust:
VoSegX = sin(Theta) * So
VoSegY = cos(Theta) * So
FSegX = sin(Phi) * (F/m)
FSegY = cos(Phi) * (F/m)
Speed = Sqr((VoSegX + FSegX)^2 + (VoSegY + FSegY)^2)
Direction = Atn((VoSegX + FSegX)/(VoSegY + FSegY))
Keep in mind: all values must be converted to Radians for use in Visual Basic. To convert degrees to radians, simply multiply by (Pi/180).
Click here to download the source for a little spaceship simulation. It is pure VB, no DirectX, no nuthin!