Anyone know the formula used to control the movement of a simple tank-like vehicle?
To \'steer\' it, you need to alter the force applied the left and right \"wheels\
You could look at it by saying : each track describes a circle. In the case where one track is turning (lets say the left) and the other isn't, then the facing will be dependant on how long and how far the left tracks turn for.
This distance will be the speed of the tracks x time.
Now draw a triangle with this distance, and the wheelbase pencilled in, plus some sin and cos equations & approximations, and you might get an approximate equation like :
facing change = distance travelled by tracks / wheelbase
Then you could incorporate some accelleration to be more realistic: More physics...
The speed isn't constant - it accellerates (and decellerates).
ie over a period of time the speed increases from 0, to 0.1 ... 0.2 ... 0.3 up to a limit.
Of course, as the speed changes, the rate of change of the facing changes too - a bit more realistic than the speed (and thus rate of change of the facing) being entirely constant.
In other words, instead of controlling the speed, the player controls the change in speed. This would make the speed go from 0 ... 0.02 ... 0.06 ... 0.1 etc. as the player pushes the controller. Similarly for decelleration, but a bit more rapidly probably.
hope this helps.
It's not a matter of force - it depends on the difference in velocity between the 2 sides, and how long that difference holds (also the tank's width, but that's just a constant parameter).
Basically, you should calculate it along these lines:
I think everyone should also take note of the fact that tanks can turn on a Zero-radius circle: by applying the same speed on each track but on opposite directions, tanks can turn on a dime.
You're thinking about it the wrong way. The thing is, differing amounts of force on the tracks will not turn the tank a certain number of degrees. Rather, differing force will alter the RATE of turn.
The relationship between the force and the turn rate will vary depending on the mechanics of the tank. The wider the tank the slower it turns. The faster the tank the faster it turns.
P.S. Some more thoughts on this: I don't think a physics-based answer is possible without basing it off a real-world tank. Several of the answers address the physics of the turn but there is the implicit assumption in all of them that the system has infinite power. Can the tank really operate at 1, -1? And can it reach that velocity instantly--acceleration applies to turns, also.
Finally, treads have length as well as width. That means you are going to get some sideways slippage of the treads in any turning situation, the faster the turn the more such slippage will be required. That is going to burn up energy in a sharp turn, even if the engine has the power to do a 1, -1 turn it wouldn't turn as fast as that would indicate because of friction losses.