Demo
The above is the demo address.
InstancedMesh, if after modifying the matrix of the instance once, it is not selected again, is there something wrong with my usage?
Demo
The above is the demo address.
InstancedMesh, if after modifying the matrix of the instance once, it is not selected again, is there something wrong with my usage?
Your instancedMesh is set up with 1 element, but you are writing 10 random element matrices to it. If I set the count on the instanceMatrix to 10, then it sorta works but… there is probably still some other issue… some boxes cant be clicked until you rotate the camera a certain way.
The number of matrices should not matter much, right?
in line 18
const instancedMesh = new THREE.InstancedMesh(box, material, 10)
in line 124
return matrix.compose(position.clone(), quaternion.clone(), scale.clone());
I see, this setting is OK for the time being.
When the number is less than 3, if you click a few more times, the same problem will occur.
This is the updated demo
It seems like matrix not update after change
in line 96
intersects[0].object.instanceMatrix.needsUpdate = true
instancedMesh.matrixWorldNeedsUpdate = true
Sometimes it still doesn’t work . bug when I change the camera position , it works
I tried adding the above code, but the same problem still occurs
It feels like the matrix of Instancedmesh has not been updated in time.