Fix buttons not working with controllers

This commit is contained in:
David Rowe 2017-05-27 11:27:18 +12:00
parent 8a659955cc
commit 019e92b2a3
2 changed files with 11 additions and 12 deletions

View file

@ -44,25 +44,22 @@ var minuteHandID = Entities.addEntity({
}); });
var startStopButtonID = Entities.addEntity({ var startStopButtonID = Entities.addEntity({
type: "Shape", type: "Model",
shape: "Octagon",
name: "stopwatch/startStop", name: "stopwatch/startStop",
parentID: stopwatchID, parentID: stopwatchID,
dimensions: Vec3.multiply(scale, { x: 0.8, y: 1.0, z: 0.8 }), dimensions: Vec3.multiply(scale, { x: 0.8, y: 0.8, z: 1.0 }),
localPosition: Vec3.multiply(scale, { x: 0, y: -0.1, z: -2.06 }), localPosition: Vec3.multiply(scale, { x: 0, y: -0.1, z: -2.06 }),
localRotation: Quat.fromVec3Degrees({ x: 90, y: 0, z: 0 }), modelURL: Script.resolvePath("models/transparent-box.fbx")
visible: false
}); });
var resetButtonID = Entities.addEntity({ var resetButtonID = Entities.addEntity({
type: "Shape", type: "Model",
shape: "Octagon",
name: "stopwatch/startStop", name: "stopwatch/startStop",
parentID: stopwatchID, parentID: stopwatchID,
dimensions: Vec3.multiply(scale, { x: 0.6, y: 0.8, z: 0.6 }), dimensions: Vec3.multiply(scale, { x: 0.6, y: 0.6, z: 0.8 }),
localPosition: Vec3.multiply(scale, { x: -1.5, y: -0.1, z: -1.2 }), localPosition: Vec3.multiply(scale, { x: -1.5, y: -0.1, z: -1.2 }),
localRotation: Quat.fromVec3Degrees({ x: 90, y: 36, z: 0 }), localRotation: Quat.fromVec3Degrees({ x: 0, y: 36, z: 0 }),
visible: false modelURL: Script.resolvePath("models/transparent-box.fbx")
}); });
Entities.editEntity(stopwatchID, { Entities.editEntity(stopwatchID, {
@ -75,14 +72,16 @@ Entities.editEntity(stopwatchID, {
Entities.editEntity(startStopButtonID, { Entities.editEntity(startStopButtonID, {
userData: JSON.stringify({ userData: JSON.stringify({
stopwatchID: stopwatchID stopwatchID: stopwatchID,
grabbableKey: { wantsTrigger: true }
}), }),
script: Script.resolvePath("stopwatchStartStop.js") script: Script.resolvePath("stopwatchStartStop.js")
}); });
Entities.editEntity(resetButtonID, { Entities.editEntity(resetButtonID, {
userData: JSON.stringify({ userData: JSON.stringify({
stopwatchID: stopwatchID stopwatchID: stopwatchID,
grabbableKey: { wantsTrigger: true }
}), }),
script: Script.resolvePath("stopwatchReset.js") script: Script.resolvePath("stopwatchReset.js")
}); });