Jump to content

[1.7.10] need help binding my .obj armor model to the player movement


Recommended Posts

Posted

I have rendered the armor piece, everything is in its place, the only problem i have with this is that i dont know how to bind the armor to the player movement like when you sneak your torso leans forward, but the armor stands still, also the arms of the torso are separate models, i know they wont just swing without me telling them to(even though i have not made those arm models yet, they will come after i have figured this out :) ).

All i have managed to do is to change the rotation and position of the torso, by adding an if statement, but this wont work as well with the head, and it doesnt even toggle while sneaking, it just toggles while holding down shift.

pls help if you can :)

 

and here.. is the file i render the model onto the player with, in case you need it.

and btw, i haven't rotated the model properly in the if statement, just played around with it a bit.

 

 

@SideOnly(Side.CLIENT)
public class renderBandosChestplate extends ModelBiped {
    private final ModelBandosChestplate modelBandosChestplate;

    public renderBandosChestplate() {
        super();
        modelBandosChestplate = new ModelBandosChestplate();
    }

    public void render(Entity entity, float f, float f1, float f2, float f3, float  f4, float f5) {
        if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
            GL11.glPushMatrix();
            GL11.glScalef(0.5F, 0.45F, 0.5F);
            GL11.glRotatef(180.0F, 1.5F, 1.0F, -1.0F);
            GL11.glTranslatef(0.0F, -4.0F, 0.0F);
            FMLClientHandler.instance().getClient().renderEngine.bindTexture(textures.model.BANDOS_CHESTPLATE);
            modelBandosChestplate.render();
            GL11.glPopMatrix();
        } else {
            GL11.glPushMatrix();
            GL11.glScalef(0.5F, 0.45F, 0.5F);
            GL11.glRotatef(180.0F, 1.0F, 0.0F, -1.0F);
            GL11.glTranslatef(0.0F, -4.0F, 0.0F);
            FMLClientHandler.instance().getClient().renderEngine.bindTexture(textures.model.BANDOS_CHESTPLATE);
            modelBandosChestplate.render();
            GL11.glPopMatrix();
        }
    }
}

 

 

thank you.

 

i think it is something with the .addChild function, but i couldnt make it work :D

Posted

My computer doesn't like your avatar, it's fan is speeding up. :) But in fact I like it.

 

I don't have any experience with this problem, all I know is that .addChild methods can be a pain. I have just mastered .obj models for blocks (and have made a tutorial for such) and might be able to help. So, you said the arms and the torso are a separate model? That might help you. :) Please post your code, I have an idea. It will probably involve GL11.

Posted

Oh lol, I didn't notice your spoiler with code inside. :)

Posted

So, when you press shift in-game the armor doesn't rotate at all?

Posted

My computer doesn't like your avatar, it's fan is speeding up. :) But in fact I like it.

 

thank you :P

 

So, when you press shift in-game the armor doesn't rotate at all?

no, it doesnt, unless i use that if statement, which really only solves the sneaking problem, not the arms.

Posted

Ya, that could work, but I don't think the ObjModel class you're referring to exists. I think you mean ICustomModel. :)

Posted

no, not yet

Ok, so go to your class that extends ModelBiped, where you render your piece of armor. Go to constructor, and add:

	final IModelCustom objModel = AdvancedModelLoader.loadModel(objModelResource);
	ModelRenderer objModelAttach = new ModelRenderer(this){
		@Override
		public void render(float f) {
			objModel.renderAll();
		}
	};
	//set offset here
	bipedHead.addChild(objModelAttach);

This is code with correct names...

This should work...

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.