Jump to content

Recommended Posts

Posted

I have been working with custom models for a while now, and Its only until now I have been stumped, I did a lot of Trial and error and worked out part of the issue but some still remain. Anyways, the problem is making the leaves move with the head as a whole, I have got the nose to do it but I just cant get the leaves to do it.

package com.phantasyrealms.model;

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

public class ModelPoisonLilyMob extends ModelBase
{
  //fields
    ModelRenderer head;
    ModelRenderer body;
    ModelRenderer nose;
    ModelRenderer Leaf1;
    ModelRenderer Base;
    ModelRenderer Leaf2;
    ModelRenderer Leaf3;
  
  public ModelPoisonLilyMob()
  {
    textureWidth = 64;
    textureHeight = 32;
    
      head = new ModelRenderer(this, 0, 0);
      head.addBox(-4F, -8F, -7F, 8, 8, ;
      head.setRotationPoint(0F, -7F, -1F);
      head.setTextureSize(64, 32);
      head.mirror = true;
      setRotation(head, 0F, 0F, 0F);
      body = new ModelRenderer(this, 56, -1);
      body.addBox(-1F, 0F, -1F, 2, 30, 2);
      body.setRotationPoint(0F, -7F, 0F);
      body.setTextureSize(64, 32);
      body.mirror = true;
      setRotation(body, 0F, 0F, 0F);
      nose = new ModelRenderer(this, 32, 6);
      nose.addBox(-2F, -6F, -15F, 4, 4, ;
      nose.setRotationPoint(0F, -7F, -1F);
      nose.setTextureSize(64, 32);
      nose.mirror = true;
      setRotation(nose, 0F, 0F, 0F);
      Leaf1 = new ModelRenderer(this, 37, 19);
      Leaf1.addBox(-6F, 6F, -3F, 6, 10, 1);
      Leaf1.setRotationPoint(0F, -7F, -1F);
      Leaf1.setTextureSize(64, 32);
      Leaf1.mirror = true;
      setRotation(Leaf1, -2.792527F, 0F, 0.9250245F);
      Base = new ModelRenderer(this, 0, 18);
      Base.addBox(-6F, -1F, -6F, 12, 2, 12);
      Base.setRotationPoint(0F, 23F, 0F);
      Base.setTextureSize(64, 32);
      Base.mirror = true;
      setRotation(Base, 0F, 0F, 0F);
      Leaf2 = new ModelRenderer(this, 37, 19);
      Leaf2.addBox(0F, 6F, -3F, 6, 10, 1);
      Leaf2.setRotationPoint(0F, -7F, -1F);
      Leaf2.setTextureSize(64, 32);
      Leaf2.mirror = true;
      setRotation(Leaf2, -2.792527F, 0F, -0.9250245F);
      Leaf3 = new ModelRenderer(this, 37, 19);
      Leaf3.addBox(-3F, 0F, -1F, 6, 10, 1);
      Leaf3.setRotationPoint(0F, -7F, -1F);
      Leaf3.setTextureSize(64, 32);
      Leaf3.mirror = true;
      setRotation(Leaf3, -0.418879F, 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);
    head.render(f5);
    body.render(f5);
    nose.render(f5);
    Leaf1.render(f5);
    Base.render(f5);
    Leaf2.render(f5);
    Leaf3.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 p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_)
  {
  float f6 = (180F / (float)Math.PI);	  
  this.head.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI);
      this.head.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI);
      this.nose.rotateAngleX = this.head.rotateAngleX;
      this.nose.rotateAngleY = this.head.rotateAngleY;
      this.Leaf1.rotateAngleX = this.head.rotateAngleX;
      this.Leaf1.rotateAngleY = this.head.rotateAngleY;
      this.Leaf2.rotateAngleX = this.head.rotateAngleX;
      this.Leaf2.rotateAngleY = this.head.rotateAngleY;
      this.Leaf3.rotateAngleX = this.head.rotateAngleX;
      this.Leaf3.rotateAngleY = this.head.rotateAngleY;


  }

}

 

It is suppose to look like this

https://docs.google.com/document/d/1Wo2BtzfXjKHsbRPiAQ39DxPQb8CrX1B2ZLE-ux9HbaU/edit

 

Instead it looks like this

https://docs.google.com/document/d/19T9rCgbAHni5z14ugwJIGupIXKxa5ojlTmVfhvs1ymQ/edit

Posted

Because the leaves had initial rotations on them that you're overwriting when it animates.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
setRotation(head, 0F, 0F, 0F); //angle X = 0
setRotation(Leaf1, -2.792527F, 0F, 0.9250245F); //angle X = -2.79, not the same
...
this.Leaf1.rotateAngleX = this.head.rotateAngleX; //make them the same

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Alright so I get that, now I dont know what to do about it, In the Techne I positioned the rotation point in the same spot, when I did that with the nose and then set it to the head it worked just fine. and then before I set the rotation point to the same as the head it was the same problem. So should I again adjust the model of it?

Posted

Alright so I get that, now I dont know what to do about it, In the Techne I positioned the rotation point in the same spot, when I did that with the nose and then set it to the head it worked just fine. and then before I set the rotation point to the same as the head it was the same problem. So should I again adjust the model of it?

 

Because they have DIFFERENT BASE ROTATIONS. It had Jack Fucking Squat to do with the rotation POINT, but everything to do with the rotation VALUE. The head and nose use the same values, the leaves DON'T.

 

Also what coolAlias said.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.