I have a line "moving around my scene" (like a 3D snake) randomly and now I want to enclose a box around its head.
The variable bufferGeometry
is defined as follows:
var positions1 = new Float32Array( MAX_POINTS * 3 ); // 3 vertices per point
var positions2 = new Float32Array( MAX_POINTS * 3 ); // 3 vertices per point
buffGeometry1.addAttribute( 'position', new THREE.BufferAttribute( positions1, 3 ) );
buffGeometry2.addAttribute( 'position', new THREE.BufferAttribute( positions2, 3 ) );
I decided to surround it with a cube using the boxGeometry
object. Here's the code snippet I used:
var positioning = buffGeometry1.getAttribute('position');
cube.position.x = positioning[0];
cube.position.y = positioning[1];
cube.position.z = positioning[2];
While debugging, I noticed that my positioning
array is undefined. It seems like something went wrong there.
Thank you.