Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
KIC-Crack opened this issue Apr 24, 2023 · 2 comments
Open

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

KIC-Crack opened this issue Apr 24, 2023 · 2 comments

Comments

@KIC-Crack
Copy link

KIC-Crack commented Apr 24, 2023

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 KIC-Crack changed the title TypeError: Cannot read properties of undefined (reading 'count') TypeError: Cannot read properties of undefined (reading 'array') Apr 24, 2023
@KIC-Crack
Copy link
Author

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"

@pierremtb
Copy link

@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))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants