Copyright VirtualSim 2004-2020 - All rights reserved
Setting up the Tank
We want our tank to be able to shoot the main gun manually and automatically.
We will import a predefined Logic (from the Shared library of stuff) which does that.
Select Environment::Logics then import a new Logic with a left click on the background:
and in folder Shared/VBS-IG, select Tank.lgk
Once imported, give it to our m1a1 tank (select the Logic, right-click, give it to...) :
If we open the TankLogic, we can find three interesting parts inside the ControlGroup:
CameraCtrl: not used here but already set up to allow the camera to be positioned inside the tank and being aligned with the main gun and turret.
TurretCtrl: listens to the Player gamepad (only when entity is focused and activated) and orients the turret heading and main gun elevation according to the gamepad right stick. Right button fire the main gun.
EngineCtrl: same as TurretCtrl but use the gamepad right stick to accelerate and decelerate (up and down) or steer (right and left)
Use gamepad A (green) button to switch from TurretCtrl to EngineCtrl when focused is on the tank.
Now, recompile and run. Once focus, use the gamepad to move the turret and the camera to remain positioned behind. Try to shoot against the little hill.