While completing my beginner example at * discourse.threejs.hofk.de with InstancedMesh (// … step 13: instanced mesh), I noticed that in some examples a dummy object is created instead of Matrix4.
const dummy = new THREE.Object3D();
In my simple case is enough
const M4 = new THREE.Matrix4( );
for( let instance = 0; instance < slatCount; instance ++ ) {
slats.setMatrixAt( instance, M4.setPosition( ( instance - slatCount / 2 ) * slatGrid, 0, 0 ) );
}
If I see it correctly, the reason for the extra object is that not all operations can be realized directly with the Matrix4.
For example there are for the position
.setPosition ( v : Vector3 ) : this
.setPosition ( x : Float, y : Float, z : Float ) : this // optional API
Sets the position component for this matrix from vector v, without affecting the rest of the matrix
but e.g. for rotation only .makeRotationY but no .setRotationY without changing the rest of the matrix?
Would this not be possible or is there some other reason for this