Helper framework for working with threejs based on Unity3D ideas.
Three.js wrapper. Using Unity system of Gameobjects and components. Check example folder for some examples. Handle more camera in scene and their drawing. You can create own component in your project. Every component extends Monobehaviour.
update three.js version, add three js as peer dependency
export abstract class Primitive extends Component {
abstract mesh: Mesh;
/* @internal /
constructor() {
super()
}
changePosition(): void {
this.mesh.position.y += 1;
}
gameObjectSet(gameObject: GameObject): void {
gameObject.attach(this.mesh);
}
onDestroy(): void {
if(this.mesh)
if(this.mesh.geometry)
this.mesh.geometry.dispose()
if(this.mesh.material)
Utils3D.disposeMaterialSave(this.mesh.material);
}
}
const go = GameObject.create() // create new instance, the constructor cannot be used
this.transformControls = go.addComponent(TransformControls);
this.transformControls.addListener('dragging-changed', this.transformDraggingChange);
GameObject.add(go); //adding object to scene