Commit 6d296e5a authored by Klaus Weidner's avatar Klaus Weidner Committed by Commit Bot

Make laser longer, only show cursor on intersection

The combination of a 1m length laser and showing a cursor
at 1m distance is visually very confusing when trying to
hit objects, especially when doing quick tests on a
mirror display without wearing the headset.

Instead, use a long laser beam, and only show a cursor
when there's a valid intersection with the scene.

Change-Id: Id4178b1ba72994c9148d53c8bc58f041fb42520d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1506463Reviewed-by: default avatarBrandon Jones <bajones@chromium.org>
Commit-Queue: Klaus Weidner <klausw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638266}
parent 6da6e7e7
...@@ -43,7 +43,7 @@ const LASER_TEXTURE_DATA = new Uint8Array([ ...@@ -43,7 +43,7 @@ const LASER_TEXTURE_DATA = new Uint8Array([
0xcc, 0xcc, 0xcc, 0x05, 0xbf, 0xbf, 0xbf, 0x04, 0xff, 0xff, 0xff, 0x02, 0xff, 0xff, 0xff, 0x01, 0xcc, 0xcc, 0xcc, 0x05, 0xbf, 0xbf, 0xbf, 0x04, 0xff, 0xff, 0xff, 0x02, 0xff, 0xff, 0xff, 0x01,
]); ]);
const LASER_LENGTH = 1.0; const LASER_LENGTH = 10.0;
const LASER_DIAMETER = 0.01; const LASER_DIAMETER = 0.01;
const LASER_FADE_END = 0.535; const LASER_FADE_END = 0.535;
const LASER_FADE_POINT = 0.5335; const LASER_FADE_POINT = 0.5335;
......
...@@ -128,23 +128,6 @@ export class Scene extends Node { ...@@ -128,23 +128,6 @@ export class Scene extends Node {
} }
hitResult.node._hoverFrameId = this._hoverFrame; hitResult.node._hoverFrameId = this._hoverFrame;
newHoveredNodes.push(hitResult.node); newHoveredNodes.push(hitResult.node);
} else {
// Statically render the cursor 1 meters down the ray since we didn't
// hit anything selectable.
let cursorDistance = 1.0;
let cursorPos = vec3.fromValues(
inputPose.targetRay.origin.x,
inputPose.targetRay.origin.y,
inputPose.targetRay.origin.z
);
vec3.add(cursorPos, cursorPos, [
inputPose.targetRay.direction.x * cursorDistance,
inputPose.targetRay.direction.y * cursorDistance,
inputPose.targetRay.direction.z * cursorDistance,
]);
// let cursorPos = vec3.fromValues(0, 0, -1.0);
// vec3.transformMat4(cursorPos, cursorPos, inputPose.targetRay);
this.inputRenderer.addCursor(cursorPos);
} }
} }
} }
......
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