Hi,
I have the following issue:
A group positioned at some place (not 0,0,0), with a single child sphere mesh
A render loop running throttled to some pace
An event listener on mouse move which calculates intersection with the group (unthrottled)
At some point I swap the sphere mesh with a cube mesh (unrelated to user behavior)
If this happened while the cursor was on top of the sphere (and on top of the cube when it will be swapped) the raycasting will sometimes get 0 intersections.
i.e.
Sphere is added to the group
Cursor on top of sphere
Intersection found
Cursor moving - intersection still found
Swap cube
Few empty intersections
Back to getting intersections
After some debugging I found the the only thing that helps is either making sure I call render() before the raycasting happens or calling manually updateWorldMatrix.
So it seems like rendering calls updateWorldMatrix for me, and raycasting doesn’t.
I looked at the code (mine’s and three.js’) and I wasn’t able to find where updateWorldMatrix is being called in the renderer, but I found where updateMatrixWorld is being called:
Not sure this is related though
I’m not sure this is issue worthy as it’s quite a rare case, and also I’m not sure there’s an easy solution that would prevent called updateWorldMatrix multiple times per frame.
So my questions are:
- What’s the relationship between updateWorldMatrix and updateMatrixWorld?
- Is what I’m describing sound like a real issue or something that should be solved on the application level?
Thanks