the-world-engine
Version:
three.js based, unity like game engine for browser
47 lines (46 loc) • 1.53 kB
TypeScript
import { Component } from "../../hierarchy_object/Component";
import type { Object3D } from "three/src/Three";
/**
* Object3D wrapper for hierarchy object.
*
* You can use this component to render any object that inherits Object3D.
*
* The world matrix of Object3D is automatically updated when `gameObject.transform` is updated.
*
* If you need to update the matrix even if the transform does not change (like animation), use `Object3DContainer.updateWorldMatrix()` method.
*/
export declare class Object3DContainer<T extends Object3D> extends Component {
private _object3D;
private _ready;
private _onDispose;
awake(): void;
onEnable(): void;
onDisable(): void;
onDestroy(): void;
onWorldMatrixUpdated(): void;
private setVisibleRecursively;
/**
* Object3D object to add to the hierarchy.
*/
get object3D(): T | null;
/**
* set Object3D object to add to the hierarchy.
* @param object3D Object3D object to add to the hierarchy.
* @param onDispose onDispose callback
*/
setObject3D(object3D: T, onDispose?: (object3D: T) => void): void;
/**
* remove Object3D object from the hierarchy. and dispose it.
*/
clearObject3D(): void;
/**
* if true, this component is finish to be initialized.
*
* Do not modify the scene until the component is initialized.
*/
protected get ready(): boolean;
/**
* Update the world matrix of the object3D manually.
*/
updateWorldMatrix(): void;
}