Formula for controlling the movement of a tank-like vehicle?

前端 未结 10 1719
情话喂你
情话喂你 2021-01-05 18:13

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\

10条回答
  •  生来不讨喜
    2021-01-05 18:31

    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.

提交回复
热议问题