Tank Controls

Blitz3D Forums/Blitz3D Beginners Area/Tank Controls

I'm not sure I'm following what you're trying to achieve and can't try out your code because of dependencies, but I'll put my tuppence in, in case it's of help as I've recently done a tanks game along these lines (http://www.bankie.com/games/tanks/tanksonline.php).

What I wanted to do was make the turret turn towards the mouse pointer (which appears as a crosshair on the ground), and the tank move using cursors keys (or whatever). Left and right keys to rotate the tank, and up/down to move forwards/backwards. To achieve this, I didn't use pivots, but made the turret a child of the hull. Left/right keys caused a TurnEntity hull command. Up/down keys caused a MoveEntity hull command. The position of the mouse cursor and some simple trigonometry was used to calculate the rotational angle of the turret (RotateEntity).

Hope that's of some help.