|
@@ -36,7 +36,7 @@
|
|
let controller1, controller2;
|
|
let controller1, controller2;
|
|
let controllerGrip1, controllerGrip2;
|
|
let controllerGrip1, controllerGrip2;
|
|
|
|
|
|
- let room, marker, floor;
|
|
|
|
|
|
+ let room, marker, floor, baseReferenceSpace;
|
|
|
|
|
|
let INTERSECTION;
|
|
let INTERSECTION;
|
|
const tempMatrix = new THREE.Matrix4();
|
|
const tempMatrix = new THREE.Matrix4();
|
|
@@ -84,6 +84,7 @@
|
|
renderer.setPixelRatio( window.devicePixelRatio );
|
|
renderer.setPixelRatio( window.devicePixelRatio );
|
|
renderer.setSize( window.innerWidth, window.innerHeight );
|
|
renderer.setSize( window.innerWidth, window.innerHeight );
|
|
renderer.outputEncoding = THREE.sRGBEncoding;
|
|
renderer.outputEncoding = THREE.sRGBEncoding;
|
|
|
|
+ renderer.xr.addEventListener( 'sessionstart', () => { baseReferenceSpace = renderer.xr.getReferenceSpace(); } )
|
|
renderer.xr.enabled = true;
|
|
renderer.xr.enabled = true;
|
|
document.body.appendChild( renderer.domElement );
|
|
document.body.appendChild( renderer.domElement );
|
|
|
|
|
|
@@ -105,7 +106,6 @@
|
|
|
|
|
|
if ( INTERSECTION ) {
|
|
if ( INTERSECTION ) {
|
|
|
|
|
|
- const baseReferenceSpace = renderer.xr.getReferenceSpace();
|
|
|
|
const offsetPosition = { x: - INTERSECTION.x, y: - INTERSECTION.y, z: - INTERSECTION.z, w: 1 };
|
|
const offsetPosition = { x: - INTERSECTION.x, y: - INTERSECTION.y, z: - INTERSECTION.z, w: 1 };
|
|
const offsetRotation = new THREE.Quaternion();
|
|
const offsetRotation = new THREE.Quaternion();
|
|
const transform = new XRRigidTransform( offsetPosition, offsetRotation );
|
|
const transform = new XRRigidTransform( offsetPosition, offsetRotation );
|