Heya, there’s a little issue with the Mesh class’s instanced buffer that I stumbled onto. When the stride is 1 and a float is used to set the (per-instance) value, a runtime error occurs because the function _processInstancedBuffers assumes that the value is an object containing either function toArray or copyToArray. Here’s a little playground showing the issue.
A simple workaround is to pass a Vector2 object instead of a float, as shown in this playground. Alternatively a simple object can be created that has the required function, but this isn’t any easier IMO.
A simple solution is to add a check for a single float value, for example like this:
if (Number.isFinite(value)) {
data[offset] = value;
} else if (value.toArray) {
value.toArray(data, offset);
} else {
value.copyToArray(data, offset);
}
And here’s a playground that implements this solution by overriding _processInstancedBuffers.
I’m happy to make a little PR for this, just lemme know if the solution is a go or if there’s a better way to handle it.