Object3D: Respect matrixWorldAutoUpdate in matrix update methods#28533
Object3D: Respect matrixWorldAutoUpdate in matrix update methods#28533Mugen87 merged 5 commits intomrdoob:devfrom CodyJasonBennett:object3d-force-manual-matrices
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
|
Do you mind rebasing the PR and #28534? Unfortunately, they are based on a state with broken CI. If you grab the latest commits from dev, we should easier see if something breaks. |
|
@CodyJasonBennett Thanks for filing this PR! |
|
Sorry to interfer in a closed PR but I have a hard time understanding the new behaviour. Now with the new condition on line 592 the matrixWorld is never updated whereas I use This is done because I need the camera matrix to be updated before rendering, I cannot wait for the WebGLRenderer to kick in. And I wanted to avoid updating the matrix twice on each frame. Alternative I considered : do it entirely manually this.camera.updateMatrix();
this.camera.matrixWorld.copy(this.camera.matrix);Thanks |
|
Yes, there is a difference between TBH, I'm not super happy with how So until there is a new world matrix update routine, you indeed have to manage the world matrix manually if you set |
|
Thanks for those informations. Still I think the "force" flag should be removed entirely has it does nothing but clear the "needsMatrixWorldUpdate" property without actually upadting the matrix. |
I also had a hard time figuring out why all my objects are messed up after a three.js upgrade. I narrowed it down to this PR, which came with r166. I also figured out that the world matrix cannot be updated manually anymore if the "matrixWorldAutoUpdate" is set to false. However, for performance reasons, that's how I did it in the past 2 years, I updated the local-, and worldmatrices manually whenever it was necessary. Now, with r166, I'm using this hack as a workaround: |
|
Just to give another update: The above workaround doesn't work all the time, for example if the It would be nice to have a way to manually update the worldmatrix of an object3d (respecting the ancestors', and descendants' matrices as well). Currently it seems there's basically no easy way of doing it |
Maybe the solution is to have |
Related issue: #21387
Description
Since #24028, whenever a parent object had its world matrices updated by three, it would update child matrices unconditionally by the local override of
force(#27245, #27261). Additionally, if three reaches a child withmatrixWorldAutoUpdate = false, its descendant children aren't processed despite their configuration (#27261 (comment)).I've since fixed both issues by moving the check for
matrixWorldAutoUpdatewhen managing the parent world matrix and preserving the original functionality prior to #24028. Unit tests aren't properly isolated, which hid this bug prior, so I also reset hidden states in-between cases, which now catch these regressions.cc @DolphinIQ, @krispya