THREE.Geometry will be removed from core with r125

@Lawrence3DPK Your code will definitely not work with r125 even if you include THREE.Geometry from the examples since raycasting does not support THREE.Geometry anymore. So you will have to learn how to work with BufferGeometry.

As a small teaser, you iterate through all vertices like so:

const positionAttribute = MovingCube.geometry.getAttribute( 'position' );

const localVertex = new THREE.Vector3();
const globalVertex = new THREE.Vector3();

for ( let vertexIndex = 0; vertexIndex < positionAttribute.count; vertexIndex ++ ) {

	localVertex.fromBufferAttribute( positionAttribute, vertexIndex );
	globalVertex.copy( localVertex ).applyMatrix4( MovingCube.matrixWorld );

}

Notice that you have no clone() operation in your for loop anymore which is good for performance. Besides, always use matrixWorld if you want to transform something to world space.

3 Likes