public void setRotationAngles( float par1, float par2, float par3, float par4, float par5, float par6) { // head.rotateAngleX = par5 / (180F / (float)Math.PI); head.rotateAngleY = par4 / (180F / (float) Math.PI); body.rotateAngleX = ((float) Math.PI / 2F); leg1.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.2F * par2; leg2.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float) Math.PI) * 1.2F * par2; leg3.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float) Math.PI) * 1.2F * par2; leg4.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.2F * par2; }
/** Sets the models various rotation angles. */ public void setRotationAngles( float par1, float par2, float par3, float par4, float par5, float par6) { field_40340_a.rotateAngleY = par4 / (180F / (float) Math.PI); field_40340_a.rotateAngleX = par5 / (180F / (float) Math.PI); field_40339_c.rotationPointY = 3F; field_40339_c.rotationPointZ = -1F; field_40339_c.rotateAngleX = -0.75F; field_40336_d.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2 * 0.5F; field_40337_e.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float) Math.PI) * 1.4F * par2 * 0.5F; field_40336_d.rotateAngleY = 0.0F; field_40337_e.rotateAngleY = 0.0F; }
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { float f6 = f2 * 3.141593F * -0.1F; for (int i = 0; i < 4; i++) { field_40323_a[i].rotationPointY = -2F + MathHelper.cos(((float) (i * 2) + f2) * 0.25F); field_40323_a[i].rotationPointX = MathHelper.cos(f6) * 9F; field_40323_a[i].rotationPointZ = MathHelper.sin(f6) * 9F; f6 += 1.570796F; } f6 = 0.7853982F + f2 * 3.141593F * 0.03F; for (int j = 4; j < 8; j++) { field_40323_a[j].rotationPointY = 2.0F + MathHelper.cos(((float) (j * 2) + f2) * 0.25F); field_40323_a[j].rotationPointX = MathHelper.cos(f6) * 7F; field_40323_a[j].rotationPointZ = MathHelper.sin(f6) * 7F; f6 += 1.570796F; } f6 = 0.4712389F + f2 * 3.141593F * -0.05F; for (int k = 8; k < 12; k++) { field_40323_a[k].rotationPointY = 11F + MathHelper.cos(((float) k * 1.5F + f2) * 0.5F); field_40323_a[k].rotationPointX = MathHelper.cos(f6) * 5F; field_40323_a[k].rotationPointZ = MathHelper.sin(f6) * 5F; f6 += 1.570796F; } field_40322_b.rotateAngleY = f3 / 57.29578F; field_40322_b.rotateAngleX = f4 / 57.29578F; }
private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; }
public ThxModelHelicopter() { renderTexture = "/thx/helicopter.png"; ENABLE_ROTOR = mod_Thx.getBoolProperty("enable_rotor"); // All model boxes are now scaled x2 at rendering time to save texture space // (with the exception of the windsheield which is already min size) bottom: { // 1. to save texture space, create piece in upright orientation // 2. then we have to rotate piece back into place // 3. make half size and then scale later to save texture area // 4. also have to adjust ("reduce") position (rotationPt) since it moves when we scale float length = 10f; float height = 8f; float width = 2f; bottom = new ModelRenderer(this, 0, 22); // texture offset: bottom.addBox( -length / 2f, -height / 2f, -width / 2f, (int) length, (int) height, (int) width); bottom.setRotationPoint( 0f * centerScale, 2f * centerScale, 0f * centerScale); // halved to adjust for scale bottom.rotateAngleX = PI / 2f; // 90 deg roll left to lay flat } frontWall: { // rotate about Y, so 2x6x20 -> 20x6x2 // will be scaled x2 at render float length = 10f; float height = 3f; float width = 1f; frontWall = new ModelRenderer(this, 0, 4); frontWall.addBox( -length / 2f, -height / 2f, -width / 2f, (int) length, (int) height, (int) width); frontWall.setRotationPoint( -5.5f * centerScale, 0f * centerScale, 0f * centerScale); // placed 11 unit in front frontWall.rotateAngleY = PI * 1.5f; // 270 deg yaw } backWall: { // will be scaled x2 at render float length = 10f; float height = 3f; float width = 1f; backWall = new ModelRenderer(this, 0, 9); backWall.addBox( -length / 2f, -height / 2f, -width / 2f, (int) length, (int) height, (int) width); backWall.setRotationPoint(5.5f * centerScale, 0f * centerScale, 0f * centerScale); backWall.rotateAngleY = PI / 2f; // 90 deg yaw } leftWall: { // will be scaled x2 at render float length = 10f; float height = 3f; float width = 1f; leftWall = new ModelRenderer(this, 25, 19); leftWall.addBox( -length / 2f, -height / 2f, -width / 2f, (int) length, (int) height, (int) width); leftWall.setRotationPoint(0f * centerScale, 0f * centerScale, -4.5f * centerScale); } rightWall: { // will be scaled x2 at render float length = 10f; float height = 3f; float width = 1f; rightWall = new ModelRenderer(this, 25, 24); rightWall.addBox( -length / 2f, -height / 2f, -width / 2f, (int) length, (int) height, (int) width); rightWall.setRotationPoint(0f * centerScale, 0f * centerScale, 4.5f * centerScale); rightWall.rotateAngleY = PI; // flip 180 deg so decal is on outside } mainRotor: { // will be scaled x2 at render float length = 30f; float height = 0f; float width = 1f; mainRotor = new ModelRenderer(this, 0, 0); mainRotor.addBox( -length / 2f, -height / 2f, -width / 2f, (int) length, (int) height, (int) width); mainRotor.setRotationPoint( 2f * centerScale, -11.7f * centerScale, 0f * centerScale); // halved to adjust for scale, and a little subtracted } tailRotor: { // will be scaled x2 at render float length = 8f; float height = 1f; float width = 0f; tailRotor = new ModelRenderer(this, 0, 2); tailRotor.addBox( -length / 2f, -height / 2f, -width / 2f, (int) length, (int) height, (int) width); tailRotor.setRotationPoint(16f * centerScale, -7f * centerScale, .7f * centerScale); } tail: { // will be scaled x2 at render float length = 10f; float height = 2f; float width = 1f; tail = new ModelRenderer(this, 42, 29); tail.addBox(-length / 2f, -height / 2f, -width / 2f, (int) length, (int) height, (int) width); tail.setRotationPoint(12f * centerScale, -7f * centerScale, 0f * centerScale); } rotorVerticalSupport: { // will be scaled x2 at render float length = 1f; float height = 11f; float width = 2f; rotor2 = new ModelRenderer(this, 58, 11); rotor2.addBox( -length / 2f, -height / 2f, -width / 2f, (int) length, (int) height, (int) width); rotor2.setRotationPoint(6.5f * centerScale, -5f * centerScale, 0f * centerScale); } rotorHorizontalSupport: { // will be scaled x2 at render float length = 6f; float height = 1f; float width = 2f; rotor3 = new ModelRenderer(this, 48, 25); rotor3.addBox( -length / 2f, -height / 2f, -width / 2f, (int) length, (int) height, (int) width); rotor3.setRotationPoint(4f * centerScale, -11f * centerScale, 0f * centerScale); } windshield: { float length = 9f; float height = 7f; float width = 0f; windshield = new ModelRenderer(this, 22, 2); windshield.addBox( -length / 2f, -height / 2f, -width / 2f, (int) length, (int) height, (int) width); windshield.setRotationPoint(-5.5f * centerScale, -4.5f * centerScale, 0f * centerScale); windshield.rotateAngleY = PI * 1.5f; // 270 deg yaw } }