Hey Guys, im trying to migrate from Geometry to BufferGeometry. I have a few cases where I was using BoxGeometry as initial Geometry and manipulated each vertex to fit my needs.
// Y
// |
// |
// |
// |4 +--------+ 1
// | /| /|
// |/ | / |
// 5 +--|-----+ 0|
// | | | |
// | 6+_____|__+3
// | / | /
// |/ |/
// 7 +--------+ 2-------- X
With the old Geometry I would do something like this
this.geometry = new THREE.BoxGeometry(1, 1, 1)
this.geometry.vertices[5].x = IIP.x
this.geometry.vertices[5].y = 2
this.geometry.vertices[5].z = IIP.z
this.geometry.vertices[7].x = IIP.x
this.geometry.vertices[7].y = 0
this.geometry.vertices[7].z = IIP.z
this.geometry.verticesNeedUpdate = true
this.mesh.updateMatrixWorld()
Now with BufferGeometry I tried to do it like so
this.geometry = new THREE.BoxGeometry(1, 1, 1)
let position = this.geometry.attributes.position
position.setXYZ(5, IIP.x, 2, IIP.z)
position.setXYZ(7, IIP.x, 0, IIP.z)
position.needsUpdate = true
this.mesh.updateMatrixWorld()
and its not working unfortunately. I guess im not using the right index?
Any help appreaciated!