diff --git a/CODING.md b/CODING.md index d8b8fb4..c63f4b2 100644 --- a/CODING.md +++ b/CODING.md @@ -57,9 +57,8 @@ The scene, camera, and renderer objects below are representative APIs that have // Set up for the next frame session.requestFrame(frame => { handleFrame(frame) }) - // Get the pose for the world coordinate system - let stageCoordinateSystem = frame.getCoordinateSystem(XRCoordinateSystem.STAGE) - let stagePose = frame.getViewPose(stageCoordinateSystem) + // Get the pose for the HMD or handset tracker coordinate system + let trackerCoordinateSystem = frame.getCoordinateSystem(XRCoordinateSystem.TRACKER) // Get the pose for the head let headCoordinateSystem = frame.getCoordinateSystem(XRCoordinateSystem.HEAD_MODEL) @@ -126,11 +125,11 @@ You now have a couple of anchored nodes save in `anchoredNodes`, so during each const anchor = frame.getAnchor(anchoredNode.anchorOffset.anchorUID) // Get the offset coordinates relative to the anchor let offsetCoordinates = anchoredNode.anchorOffset.getTransformedCoordinates(anchor) - // Now use the offset coordinates, possibly by converting to the stage coordinate system. - if(offsetCoordinates.coordinateSystem.type === XRCoordinateSystem.STAGE){ + // Now use the offset coordinates, possibly by converting to the tracker coordinate system. + if(offsetCoordinates.coordinateSystem.type === XRCoordinateSystem.TRACKER){ anchoredNode.node.matrix = offsetCoordinates.poseMatrix } else { - anchoredNode.node.matrix = offsetCoordinates.getTransformedCoordinates(stageCoordinateSystem).poseMatrix + anchoredNode.node.matrix = offsetCoordinates.getTransformedCoordinates(trackerCoordinateSystem).poseMatrix } } diff --git a/examples/ar_anchors/index.html b/examples/ar_anchors/index.html index 0ea7eea..e138d9a 100644 --- a/examples/ar_anchors/index.html +++ b/examples/ar_anchors/index.html @@ -58,11 +58,11 @@ } // Called during construction - initializeStageGroup(){ - this.stageGroup.add(new THREE.AmbientLight('#FFF', 0.2)) + initializeScene(){ + this.scene.add(new THREE.AmbientLight('#FFF', 0.2)) let directionalLight = new THREE.DirectionalLight('#FFF', 0.6) directionalLight.position.set(0, 10, 0) - this.stageGroup.add(directionalLight) + this.scene.add(directionalLight) } createSceneGraphNode(){ @@ -83,8 +83,9 @@ } // Called once per frame - updateStageGroup(frame, stageCoordinateSystem, stagePose){ - let headCoordinateSystem = frame.getCoordinateSystem(XRCoordinateSystem.HEAD_MODEL) + updateScene(frame){ + const headCoordinateSystem = frame.getCoordinateSystem(XRCoordinateSystem.HEAD_MODEL) + const trackerCoordinateSystem = frame.getCoordinateSystem(XRCoordinateSystem.TRACKER) // Create anchors for newly anchored nodes for(let anchorToAdd of this.anchorsToAdd){ @@ -102,7 +103,7 @@ anchorUID: anchorUID, node: anchorToAdd.node }) - this.stageGroup.add(anchorToAdd.node) + this.scene.add(anchorToAdd.node) } this.anchorsToAdd = [] @@ -113,7 +114,7 @@ console.error('Unknown anchor ID', anchoredNode.anchorId) } else { anchoredNode.node.matrixAutoUpdate = false - anchoredNode.node.matrix.fromArray(anchor.coordinates.getTransformedCoordinates(stageCoordinateSystem).poseMatrix) + anchoredNode.node.matrix.fromArray(anchor.coordinates.getTransformedCoordinates(trackerCoordinateSystem).poseMatrix) anchoredNode.node.updateMatrixWorld(true) } } diff --git a/examples/ar_simplest/index.html b/examples/ar_simplest/index.html index bdef564..bd9251d 100644 --- a/examples/ar_simplest/index.html +++ b/examples/ar_simplest/index.html @@ -36,45 +36,45 @@