Why might mesh.createInstance() throw an exception?

Hi, not sure if this is a bug or if I’m calling something wrong. I’m constructing a scene and making instances of various meshes, and I’m seeing Babylon throw an exception on when I call createInstance. However, it’s not always on the same mesh, and sometimes the exception happens on a mesh that I had previously created instances of, so it’s not obvious what the problem might be.

The exception gets thrown on this line inside VertexBuffer. The error is a RangeError; Babylon calls getFloat32 past the size of the buffer.

The call stack looks like this:

VertexBuffer._GetFloatValue (buffer.js?cb84:504)
VertexBuffer.ForEach (buffer.js?cb84:459)
VertexBuffer.forEach (buffer.js?cb84:380)
Geometry.getVerticesData (geometry.js?ca4e:352)
Geometry.copy (geometry.js?ca4e:820)
Mesh.makeGeometryUnique (mesh.js?c003:1225)
Mesh.createInstance (mesh.js?c003:2559)

I know that’s kind of vague, but can anyone hazard a guess at what might be going on? Are there cases where it’s illegal to call createInstance?

Technically no :wink: so I may use a repro in the playground to help further

Hi, as you can imagine this doesn’t reproduce in minimal cases. If I figure out how I’ll obviously post a PG, but it’s happening in a big complicated scene, and all the meshes involved are otherwise working normally.

Hi, I think I reproduced this in a PG. Please see here.