How to setup units with turrets?

If you have a unit, for example, a tank, you, of course, want its turret to aim targets. To setup it, you need to check Has Turret toggle in the Unit Data, and setup Turret Rotation Speed greater than 0.

../../_images/turret-setup.png

Next step is setting up of prefab. There is one important thing. Turret of your unit model should have correct pivot. It should have aimed in the Z-axis direction, same to Unity. How to check it? Select turret of your unit, select Pivot & Local at top of the Unity Window:

../../_images/turret-pivot-setup.png

And check that turret aimed same to blue arrow:

../../_images/turret-pivot-setup-2.png

If it isn’t correct, you can fix it in any modelling application like Blender, 3ds Max, Maya, etc.

Next step is setting up the prefab of unit. If you’re generated it automatically it should be already setted up, to validate it select prefab and check Tower module parameters:

../../_images/turret-module-setup.png

Turret Transform field should contain bone of your turret or turret model itself, depends on your modelling pipeline. That’s all, now the unit turret should work.

Note

The UnitData Has Attack Module parameter also should be enabled.