Replies: 3 comments
-
@drcmda @gsimone @CodyJasonBennett I'm facing the same issue. Any ideas? |
Beta Was this translation helpful? Give feedback.
-
Also experiencing this, and looking for potential solutions. |
Beta Was this translation helpful? Give feedback.
-
I figured it out! I think the While observing a standard plane mesh for comparison, I could see that the index property was using a So something like this: <mesh
onPointerOver={onPointerOver}
onPointerOut={onPointerOut}
onPointerDown={onPointerDown}
onPointerUp={onPointerUp}
onPointerMove={onPointerMove}
>
<bufferGeometry >
<bufferAttribute
attach="attributes-position"
array={vertices}
count={vertices.length / 3}
itemSize={3}
/>
<uint16BufferAttribute
attach="index"
array={indices}
count={indices.length}
itemSize={1}
/>
<bufferAttribute
attach="attributes-uv"
array={uvs}
itemSize={2}
count={4}
/>
</bufferGeometry>
{/* material */}
</mesh> You can also replace the Also I created the indices array using a Uint16 array: vertices: new Float32Array([
...cornerPoints[0], // Top left
...cornerPoints[1], // Top right
...cornerPoints[2], // Bottom right
...cornerPoints[3], // Bottom left
]),
indices: new Uint16Array([
2, 1, 0,
0, 3, 2
]),
uvs: new Float32Array([
0, 1,
1, 1,
1, 0,
0, 0
]) |
Beta Was this translation helpful? Give feedback.
-
I'm using an orthographic camera to visualise a 2d shape (a square in the example but it should support polygons as well).
But the problem is that as soon as I add indexes to my indicies the pointer events stop working.
Here is the example code with both a working example without index and a broken one with index https://codesandbox.io/s/pointer-actions-with-indices-xt3f7k?file=/src/App.js
My guess is that I'm missing something obvious but I'm not that experienced with Three.js/React Fiber.
I've tried googling but can't find info about pointer events associated to bufferGeometry.
Beta Was this translation helpful? Give feedback.
All reactions