How to use the troika-core.WorldBaseFacade.prototype function in troika-core

To help you get started, we’ve selected a few troika-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github protectwise / troika / packages / troika-3d / src / facade / World3DFacade.js View on Github external
this.onBackgroundClick(e)
    }
  }

  destructor() {
    super.destructor()
    this._threeRenderer.dispose()
    this._threeRenderer.forceContextLoss()
  }

}



World3DFacade.prototype._notifyWorldHandlers = assign(
  Object.create(WorldBaseFacade.prototype._notifyWorldHandlers),
  {
    getCameraPosition(source, data) {
      // We decompose from the world matrix here to handle pose transforms on top of the configured position
      const camMatrix = this.getChildByKey('camera').threeObject.matrixWorld.elements
      const position = new Vector3(camMatrix[12], camMatrix[13], camMatrix[14])
      data.callback(position)
    },
    getCameraFacade(source, data) {
      data.callback(this.getChildByKey('camera'))
    },
    getSceneFacade(source, data) {
      data.callback(this.getChildByKey('scene'))
    },
    projectWorldPosition(source, data) {
      let pos = data.worldPosition
      data.callback(this.projectWorldPosition(pos.x, pos.y, pos.z))