The docs says :
Blockquote
However, if you know the object will be static, you can disable this and update the transform matrix manually just when needed.
object.matrixAutoUpdate = false;
object.updateMatrix();
parent.matrixAutoUpdate = false;
child.matrixAutoUpdate = false;
will the child.updateMatrix(); also update the parent’s?
- what is the difference between matrix and matrixWorld for an object ?
.matrix is the “local” matrix of the object. So the literal conversion of scale/position/rotation into matrix4 form.
the .matrixWorld is the .matrix * the .parent.matrixWorld, which propagates all the way back up to the root Scene object.
So… if the parents .matrix and .matrixWorld are both up to date, then children can reliably update their matrices… even if the parents .matrixAutoUpdate = true.
btw. there is also matrixWorldAutoUpdate which you can also disable.
The flow there for static objects is to place them with pos/rot/scale… then forcably call object.updateMatrix() object.updateMAtrixWorld()
then set
object.matrixAutoUpdate = false;
object.matrixWorldUpdate = false;
now that those are set, that model can render each frame without recomputing any matrices and you can get a nice speedup.
Sometimes people manage their matrix updating completely manually to get deeper control.
I have done like this :
set transforms for parent...
set transforms for child...
parent.updateMatrix();
child.updateMatrix();
parent.updateMatrixWorld();
child.updateMatrixWorld();
parent.matrixAutoUpdate = false;
child.matrixAutoUpdate = false;
parent.matrixWorldAutoUpdate = false;
child.matrixWorldAutoUpdate = false;
The problem now is that i can’t modify the transforms anymore.
I would like to do this :
modify transforms for child...
child.updateMatrix();
child.updateMatrixWorld();
The objects are frozen, both parent and child.
does passing “true” to updateMatrixWorld help?
No passing “true” to updateMatrixWorld does nothing.