@needle-tools/engine
Version:
Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.
35 lines (27 loc) • 1.01 kB
text/typescript
import { Matrix4, Object3D, Quaternion, Scene, Vector3 } from 'three';
import { CreateWireCube, Gizmos } from '../engine_gizmos.js';
import type { IGameObject } from '../engine_types.js';
import { getParam } from '../engine_utils.js';
import type { IXRRig } from './XRRig.js';
export const flipForwardMatrix = new Matrix4().makeRotationY(Math.PI);
export const flipForwardQuaternion = new Quaternion().setFromAxisAngle(new Vector3(0, 1, 0), Math.PI);
const debug = getParam("debugwebxr");
export class ImplictXRRig implements IXRRig {
priority = -100000;
gameObject: IGameObject;
isXRRig(): boolean {
return true;
}
get isActive(): boolean {
return this.gameObject.visible;
}
constructor() {
this.gameObject = new Object3D() as IGameObject;
this.gameObject.name = "Implicit XR Rig";
if (debug) {
const cube = CreateWireCube(0xff55dd);
cube.position.y += .5;
this.gameObject.add(cube);
}
}
}