× Tutorials about Modelling and Texturing form Minecraft

Passenger Guns

  • Posts: 1793
  • Karma: 39
  • Thank you received: 52

Manus created the topic: Passenger Guns

Passenger Gun Tutorial


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
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[3][];

To define all 3 parts. The name can the chosen freely.

Then the Yaw only part (unused in this example)

m134Model[0] = new ModelRendererTurbo[0];

Then the main gun part, note the position is moved from the setRotationPoint line directly into the addBox line.

m134Model[1] = new ModelRendererTurbo[35];
m134Model[1][0] = new ModelRendererTurbo(this, 488, 150, textureX, textureY); // G1

m134Model[1][0].addBox(-7F, -4F, -2F, 8, 4, 4, 0F); // G1


Every used part requires a rotation point

for (ModelRendererTurbo gunPart : m134Model[1])
{
gunPart.setRotationPoint(12F, -26F, 0F);
}


Finally the No recoil part

m134Model[2] = new ModelRendererTurbo[0];


To use the gun as a passenger gun, it has to be registered to the model by

registerGunModel("M134", m134Model);

M134 is the name used in the config, m134Model is the gun model name used in this model.


The config

To use the gun, a passenger seat must be set up with the gun, e.g.

Passenger 4 0 15 0 core -50 50 -10 30 M134 M134

How to read:
Passenger No / X / Y / Z / Vehicle Part where the gun is located on / left limit / right limit/lower limit / upper limit/short name of the gun which is used/ register name from the model

#23032
The topic has been locked.
  • Posts: 2845
  • Karma: 44
  • Thank you received: 113

Prototype replied the topic:

So if I wanted a passenger gun on a tank turret, would I have to set a rotated offset?



Stephen King wrote: “Don't ask me silly questions
I won't play silly games
I'm just a simple choo choo train
And I'll always be the same"

#23033
The topic has been locked.
  • Posts: 1793
  • Karma: 39
  • Thank you received: 52

Manus replied the topic:

guns will not rotate with the tank turret, sorry. that the reason why i don't have guns on my tanks mounted on the turret

#23038
The topic has been locked.
  • Posts: 2845
  • Karma: 44
  • Thank you received: 113

Prototype replied the topic:

I swear I've seen tanks with that.

Or maybe I'm just insane.



Stephen King wrote: “Don't ask me silly questions
I won't play silly games
I'm just a simple choo choo train
And I'll always be the same"

#23034
The topic has been locked.
  • Posts: 1793
  • Karma: 39
  • Thank you received: 52

Manus replied the topic:

You can have tank with gun on the turret but the gun will not roate with the turret. is will remain the position which look wired when the gun is not in the center of the turret

#23040
The topic has been locked.
 
Latest Forum Posts
 
Latest Blog Posts
 
User Online
 
User Menu