Jump to content

Recommended Posts

Posted

I am trying to make the legs on my mob move at different times but they all move at once.

Mob Code:

 

public class ModelMob extends ModelBase

{

//fields

ModelRenderer horn1;

ModelRenderer horn4;

ModelRenderer horn5;

ModelRenderer horn6;

ModelRenderer head;

ModelRenderer body;

ModelRenderer leg1;

ModelRenderer leg2;

ModelRenderer leg3;

ModelRenderer leg4;

ModelRenderer neck;

ModelRenderer horn2;

ModelRenderer tail;

ModelRenderer horn3;

ModelRenderer nose;

 

public ModelMob()

{

this.textureWidth = 64;

this.textureHeight = 64;

 

this.horn1 = new ModelRenderer(this, 44, 0);

this.horn1.addBox(0F, 0F, 0F, 1, 3, 1);

this.horn1.setRotationPoint(-2F, -3F, -9F);

this.horn1.setTextureSize(64, 64);

this.horn1.mirror = true;

  setRotation(horn1, 0.4089647F, 0F, 0F);

  this.horn4 = new ModelRenderer(this, 41, 0);

  this.horn4.addBox(0F, 0F, 0F, 1, 1, 4);

  this.horn4.setRotationPoint(-2F, -3.5F, -12F);

  this.horn4.setTextureSize(64, 64);

  this.horn4.mirror = true;

  setRotation(horn4, 0F, 0F, 0F);

  this.horn5 = new ModelRenderer(this, 41, 0);

  this.horn5.addBox(0F, 0F, 0F, 1, 2, 1);

  this.horn5.setRotationPoint(-2F, -5F, -11F);

  this.horn5.setTextureSize(64, 64);

  this.horn5.mirror = true;

  setRotation(horn5, 0F, 0F, 0F);

  this.horn6 = new ModelRenderer(this, 41, 0);

  this.horn6.addBox(0F, 0F, 0F, 1, 2, 1);

  this.horn6.setRotationPoint(1F, -5F, -11F);

  this.horn6.setTextureSize(64, 64);

  this.horn6.mirror = true;

  setRotation(horn6, 0F, 0F, 0F);

  this.head = new ModelRenderer(this, 0, 0);

  this.head.addBox(-4F, -4F, -6F, 4, 4, 8);

  this.head.setRotationPoint(2F, 4F, -7.5F);

  this.head.setTextureSize(64, 64);

  this.head.mirror = true;

  setRotation(head, 0.3717861F, 0F, 0F);

  this.body = new ModelRenderer(this, 26, 6);

  this.body.addBox(-3F, -10F, -7F, 6, 18, 6);

  this.body.setRotationPoint(0F, 7F, 1F);

  this.body.setTextureSize(64, 64);

  this.body.mirror = true;

  setRotation(body, 1.570796F, 0F, 0F);

  this.leg1 = new ModelRenderer(this, 0, 16);

  this.leg1.addBox(-3F, 0F, -2F, 2, 10, 2);

  this.leg1.setRotationPoint(0F, 14F, 7F);

  this.leg1.setTextureSize(64, 64);

  this.leg1.mirror = true;

  setRotation(leg1, 0F, 0F, 0F);

  this.leg2 = new ModelRenderer(this, 0, 16);

  this.leg2.addBox(-1F, 0F, -2F, 2, 10, 2);

  this.leg2.setRotationPoint(2F, 14F, 7F);

  this.leg2.setTextureSize(64, 64);

  this.leg2.mirror = true;

  setRotation(leg2, 0F, 0F, 0F);

  this.leg3 = new ModelRenderer(this, 0, 16);

  this.leg3.addBox(-3F, 0F, -3F, 2, 10, 2);

  this.leg3.setRotationPoint(0F, 14F, -5F);

  this.leg3.setTextureSize(64, 64);

  this.leg3.mirror = true;

  setRotation(leg3, 0F, 0F, 0F);

  this.leg4 = new ModelRenderer(this, 0, 16);

  this.leg4.addBox(-1F, 0F, -3F, 2, 10, 2);

  this.leg4.setRotationPoint(2F, 14F, -5F);

  this.leg4.setTextureSize(64, 64);

  this.leg4.mirror = true;

  setRotation(leg4, 0F, 0F, 0F);

  this.neck = new ModelRenderer(this, 52, 0);

  this.neck.addBox(-2F, -3F, 0F, 2, 4, 6);

  this.neck.setRotationPoint(1F, 9F, -6F);

  this.neck.setTextureSize(64, 64);

  this.neck.mirror = true;

  setRotation(neck, 1.793868F, 0F, 0F);

  this.horn2 = new ModelRenderer(this, 44, 0);

  this.horn2.addBox(0F, 0F, 0F, 1, 3, 1);

  this.horn2.setRotationPoint(1F, -3F, -9F);

  this.horn2.setTextureSize(64, 64);

  this.horn2.mirror = true;

  setRotation(horn2, 0.4089613F, 5.1E-06F, 0F);

  tail = new ModelRenderer(this, 27, 0);

  this.tail.addBox(0F, 0F, 0F, 2, 3, 1);

  this.tail.setRotationPoint(-1F, 9F, 8F);

  this.tail.setTextureSize(64, 64);

  this.tail.mirror = true;

  setRotation(tail, 0.632033F, 0F, 0F);

  this.horn3 = new ModelRenderer(this, 41, 0);

  this.horn3.addBox(0F, 0F, 0F, 1, 1, 4);

  this.horn3.setRotationPoint(1F, -3.5F, -12F);

  this.horn3.setTextureSize(64, 64);

  this.horn3.mirror = true;

  setRotation(horn3, 0F, 0F, 0F);

  this.nose = new ModelRenderer(this, 10, 16);

  this.nose.addBox(0F, 0F, 0F, 2, 2, 1);

  this.nose.setRotationPoint(-1F, 4F, -15F);

  this.nose.setTextureSize(64, 64);

  this.nose.mirror = true;

  setRotation(nose, 0.4089647F, 0F, 0F);

}

 

public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)

