Commit 89f6e270 authored by Jacob DeWitt's avatar Jacob DeWitt Committed by Commit Bot

Update sample page to show if viewer pose has emulated position

Make boxes stop moving when the viewer pose has emulatedPosition = true
This gives a way to see if the emulatedPosition value is properly set
without having to take off the headset or look at console logs. This is
useful when testing how things behave during tracking loss.

Bug: 1011103
Change-Id: Icebe492fd291b394674b12fc50181d48778ffbe2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1838479Reviewed-by: default avatarAlexander Cooper <alcooper@chromium.org>
Commit-Queue: Jacob DeWitt <jacde@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702939}
parent b13a84f4
......@@ -430,12 +430,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
session.requestAnimationFrame(onXRFrame);
// Update the matrix for each box
for (let box of boxes) {
let node = box.node;
mat4.identity(node.matrix);
mat4.translate(node.matrix, node.matrix, box.position);
mat4.rotateX(node.matrix, node.matrix, time/1000);
mat4.rotateY(node.matrix, node.matrix, time/1500);
// Only do this when the position is not emulated - this means one can
// tell if the viewer pose has an emulated position while still in VR.
if (!pose.emulatedPosition) {
for (let box of boxes) {
let node = box.node;
mat4.identity(node.matrix);
mat4.translate(node.matrix, node.matrix, box.position);
mat4.rotateX(node.matrix, node.matrix, time/1000);
mat4.rotateY(node.matrix, node.matrix, time/1500);
}
}
scene.updateInputSources(frame, refSpace);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment