I'm working with a PointCloud named "cloud" that is centered at (0, 0, 0) and consists of approximately 1000 vertices. These vertices' positions are being manipulated by a vertex shader. My goal now is to log the position of each vertex to the console every few seconds from within the render loop.
Despite inspecting the point cloud's vertices using
console.log(cloud.geometry.vertices[100])
within the render loop, I consistently receive vertex coordinates of all zeros, which does not align with what I observe as the particles move around.
I've referred to a similar post: How to get the absolute position of a vertex in three.js? and attempted
var vector = cloud.geometry.vertices[100].clone();
vector.applyMatrix4( cloud.matrixWorld );
However, this method also yields vectors of zeros for all vertices. Substituting scene.matrixWorld
for cloud.matrixWorld
did not yield any different results.
I have tried utilizing both cloud.updateMatrixWorld()
and scene.updateMatrixWorld()
. Additionally, setting
cloud.geometry.vertexNeedsUpdate = true
was attempted without success.
Thus far, all suggested solutions have been implemented, but none have proven effective in my case. It seems like the array isn't updating with the correct values, although the reason behind this remains unclear. Any suggestions or insights would be greatly appreciated.