Skip to content

Commit

Permalink
Set instancedMesh count correctly when adjusting capacity
Browse files Browse the repository at this point in the history
  • Loading branch information
diarmidmackenzie committed Nov 21, 2023
1 parent 019370a commit e11ef10
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/instanced-mesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ AFRAME.registerComponent('instanced-mesh', {
var newMesh = new THREE.InstancedMesh(node.geometry,
node.material,
this.data.capacity);
newMesh.count = this.members;
newMeshes.push(newMesh);

for (ii = 0; ii < Math.min(oldMesh.count, this.data.capacity); ii ++ ) {
oldMesh.getMatrixAt(ii, this.matrix)
newMesh.setMatrixAt(ii, this.matrix);
Expand Down

0 comments on commit e11ef10

Please # to comment.