I have a PointCloud called "cloud" centered at (0,0,0) with around 1000 vertices. The vertices' positions are updated using a vertex shader. I now would like to print out each vertex's position to the console every few seconds from the render loop.
If I inspect the point cloud's vertices using
console.log(cloud.geometry.vertices[100])
in the render loop, I always get a vertex with all zeros, which I can see from all the particles zipping around is not true.
I looked at this similar post: How to get the absolute position of a vertex in three.js? and tried
var vector = cloud.geometry.vertices[100].clone();
vector.applyMatrix4( cloud.matrixWorld );
which still gave me a vector of all zeros (for all of the vertices). Using scene.matrixWorld
in place of cloud.matrixWorld
did not work either.
I also tried using cloud.updateMatrixWorld()
and scene.updateMatrixWorld()
. Lastly, I tried setting cloud.geometry.vertexNeedsUpdate = true
.
So far, all of the advice I've seen has used the above, but none of them work for me. I have a feeling that the array just isn't getting updated with the correct values, but I don't know why that is. Any ideas?