Search In
• More options...
Find results that contain...
Find results in...

# [1.17.1] Apply rotations to ModelPart in different order

## 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?

##### Share on other sites

Posted (edited)
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
##### Share on other sites

I must've struck gold if the recommendation is to use access transformers. Thanks.

## 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.

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×

• 3
• 0
• 12
• 8
• 17
• ### Who's Online (See full list)

×

• #### Activity

×
• Create New...