Skip to content

Object3D: Honor matrixWorldNeedsUpdate in updateWorldMatrix().#33746

Merged
Mugen87 merged 3 commits into
mrdoob:devfrom
Mugen87:dev1
Jun 9, 2026
Merged

Object3D: Honor matrixWorldNeedsUpdate in updateWorldMatrix().#33746
Mugen87 merged 3 commits into
mrdoob:devfrom
Mugen87:dev1

Conversation

@Mugen87

@Mugen87 Mugen87 commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Related issue: -

Description

Right now, updateWorldMatrix() recomputes the world matrix unconditionally. That is not correct since unlike updateMatrixWorld(), the flag matrixWorldNeedsUpdate is currently ignored.

When matrixAutoUpdate is set to false, the applications owns Object3D.matrix. That means it decides when to call updateMatrix() or it writes directly into Object3D.matrix. In any case, matrixWorldNeedsUpdate indicates when a world matrix update is required and when not. It is auto-set by updateMatrix() or by the application/component itself.

updateWorldMatrix() must honor this flag otherwise it performs unneeded computations.

The PR also updates some helpers which currently ignore this policy.

Since this is a behavior change (correction) for updateWorldMatrix() user, it must be noted in the migration guide.

@Mugen87 Mugen87 requested a review from WestLangley June 8, 2026 09:12
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 365.48
86.82
365.48
86.82
+0 B
+0 B
WebGPU 664.94
183.97
664.94
183.97
+0 B
+0 B
WebGPU Nodes 662.98
183.67
662.98
183.67
+0 B
+0 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 507.15
123.31
507.23
123.33
+86 B
+19 B
WebGPU 743.9
200.13
743.99
200.15
+86 B
+20 B
WebGPU Nodes 693.12
187.57
693.21
187.58
+86 B
+13 B

*/
update() {

this.matrixWorldNeedsUpdate = true;

@Mugen87 Mugen87 Jun 8, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whenever a helper wires a an object's world matrix to its local matrix and sets matrixAutoUpdate to false, it must set matrixWorldNeedsUpdate to true in its update method.

@Mugen87 Mugen87 added this to the r185 milestone Jun 9, 2026
@Mugen87 Mugen87 merged commit dc84b87 into mrdoob:dev Jun 9, 2026
9 of 10 checks passed
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

Successfully merging this pull request may close these issues.

2 participants