Jump to content

[Solved][1.10.2] Matrix multiplying doesn't affect model size


TPD

Recommended Posts

This is what my IBakedModel::handlePerspective() method looks like:

 

    @Override
    public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
        switch (cameraTransformType) {
            case THIRD_PERSON_RIGHT_HAND:
                Matrix4f transform = new Matrix4f();
                transform.setIdentity();
                float degree90 = (float)(Math.PI/2);
                transform.mul(0.1F);
                transform.rotX(degree90);
                transform.rotZ(degree90);
                transform.rotY(degree90);
                return Pair.of(this, transform);
        }

        return Pair.of(this, null);
    }

 

The model rotates correctly but its size doesn't change. What am I doing wrong?

Link to comment
Share on other sites

That's what I was thinking aswell, but it doesn't seem to make a difference:

 

      Matrix4f scale = new Matrix4f(
          0.1F,   0,      0,      0,
          0,      0.1F,   0,      0,
          0,      0,      0.1F,   0,
          0,      0,      0,      1
      );
      transform.mul(scale);

 

Still the same size

Link to comment
Share on other sites

Ok. I found the problem.

The rot methods in Matrix4f set m00 and m33 (first element in first row, last element in last row) to 1. I had to first rotate it and then multiply it by 0.1 and finally set m33 back to 1.

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.