Jump to content

[1.12.2] Setting model parts as children of other model parts without resizing them


nil

Recommended Posts

My own experience of this, attempting to create babies with enlarged heads for my custom entities, was that I could call poster render method to "connect" the head to the body without making it a child. It would move correctly as if a child model box, but the animation for the scaled box would also be scaled up so the head would animate in an exaggerated fashion compared to the rest of the body and therefore not be completely in sync. It occurred to me to try scaling the animation, but I never actually tried it.

Link to comment
Share on other sites

On 10/17/2019 at 11:38 PM, salvestrom said:

I could call poster render method to "connect" the head to the body without making it a child

do you mean setting the model parts rotationPoints and rotationAngles to the parent parts?

Link to comment
Share on other sites

On 10/17/2019 at 10:25 AM, nil said:

Is it possible to add a model part to another model parts child list while keeping its custom scale?

I think you can create the part with size values multiplied by (child's custom scale / parent's scale), and then add that part as a child. I haven't done much with entity rendering, though, so keep that in mind.

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

Link to comment
Share on other sites

6 hours ago, nil said:

do you mean setting the model parts rotationPoints and rotationAngles to the parent parts?

            GlStateManager.pushMatrix();
            
            GlStateManager.scale(0.75F, 0.75F, 0.75F);
            GlStateManager.translate(0, 16.0F * scale, 3 * scale);

            this.lowerbody.postRender(0.0625F);
            this.upperbody.postRender(0.0625F);
            this.neck.postRender(0.0625F);

            this.head1.render(scale);

            GlStateManager.popMatrix();
            GlStateManager.pushMatrix();
            GlStateManager.scalef(0.5F, 0.5F, 0.5F);
            GlStateManager.translatef(0.0F, 24.0F * scale, 0.0F);
            this.lowerbody.render(scale); 
            GlStateManager.popMatrix(); 

The above was being done in the render method of the model class. Note that neck is a child of upperbody which is a child of lower body, but head1 is not a child of the neck.

Although the head will move as the body rotates, this failed because the animations are scaled up with the size of the head, so the head will move in an exaggerated fashion due to things like breathing animations.

Link to comment
Share on other sites

Both things actually work:

 

Apparently postrendering a part makes the part rendered afterwards "connected" like in salvestroms example, however i'm not having any issues like this:

On 10/25/2019 at 6:07 AM, salvestrom said:

animations are scaled up with the size of the head, so the head will move in an exaggerated fashion due to things like breathing animations.

 

Also you can do this:

On 10/25/2019 at 3:35 AM, SerpentDagger said:

I think you can create the part with size values multiplied by (child's custom scale / parent's scale), and then add that part as a child.

By calling addChild in the render method however it still rescales the part.

Edited by nil
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.

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.