Can't clone AbstractMesh?

Hello, I’m trying to clone a hierarchy in which the root is an abstract mesh. But it seems the clone() method of AbstractMesh is not implemented. I’m using an AbstractMesh instead of a TransformNode as the root because I want to add a physics imposter to the root. Is there another way?

I would use a TransformNode and just cast it to AbstractMesh at the time of adding the impostor

I’m confused by this answer – TransformNode won’t have relevant methods like physicsImposter and getBoundingInfo, and doesn’t implement IPhysicsEnabledObject. I don’t think a cast will make it work.

Try using a Mesh for the root node instead, then you should be able to clone the whole hierarchy and the physics impostor all at once I think.

let rootNode = new BABYLON.Mesh("rootNode");
1 Like

Just wanted to add on top of that, an AbstractMesh cannot be cloned: