Nearly Picked Makefiles

    @qubixstudio/qunity
    TypeScript icon, indicating that this package has built-in type declarations

    0.2.66 • Public • Published

    qunity

    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.

    Component example

    Each component should have a onDestroy method. Qunity handle destroing Gameobject and his components.

    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);
      }
    }
    

    Gameobject

    create new GameObject

    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
    

    Created by Qubix

    https://www.qubixstudio.com/

    Licence

    https://opensource.org/licenses/MIT

    Install

    npm i @qubixstudio/qunity

    DownloadsWeekly Downloads

    14

    Version

    0.2.66

    License

    MIT

    Unpacked Size

    1.16 MB

    Total Files

    147

    Last publish

    Collaborators

    • qubixstudio_office