Jump to content

help with model animation!


Recommended Posts

i have this model:


// Date: 05/08/2014 00:53:59
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX

package com.simon.simonsores.mobs;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;

public class Amon extends ModelBase
    ModelRenderer head;
    ModelRenderer body1;
    ModelRenderer dxarm1;
    ModelRenderer sxarm1;
    ModelRenderer dxarm2;
    ModelRenderer sxarm2;
    ModelRenderer body2;
    ModelRenderer tail1;
    ModelRenderer tail2;
    ModelRenderer tail3;
    ModelRenderer tail4;
    ModelRenderer tail5;
    ModelRenderer tail6;
    ModelRenderer tail7;
    ModelRenderer tail8;
    ModelRenderer dxarm3;
    ModelRenderer sxarm3;
  public Amon()
    textureWidth = 128;
    textureHeight = 128;
      head = new ModelRenderer(this, 96, 0);
      head.addBox(0F, 0F, 0F, 8, 8, ;
      head.setRotationPoint(0F, -17F, -31F);
      head.setTextureSize(128, 128);
      head.mirror = true;
      setRotation(head, 0F, 0F, 0F);
      body1 = new ModelRenderer(this, 92, 17);
      body1.addBox(0F, 0F, 0F, 10, 16, ;
      body1.setRotationPoint(-1F, -8F, -30F);
      body1.setTextureSize(128, 128);
      body1.mirror = true;
      setRotation(body1, 0.5948578F, 0F, 0F);
      dxarm1 = new ModelRenderer(this, 0, 82);
      dxarm1.addBox(0F, 0F, 0F, 4, 10, 4);
      dxarm1.setRotationPoint(-5F, -8F, -29F);
      dxarm1.setTextureSize(128, 128);
      dxarm1.mirror = true;
      setRotation(dxarm1, 0.1858931F, 0F, 0F);
      sxarm1 = new ModelRenderer(this, 0, 99);
      sxarm1.addBox(0F, 0F, 0F, 4, 10, 4);
      sxarm1.setRotationPoint(9F, -8F, -29F);
      sxarm1.setTextureSize(128, 128);
      sxarm1.mirror = true;
      setRotation(sxarm1, 0.1858931F, 0F, 0F);
      dxarm2 = new ModelRenderer(this, 21, 56);
      dxarm2.addBox(0F, 0F, 0F, 4, 10, 4);
      dxarm2.setRotationPoint(-5F, 1F, -27F);
      dxarm2.setTextureSize(128, 128);
      dxarm2.mirror = true;
      setRotation(dxarm2, 0F, 0F, 0F);
      sxarm2 = new ModelRenderer(this, 38, 56);
      sxarm2.addBox(0F, 0F, 0F, 4, 10, 4);
      sxarm2.setRotationPoint(9F, 1F, -27F);
      sxarm2.setTextureSize(128, 128);
      sxarm2.mirror = true;
      setRotation(sxarm2, 0F, 0F, 0F);
      dxarm3 = new ModelRenderer(this, 21, 72);
      dxarm3.addBox(0F, 0F, 0F, 4, 8, 5);
      dxarm3.setRotationPoint(-5F, 8F, -27F);
      dxarm3.setTextureSize(128, 128);
      dxarm3.mirror = true;
      setRotation(dxarm3, -0.4461433F, 0F, 0F);
      sxarm3 = new ModelRenderer(this, 21, 87);
      sxarm3.addBox(0F, 0F, 0F, 4, 8, 5);
      sxarm3.setRotationPoint(9F, 8F, -27F);
      sxarm3.setTextureSize(128, 128);
      sxarm3.mirror = true;
      setRotation(sxarm3, -0.4461433F, 0F, 0F);
      body2 = new ModelRenderer(this, 88, 42);
      body2.addBox(0F, 0F, 0F, 12, 9, ;
      body2.setRotationPoint(-2F, 3F, -22F);
      body2.setTextureSize(128, 128);
      body2.mirror = true;
      setRotation(body2, 0.4833219F, 0F, 0F);
      tail1 = new ModelRenderer(this, 0, 0);
      tail1.addBox(0F, 0F, 0F, 14, 9, ;
      tail1.setRotationPoint(-3F, 10F, -19F);
      tail1.setTextureSize(128, 128);
      tail1.mirror = true;
      setRotation(tail1, 0.7435722F, 0F, 0F);
      tail2 = new ModelRenderer(this, 0, 19);
      tail2.addBox(0F, 0F, 0F, 14, 8, ;
      tail2.setRotationPoint(-3F, 16F, -14F);
      tail2.setTextureSize(128, 128);
      tail2.mirror = true;
      setRotation(tail2, 1.003822F, 0F, 0F);
      tail3 = new ModelRenderer(this, 0, 36);
      tail3.addBox(0F, 0F, 0F, 14, 10, ;
      tail3.setRotationPoint(-3F, 20F, -9F);
      tail3.setTextureSize(128, 128);
      tail3.mirror = true;
      setRotation(tail3, 1.301251F, 0F, 0F);
      tail4 = new ModelRenderer(this, 45, 0);
      tail4.addBox(0F, 0F, 0F, 12, 10, ;
      tail4.setRotationPoint(-2F, 23F, 0F);
      tail4.setTextureSize(128, 128);
      tail4.mirror = true;
      setRotation(tail4, 1.59868F, 0F, 0F);
      tail5 = new ModelRenderer(this, 45, 19);
      tail5.addBox(0F, 0F, 0F, 10, 10, ;
      tail5.setRotationPoint(-1F, 23F, 9F);
      tail5.setTextureSize(128, 128);
      tail5.mirror = true;
      setRotation(tail5, 1.59868F, 0F, 0F);
      tail6 = new ModelRenderer(this, 45, 38);
      tail6.addBox(0F, 0F, 0F, 8, 10, 6);
      tail6.setRotationPoint(0F, 22F, 17F);
      tail6.setTextureSize(128, 128);
      tail6.mirror = true;
      setRotation(tail6, 1.59868F, 0F, 0F);
      tail7 = new ModelRenderer(this, 0, 56);
      tail7.addBox(0F, 0F, 0F, 6, 10, 4);
      tail7.setRotationPoint(1F, 21F, 24F);
      tail7.setTextureSize(128, 128);
      tail7.mirror = true;
      setRotation(tail7, 1.59868F, 0F, 0F);
      tail8 = new ModelRenderer(this, 0, 72);
      tail8.addBox(0F, 0F, 0F, 4, 5, 2);
      tail8.setRotationPoint(2F, 20F, 32F);
      tail8.setTextureSize(128, 128);
      tail8.mirror = true;
      setRotation(tail8, 1.59868F, 0F, 0F);
  public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
    super.render(par1Entity, par2, par3, par4, par5, par6, par7);
    setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
  private void setRotation(ModelRenderer model, float x, float y, float z)
    model.rotateAngleX = x;
    model.rotateAngleY = y;
    model.rotateAngleZ = z;
  public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)
    super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity);
    head.rotateAngleY = par4 / 57.29578F;
    head.rotateAngleX = par5 / 57.29578F;
    this.dxarm1.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2;
  this.dxarm1.rotateAngleY = 0.0F;
  this.sxarm1.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2;
  this.sxarm1.rotateAngleY = 0.0F;





I'm making the arms animation, I just put the addChild the I removed the renders but now I don't understund how to reset the rotation points: if the dxarm1 is -5F, -8F, -29F and dxarm2 is -5F, 1F, -27F Ihave to change dxarm2 in -0F, 9F, 2F or no? and if I change it in this, then for reset the rotation point of dxarm3 that is -5F, 8F, -27F I have to do (-5F, 8F, -27F) -  (-0F, 9F, 2F) that is (-5F, -1F, -29F) or no? I tested it in game and the arms are seen as in this picture:




another thing you can see in the picture is the head animation isn't seen good, this because the rotation point of the head is here:




so also how can I reset the rotation point of the head at the center?




Link to comment
Share on other sites


No, in this case he's asking about child parts of the model.  Child parts are the right way to do manage complex animations, but rotation points need to be changed from the Techne original rotation points.


In answer to the original question:  the rotation point of a child part is *relative* to the parent part.  So if you had an original rotation point before you made it a child, you need to subtract the parent's rotation point after you make it a child.  in other words just take the x, y, z of the rotation point and subtract the values from the parent.


Basically the child's rotation point should indicate where it is based from the parent's rotation point.  I hope you get the idea.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

then it isn't how I have told?


dxarm2 (child) -5F, 1F, -27F - dxarm1 (parent) -5F, -8F, -29F = -0F, 9F, 2F (new rotation point dxarm2) or no?


Yes, that looks like the right idea.


I find it is easiest to get the model correct by stopping all the rotations until you are sure all the rotation points are correct.  So I suggest commenting out all rotations for now to confirm that you got this part right.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

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.

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.


  • Create New...

Important Information

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