Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

models:partToWorldMatrix() does not update #215

Open
Gakuto1112 opened this issue May 5, 2024 · 7 comments
Open

models:partToWorldMatrix() does not update #215

Gakuto1112 opened this issue May 5, 2024 · 7 comments

Comments

@Gakuto1112
Copy link

Gakuto1112 commented May 5, 2024

Description

models:getModelWorldPos() models:partToWorldMatrix() does not update its matrix in first person perspective if the model's parent type is Item.

This issue does not occur if the parent type of the model is not item or in third person perspective.

How to reproduce

  1. Set the parent type of a model to Item.
  2. Get the matrix of the Item model with models:getModelWorldPos() models:partToWorldMatrix() in first person perspective.
  3. You will see that the matrix will not update and remain in the same state as it was in third person perspective.

I attached the example avatar that describes this issue.

This avatar has two anchors that emit particles. One is at the top of the player head and emits green particles, and another one is at the item that the player holds and emits red particles. In first person perspective, green particles are following their anchor. However, red particles are standing still in the place where they were last in the third-person perspective.

The image that describes this issue

Expected behavior

The item model matrix will update even if in first person perspective. In case of the example avatar, red particles still follow in first person perspective.

Enviroments

Item Version
Minecraft 1.20.1
Fabric Loader 0.15.7
Fabric API 0.92.1+1.20.1
Figura 0.1.4+1.20.1

No other mod installed.

Attachments

TestAvatar.zip

@4P5
Copy link
Contributor

4P5 commented May 5, 2024

Do you mean partToWorldMatrix()? getModelWorldPos() isn't a method in Figura

@kcin2001
Copy link

kcin2001 commented May 5, 2024

theres also an option to update the matrix in first person

@Gakuto1112
Copy link
Author

Gakuto1112 commented May 5, 2024

Do you mean partToWorldMatrix()? getModelWorldPos() isn't a method in Figura

Oh sorry. You are right. models:getModelWorldPos() is a self-defined function.

@Gakuto1112 Gakuto1112 changed the title models:getModelWorldPos() does not update models:partToWorldMatrix() does not update May 5, 2024
@Gakuto1112
Copy link
Author

theres also an option to update the matrix in first person

Of course, "First-person matrices" option is enabled.
(The UI is in Japanese. Sorry.)

image

@KitCat962
Copy link
Contributor

This is expected. partToWorldMatrix is the cached result of the previous time the part rendered, and will not update when the part does not render.

First Person Matrices has to do with Vanilla Parts having their getOriginRot updated in first person, not partToWorldMatrix

@Gakuto1112
Copy link
Author

This is expected. partToWorldMatrix is the cached result of the previous time the part rendered, and will not update when the part does not render.

First Person Matrices has to do with Vanilla Parts having their getOriginRot updated in first person, not partToWorldMatrix

I see. I thought that it is a specification of Figura, but I thought that it might be a bug, so I posted this.

@PoolloverNathan
Copy link
Contributor

PoolloverNathan commented May 5, 2024

What if, for ease-of-use purposes, the existing behavior was moved to something like partToWorldMatrixRaw and partToWorldMatrix recalculated it (like getPositionMatrix)?

Edit: Nevermind, that could be breaking. A new function recalculatePartToWorldMatrix wouldn't be, though, and would probably be easy to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants