How to instantiate a TransformNode?

I created a mesh and clone in cinema 4d and export glb file.

Mesh files consist of mesh and instance mesh.

I want to merge all instance mesh and normal mesh with Mesh.MergeMeshes but i cant because of instance mesh cant be Merged.

Instead of that i create a TransformNode and setParent mesh of glb file:

  const Hexagones = await ImportMeshAsync("models/obstacles/Hexa.glb").then(res => {
      const hexTN=new TransformNode('hex')
      res.meshes.forEach(hex => {
        if (hex.getTotalVertices() > 0) {
          hex.position.y = 10
          const rampMeshPhysics = new PhysicsAggregate(
            hex,
            PhysicsShapeType.MESH,
            {
              mass: 100,
              friction: 300,
              startAsleep: true
            },
          );
          hex.parent=hexTN

        }
      });

      return hexTN
    })
//Hexagones.createInstance('1') not worked

How can i instantiate transform node?

there is a instantiateHierarchy method that instantiates a TransformNode and its children

1 Like