Skip to content

Commit

Permalink
Undo unnecessary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
johnshaughnessy committed Jan 17, 2019
1 parent 73cb9e5 commit c2d2adc
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 46 deletions.
1 change: 1 addition & 0 deletions scripts/print-bindings.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function getPaths(set, dest) {
const exclude = [
paths.actions.cameraDelta,
paths.actions.cursor.stopDrawing,
paths.actions.cursor.hideLine,
paths.actions.leftHand.index,
paths.actions.leftHand.middleRingPinky,
paths.actions.leftHand.pose,
Expand Down
13 changes: 3 additions & 10 deletions src/components/cursor-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,11 @@ AFRAME.registerComponent("cursor-controller", {
emitIntersectionEvents: function(prevIntersection, currIntersection) {
// if we are now intersecting something, and previously we were intersecting nothing or something else
if (currIntersection && (!prevIntersection || currIntersection.object.el !== prevIntersection.object.el)) {
this.data.cursor.emit("raycaster-intersection", {
el: currIntersection.object.el,
intersection: currIntersection
});
this.data.cursor.emit("raycaster-intersection", { el: currIntersection.object.el });
}
// if we were intersecting something, but now we are intersecting nothing or something else
if (prevIntersection && (!currIntersection || currIntersection.object.el !== prevIntersection.object.el)) {
this.data.cursor.emit("raycaster-intersection-cleared", {
el: prevIntersection.object.el,
intersection: currIntersection
});
this.data.cursor.emit("raycaster-intersection-cleared", { el: prevIntersection.object.el });
}
},

Expand All @@ -116,10 +110,9 @@ AFRAME.registerComponent("cursor-controller", {

const userinput = AFRAME.scenes[0].systems.userinput;
const cursorPose = userinput.get(paths.actions.cursor.pose);
const rightHandPose = userinput.get(paths.actions.rightHand.pose);

this.data.cursor.object3D.visible = this.enabled && !!cursorPose;
this.line.material.visible = !!(this.enabled && rightHandPose);
this.line.material.visible = !!(this.enabled && !userinput.get(paths.actions.cursor.hideLine));

if (!this.enabled || !cursorPose) {
return;
Expand Down
27 changes: 0 additions & 27 deletions src/systems/userinput/bindings/keyboard-mouse-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,6 @@ export const keyboardMouseUserBindings = addSetsToBindings({
},
xform: xforms.falling,
priority: 100
},
{
src: { value: paths.device.mouse.buttonLeft },
dest: { value: paths.actions.cursor.drop },
xform: xforms.falling
}
],

Expand Down Expand Up @@ -292,17 +287,6 @@ export const keyboardMouseUserBindings = addSetsToBindings({
xform: xforms.any
}
],
[sets.cursorHoldingUI]: [
{
src: {
value: paths.device.mouse.buttonLeft
},
dest: {
value: paths.actions.cursor.drop
},
xform: xforms.rising
}
],

[sets.cursorHoldingInteractable]: [
{
Expand Down Expand Up @@ -353,12 +337,6 @@ export const keyboardMouseUserBindings = addSetsToBindings({
dest: { value: paths.actions.cursor.grab },
xform: xforms.rising,
priority: 1
},
{
src: { value: paths.device.mouse.buttonLeft },
dest: { value: paths.actions.cursor.drop },
xform: xforms.falling,
priority: 1
}
],
[sets.cursorHoveringOnVideo]: [
Expand All @@ -382,11 +360,6 @@ export const keyboardMouseUserBindings = addSetsToBindings({
src: { value: paths.device.mouse.buttonLeft },
dest: { value: paths.actions.cursor.grab },
xform: xforms.rising
},
{
src: { value: paths.device.mouse.buttonLeft },
dest: { value: paths.actions.cursor.drop },
xform: xforms.falling
}
]
});
7 changes: 0 additions & 7 deletions src/systems/userinput/bindings/oculus-go-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,6 @@ export default function generate3DOFTriggerBindings(device) {
src: { value: device.button("trigger").pressed },
dest: { value: paths.actions.rightHand.middleRingPinky },
xform: xforms.copy
},
{
src: {
value: triggerFalling
},
dest: { value: paths.actions.cursor.drop },
xform: xforms.copy
}
],

Expand Down
5 changes: 5 additions & 0 deletions src/systems/userinput/bindings/touchscreen-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ export const touchscreenUserBindings = addSetsToBindings({
dest: { value: zero },
xform: xforms.always(0)
},
{
src: {},
dest: { value: paths.actions.hideCursorLine },
xform: xforms.always(true)
},
{
src: { x: zero, y: forward },
dest: { value: paths.actions.characterAcceleration },
Expand Down
5 changes: 4 additions & 1 deletion src/systems/userinput/devices/daydream-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ export class DaydreamControllerDevice {
}
this.rayObject.updateMatrixWorld();
this.rayObjectRotation.setFromRotationMatrix(this.rayObject.matrixWorld);
frame[paths.device.daydream.pose] = 1;
this.pose.position.setFromMatrixPosition(this.rayObject.matrixWorld);
this.pose.direction.set(0, 0, -1).applyQuaternion(this.rayObjectRotation);
this.pose.fromOriginAndDirection(this.pose.position, this.pose.direction);
frame[paths.device.daydream.pose] = this.pose;
}
}
}
3 changes: 2 additions & 1 deletion src/systems/userinput/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ paths.actions.ensureFrozen = "/actions/ensureFrozen";
paths.actions.thaw = "/actions/thaw";
paths.actions.muteMic = "/actions/muteMic";
paths.actions.focusChat = "/actions/focusChat";
paths.actions.cursor = {};
paths.actions.rayObjectRotation = "/actions/rayObjectRotation";
paths.actions.cursor = {};
paths.actions.cursor.hideLine = "/actions/cursor/hideLine";
paths.actions.cursor.pose = "/actions/cursorPose";
paths.actions.cursor.grab = "/actions/cursorGrab";
paths.actions.cursor.drop = "/actions/cursorDrop";
Expand Down

0 comments on commit c2d2adc

Please sign in to comment.