.bakeTransformIntoVertices() not available on AbstractMesh?

Hi, I recently created this Playground scene with some help on another thread, but it’s not working when I try to use it in my dev environment on my local computer.

The issue is with lines 18 and 26. Specifically, I currently have the type on line 18 defined as {meshes}: any, so that .bakeTransformIntoVertices() on line 26 doesn’t throw the error in the second image below. However, I can’t set the type of the {meshes} variable to any on my local environment. I get this other error:

Removing the : any portion (demonstrated here on the Playground) creates an error message of the main issue:


I don’t want to update my local tsconfig file to simply allow the {meshes}: any workaround if it’s unsafe type practice. Why can’t I just call .bakeTransformIntoVertices() on an AbstractMesh? How should I approach this differently?

Thanks for reading!

meshes.forEach(mesh as Mesh => {
// ...

You can also test that you really have a mesh:

meshes.forEach((m) => {
    if (m instanceof Mesh) {

Note that you can have some InstancedMesh objects in the scene.meshes if you use instancing (and bakeTransformIntoVertices does not exist for instances), so simply casting as Mesh can be dangerous.


Works like a charm! Thank you for elaborating

@Evgeni_Popov you are on fire !!! thanks a lot for all your amazing answers !!!