MCPcopy
hub / github.com/mrdoob/three.js / updateWorldMatrix

Method updateWorldMatrix

src/core/Object3D.js:1214–1264  ·  view source on GitHub ↗

* An alternative version of Object3D#updateMatrixWorld with more control over the * update of ancestor and descendant nodes. * * @param {boolean} [updateParents=false] Whether ancestor nodes should be updated or not. * @param {boolean} [updateChildren=false] Whether descendant nodes

( updateParents, updateChildren, force = false )

Source from the content-addressed store, hash-verified

1212 * when {@link Object3D#matrixWorldNeedsUpdate} is `false`.
1213 */
1214 updateWorldMatrix( updateParents, updateChildren, force = false ) {
1215
1216 const parent = this.parent;
1217
1218 if ( updateParents === true && parent !== null ) {
1219
1220 parent.updateWorldMatrix( true, false );
1221
1222 }
1223
1224 if ( this.matrixAutoUpdate ) this.updateMatrix();
1225
1226 if ( this.matrixWorldNeedsUpdate || force ) {
1227
1228 if ( this.matrixWorldAutoUpdate === true ) {
1229
1230 if ( this.parent === null ) {
1231
1232 this.matrixWorld.copy( this.matrix );
1233
1234 } else {
1235
1236 this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );
1237
1238 }
1239
1240 }
1241
1242 this.matrixWorldNeedsUpdate = false;
1243
1244 force = true;
1245
1246 }
1247
1248 // make sure descendants are updated
1249
1250 if ( updateChildren === true ) {
1251
1252 const children = this.children;
1253
1254 for ( let i = 0, l = children.length; i < l; i ++ ) {
1255
1256 const child = children[ i ];
1257
1258 child.updateWorldMatrix( false, true, force );
1259
1260 }
1261
1262 }
1263
1264 }
1265
1266 /**
1267 * Serializes the 3D object into JSON.

Callers 8

localToWorldMethod · 0.95
worldToLocalMethod · 0.95
lookAtMethod · 0.95
attachMethod · 0.95
getWorldPositionMethod · 0.95
getWorldQuaternionMethod · 0.95
getWorldScaleMethod · 0.95
getWorldDirectionMethod · 0.95

Calls 3

updateMatrixMethod · 0.95
copyMethod · 0.45
multiplyMatricesMethod · 0.45

Tested by

no test coverage detected