I created a model for a mob I was making, which has 3 legs either sides. When it came to animate it, I based it on the spider animation code and ended up with this:
However, the legs on the right (1, 5 and 7) end up sticking through my mobs body in the same direction as the other legs. Can someone tell me why this is?
I would add pictures but I'm not sure how to upload them.
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);
Head.render(f5);
Jaw.render(f5);
Leg5.render(f5);
Larm1.render(f5);
Larm2.render(f5);
Rarm1.render(f5);
Rarm2.render(f5);
BodyUp.render(f5);
Body.render(f5);
RearEnd.render(f5);
Leg8.render(f5);
Leg6.render(f5);
Leg2.render(f5);
Leg7.render(f5);
Leg1.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 f6Entity)
{
float var8 = ((float)Math.PI / 4F);
this.Leg1.rotateAngleZ = -var8;
this.Leg2.rotateAngleZ = var8;
this.Leg5.rotateAngleZ = -var8 * 0.74F;
this.Leg6.rotateAngleZ = var8 * 0.74F;
this.Leg7.rotateAngleZ = -var8;
this.Leg8.rotateAngleZ = var8;
float var9 = -0.0F;
float var10 = 0.3926991F;
this.Leg1.rotateAngleY = var10 * 2.0F + var9;
this.Leg2.rotateAngleY = -var10 * 2.0F - var9;
this.Leg5.rotateAngleY = -var10 * 1.0F + var9;
this.Leg6.rotateAngleY = var10 * 1.0F - var9;
this.Leg7.rotateAngleY = -var10 * 2.0F + var9;
this.Leg8.rotateAngleY = var10 * 2.0F - var9;
float var11 = -(MathHelper.cos(f * 0.6662F * 2.0F + 0.0F) * 0.4F) * f1;
float var12 = -(MathHelper.cos(f * 0.6662F * 2.0F + (float)Math.PI) * 0.4F) * f1;
float var13 = -(MathHelper.cos(f * 0.6662F * 2.0F + ((float)Math.PI / 2F)) * 0.4F) * f1;
float var14 = -(MathHelper.cos(f * 0.6662F * 2.0F + ((float)Math.PI * 3F / 2F)) * 0.4F) * f1;
float var15 = Math.abs(MathHelper.sin(f * 0.6662F + 0.0F) * 0.4F) * f1;
float var16 = Math.abs(MathHelper.sin(f * 0.6662F + (float)Math.PI) * 0.4F) * f1;
float var17 = Math.abs(MathHelper.sin(f * 0.6662F + ((float)Math.PI / 2F)) * 0.4F) * f1;
float var18 = Math.abs(MathHelper.sin(f * 0.6662F + ((float)Math.PI * 3F / 2F)) * 0.4F) * f1;
this.Leg1.rotateAngleY += var11;
this.Leg2.rotateAngleY += -var11;
this.Leg5.rotateAngleY += var13;
this.Leg6.rotateAngleY += -var13;
this.Leg7.rotateAngleY += var14;
this.Leg8.rotateAngleY += -var14;
this.Leg1.rotateAngleZ += var15;
this.Leg2.rotateAngleZ += -var15;
this.Leg5.rotateAngleZ += var17;
this.Leg6.rotateAngleZ += -var17;
this.Leg7.rotateAngleZ += var18;
this.Leg8.rotateAngleZ += -var18;
However, the legs on the right (1, 5 and 7) end up sticking through my mobs body in the same direction as the other legs. Can someone tell me why this is?
I would add pictures but I'm not sure how to upload them.
