How to understand an object's vertices has been changed?

i created a point like that

var pointGeometry = new THREE.Geometry();
pointGeometry.vertices.push( new THREE.Vector3( 0, 1, 0 ) );

var pointMaterial = new THREE.PointsMaterial( { color: 0x888888, size: 0.15 } );

var pointOnGeo = new THREE.Points( pointGeometry, pointMaterial );

scene.add( pointOnGeo );

now i want to write a function gets fired whenever this point’s vertice coordinates gets changes (doesn’t matter x, y, z)? how??

There is no built-in functionality in the library in order to observe changes of an object.

You might want to have a look at ES6 Proxies to implement observables.

Demo: https://jsfiddle.net/c5x5zurz/2/

2 Likes

For fun here’s an updated version showing it observing every second:

https://jsfiddle.net/trusktr/c5x5zurz/4/