I’m implementing a particules systems with dedicated Vertex shader. Here a code example: https://jsfiddle.net/dthevenin/7arntcog/
I do use a Raycaster to do mouse picking and make possible to interact with one particule.
The code works as expected until I try to change the position of a vertex from the Vertex Shader. For instance in that example, I do pass a time value as an Uniform, and modify the x position with that time’s value.
vec4 mvPosition = modelViewMatrix * vec4(position.x + time, position.y, position.z, 1.0);
Then the Raycaster failed to calculate the intersection.
To see the issue, uncomment the line 86, then clicking on a particule does not work.
What is wrong with that code / that solution?
PS: I could tweak the Mouse position with the opposite time translation; but that solution is not very generic and will not work with a complex position transformation in the Vertex shader.