The Object3D to clone, or an AssetReference to load and instantiate
Optionalopts: null | IInstantiateOptionsOptional instantiation settings (position, rotation, scale, parent)
The cloned GameObject, or a Promise
import { instantiate } from "@needle-tools/engine";
const clone = instantiate(original);
clone.position.set(1, 0, 0);
this.context.scene.add(clone);
const clone = instantiate(original, {
parent: parentObject,
position: new Vector3(0, 1, 0),
rotation: new Quaternion()
});
const instance = await instantiate(myAssetRef);
if (instance) this.context.scene.add(instance);
Creates a copy (clone) of a GameObject or loads and instantiates an AssetReference.
All components on the original object are cloned and awake() is called on them.
The Object3D to clone, or an AssetReference to load and instantiate
Optionalopts: null | IInstantiateOptionsOptional instantiation settings (position, rotation, scale, parent)
The cloned GameObject, or a Promise
import { instantiate } from "@needle-tools/engine";
const clone = instantiate(original);
clone.position.set(1, 0, 0);
this.context.scene.add(clone);
const clone = instantiate(original, {
parent: parentObject,
position: new Vector3(0, 1, 0),
rotation: new Quaternion()
});
const instance = await instantiate(myAssetRef);
if (instance) this.context.scene.add(instance);
Creates a copy (clone) of a GameObject or loads and instantiates an AssetReference. All components on the original object are cloned and
awake()is called on them.