Instance Method

clone(recursive:)

Duplicates a model entity to create a new entity.

Declaration

func clone(recursive: Bool) -> Self

Parameters

recursive

A Boolean that you set to true to indicate that all descendant entities of the anchor should also be copied. Otherwise, no descendants are copied.

Return Value

A new ModelEntity instance that is a duplicate of the original.

Discussion

This method clones all component data automatically. When you clone an entity that stores custom data that’s not part of a component, override the didClone(from:) method to copy that data manually after the clone finishes.

See Also

Creating a Model

init()

Creates a model entity.

init(mesh: MeshResource, materials: [Material])

Creates a model entity with a particular mesh and set of materials.

init(mesh: MeshResource, materials: [Material], collisionShape: ShapeResource, mass: Float)

Creates a model entity with a particular mesh, set of materials, collision shape, and mass.

init(mesh: MeshResource, materials: [Material], collisionShapes: [ShapeResource], mass: Float)

Creates a model entity with a particular mesh, set of materials, a composite collision shape, and mass.