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");
2 Likes

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

1 Like

Hello just checking in, was your question answered? @afarchy

Thanks, using a Mesh works. Are there any negative performance implications to using Mesh over AbstractMesh?

1 Like

Not at all, the Mesh is intended to be the main construct to be used at all times :smiley:

1 Like