I put all the objects that the model needs to pick into an array, pass them to raycaster, and update the vertex data of each picked object simultaneously during animation updates
Raycaster.js
const intersects = this.raycaster.intersectObjects(
this.world.model.rayCasterObjs,
false
)
Animations.js
updateModelSkinnedMeshMatrixWorld() {
if (this.model) {
this.model.rayCasterObjs.forEach((obj) => {
obj.updateMatrixWorld(true)
const box = new THREE.Box3().setFromObject(obj)
obj.geometry.computeBoundingBox()
obj.geometry.computeBoundingSphere()
// obj.skeleton.update()
})
}
}