thinInstanceSetBuffer missing when using ES6 packages

Hi!
With the release of the amazing 4.2 version, I was eager to try out the new thin instances. However, trying to use them in my project I got the following error from typescript: Property 'thinInstanceSetBuffer' does not exist on type 'Mesh'.ts(2339).

After a bit of trying around, I found that when importing babylonjs in this way:

import * as BABYLON from 'babylonjs';

var box = BABYLON.BoxBuilder.CreateBox("root", {size: 1});
// ...
box.thinInstanceSetBuffer("matrix", matricesData, 16, true);

It works just fine.

When importing using the ES6 packages and tree-shaking:

// ...
import { Mesh } from "@babylonjs/core/Meshes/mesh";
import { BoxBuilder } from "@babylonjs/core/Meshes/Builders/boxBuilder";
// ...
var box = BABYLON.BoxBuilder.CreateBox("root", {size: 1});
// ...
box.thinInstanceSetBuffer("matrix", matricesData, 16, true);

I get Property 'thinInstanceSetBuffer' does not exist on type 'Mesh'.ts(2339) from the typescript linter. And if I put a // @ts-ignore above the line and compile it anyways, I get an Uncaught TypeError: origMesh.thinInstanceSetBuffer is not a function from the browser.

Am I missing an import, or are thin instances not yet supported in the ES6 packages?

Thanks in advance!

I know nothing about ES6, but have you tried to add:

import "@babylonjs/core/Meshes/thinInstanceMesh";
1 Like

Thanks for the quick answer.
Edit: Never mind, your solution was right. Thanks!

Amazing job on the thin instances, btw. It’s my favourite feature of 4.2 :smile:

2 Likes