Hi, I’m trying to create a buffer geometry from a Tetrahedron geometry and somehow it tells me bGeometry doesn have an addAttribute
function… What am I doing here? I’m just passing position parameter because I only want to rotate this solid, nothing else.
var geometry = new THREE.TetrahedronGeometry(800, 2);
var bGeometry = new THREE.BufferGeometry().fromGeometry(geometry);
var positions = [];
geometry.faces.forEach( function ( face, index ) {
positions.push( geometry.vertices[ face.a ].x );
positions.push( geometry.vertices[ face.a ].y );
positions.push( geometry.vertices[ face.a ].z );
positions.push( geometry.vertices[ face.b ].x );
positions.push( geometry.vertices[ face.b ].y );
positions.push( geometry.vertices[ face.b ].z );
positions.push( geometry.vertices[ face.c ].x );
positions.push( geometry.vertices[ face.c ].y );
positions.push( geometry.vertices[ face.c ].z );
})
console.log(bGeometry);
bGeometry.addAtribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
solid = new THREE.Mesh(bGeometry, material);
solid.position.set(900, 200 , 0);
And on animation…
solid.rotation.x += 0.001;
solid.rotation.y += 0.001;
solid.rotation.z += 0.001;