Vector math problem

BlitzMax Forums/BlitzMax Programming/Vector math problem

A simple dragforce could be calculated like this...

force = force - Dampingconstant * Velocity
[Basically the same damping often applied to springs]

There force is the current force acting on the tank and velocity of course is the speed of the tank.

So all in all it could look like this...

TotalForce = 0
TotalForce = TotalForce + ThrusterForce
DragForce = AirFrictionConstant * TankVelocity
TotalForce = TotalForce - DragForce

TankAcceleration = TotalForce/TankMass
TankVelocity = TankVelocity + TankAcceleration
TankPosition = TankPosition + TankVelocity

Depending on the AirFrictionConstant, the Dragforce will eventually cancel out the Thrusterforce when the velocity gets high enough.

A more correct dragforce calculation would also consider the area of the object but that is another story.