In these small tutorial I’ll show how passenger guns are working. It’s quite easy so it will be a short tutorial.
The model has to build like tank barrels around 0/0/0, means its build at the zero point and placed with a general setRotationPoint variable.
The gun model must build in the direction barrel to the left, which means is goes with the red arrow (like cars and tanks). It makes no difference which direction the gun should have on the finished model, the direction on board is given by the config file.
Every gun model is built as a 2 dimensional array (like propellers) and can have 3 different parts, every part with as much boxes etc. as needed.
1. Yaw Only model – The parts of the gun which is moving left/right when the gun is moved (e.g. the gunner turret)
2. Gun model with recoil – The parts of the gun which are moving left/right and up/down when the gun is moving
3. Gun model without recoil – The parts of the gun which are moving left/right and up/down when the gun is moving
Every part can rotate around a different point.
Build the model is easy, we start with
ModelRendererTurbo m134Model = new ModelRendererTurbo;
To define all 3 parts. The name can the chosen freely.
Then the Yaw only part (unused in this example)
m134Model = new ModelRendererTurbo;
Then the main gun part, note the position is moved from the setRotationPoint line directly into the addBox line.