Jump to content

[1.17.1] Apply rotations to ModelPart in different order


Anrza

Recommended Posts

Hello! I want to add tilted ears to some animals. Under ideal circumstances, I'd just modelPart.zRot = t. However, the rotation around the z axis is applied before the other rotations, which makes a big mess of everything.

As far as I can tell, transformation of the matrix M represented by the PoseStack to the result R depending on the rotation matrices X, Y, Z and the translation matrix P is applied as such: R=XYZPM. My solution prior to 1.17 was to extend ModelRenderer and apply the transformations in the order ZXYPM - solving the problem very simply. But since ModelPart - the 1.17 counterpart to the old ModelRenderer - is final, I see no such simple solution.

I see two possible approaches:

  1. Denote T=XYZP. Apply T^-1(ZXYP) to the PoseStack before I ModelPart#render. The ModelPart will then apply T, resulting in my desired ZXYP  transformation. No problem in theory, but quite convoluted in practice.
  2. Consider Z(z)X(x)Y(y). Do some linear algebra and trigonometry to find out (s,t,u) such that X(s)Y(t)Z(u)=Z(z)X(x)Y(y), then ModelPart#setRotation(s,t,u). I haven't done the math on this, so I'm not sure how feasible this is.

Anyone got a simpler solution? Or should I rather do a feature request to make ModelPart not final?

Link to comment
Share on other sites

7 hours ago, Anrza said:

My solution prior to 1.17 was to extend ModelRenderer and apply the transformations in the order ZXYPM - solving the problem very simply. But since ModelPart - the 1.17 counterpart to the old ModelRenderer - is final

you can use Access Transformer to remove the final modifier from the class

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