react-three-csg icon indicating copy to clipboard operation
react-three-csg copied to clipboard

TypeError: Cannot read properties of undefined (reading 'array')

Open KIC-Crack opened this issue 1 year ago • 2 comments

Hello, I'm using the example https://codesandbox.io/s/mlgzsc, and I just changed the loaded glb file from the rabbit to my own model. However, the program is reporting an error as shown in the title. What should I do?

KIC-Crack avatar Apr 24 '23 06:04 KIC-Crack

Here is the vertex and normal output of my model

Normals: BufferAttribute {isBufferAttribute: true, name: "", array: Float32Array, itemSize: 3, count: 233893…} isBufferAttribute: true name: "" array: Float32Array itemSize: 3 count: 233893 normalized: false usage: 35044 updateRange: Object version: 0 : "BufferAttribute"

Vertices: BufferAttribute {isBufferAttribute: true, name: "", array: Float32Array, itemSize: 3, count: 233893…} isBufferAttribute: true name: "" array: Float32Array itemSize: 3 count: 233893 normalized: false usage: 35044 updateRange: Object version: 0 : "BufferAttribute"

KIC-Crack avatar Apr 24 '23 07:04 KIC-Crack

@KIC-Crack Faced the same error last week when I loaded a model that didn't have attributes.uv, which the underlying library is explicitly looking for.

A workaround for me was to populate attributes.uv with an empty array after load:

geometry.setAttribute('uv', new BufferAttribute(new Float32Array([]), 1))

pierremtb avatar May 03 '23 10:05 pierremtb