{

super.render(entity, f, f1, f2, f3, f4, f5);

setRotationAngles(f, f1, f2, f3, f4, f5, entity);

this.horn1.render(f5);

this.horn4.render(f5);

this.horn5.render(f5);

this.horn6.render(f5);

this.head.render(f5);

this.body.render(f5);

this.leg1.render(f5);

this.leg2.render(f5);

this.leg3.render(f5);

this.leg4.render(f5);

this.neck.render(f5);

this.horn2.render(f5);

this.tail.render(f5);

this.horn3.render(f5);

this.nose.render(f5);

}

 

private void setRotation(ModelRenderer model, float x, float y, float z)

{

model.rotateAngleX = x;

model.rotateAngleY = y;

model.rotateAngleZ = z;

}

 

public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)

{

super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);

this.leg1.rotateAngleX = (MathHelper.cos(f * 0.8F) * f1 / 1.5F);

this.leg3.rotateAngleX = (MathHelper.cos(f * 0.8F) * f1 / 1.5F);

this.leg2.rotateAngleX = (MathHelper.cos(f * 0.8F) * f1 / 1.5F);

this.leg4.rotateAngleX = (MathHelper.cos(f * 0.8F) * f1 / 1.5F);

}

 

}

 

Posted

Hi

 

I'm not sure I understand your question.

 

Your code has this in it:

 this.leg1.rotateAngleX = (MathHelper.cos(f * 0.8F) * f1 / 1.5F);
this.leg3.rotateAngleX = (MathHelper.cos(f * 0.8F) * f1 / 1.5F);
this.leg2.rotateAngleX = (MathHelper.cos(f * 0.8F) * f1 / 1.5F);
this.leg4.rotateAngleX = (MathHelper.cos(f * 0.8F) * f1 / 1.5F);

If you don't want all your legs to move at once, why are you setting them all to be exactly the same?

Look at ModelQuadruped.setRotationAngles() for some ideas on how you might change it...

 

-TGG

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.