InstancedGeometry has no vertices

I am getting points on a sphere:

function getPoints( event ) {

let a = this.geometry.vertices[event.face.a];
let b = this.geometry.vertices[event.face.b];
let c = this.geometry.vertices[event.face.c];

let point = {

  x: ( a.x + b.x + c.x ) / 3,
  y: ( a.y + b.y + c.y ) / 3,
  z: ( a.z + b.z + c.z ) / 3

};

return point

}

but my sphere no longer shows a vertice for the InstancedGeometry I’m clicking on. It looks
As though the faces are there but the vertices are not. Is this intended? How do we add vertices back to geometry? Ive tried adding vertices back but they seem to be non distributed to the faces and all bunch up in one spot.

Any help?

Hi!

What revision do you use?

Going from r115 (works) to r128 (doesnt work)

There is no Geometry since r125, thus all geometries are buffer geometries now.

let a = new THREE.Vector3().fromBufferAttribute(this.geometry.attributes.position, event.face.a);
let b = new THREE.Vector3().fromBufferAttribute(this.geometry.attributes.position, event.face.b);
let c = new THREE.Vector3().fromBufferAttribute(this.geometry.attributes.position, event.face.c);

something like that.

Boom. Works. The man. Thank you!

Modified:

const position = event.object.geometry.attributes.position;

let vertFace = new THREE.Vector3().fromBufferAttribute( position, ( event.face.a, event.face.b, event.face.c ));

… x, y, z / 3… etc.

2 Likes