Merge pull request #9636 from huffman/feat/stopwatch-updates

Stopwatch updates
This commit is contained in:
Clément Brisset 2017-02-09 14:11:45 -08:00 committed by GitHub
commit 20c8c8c278
7 changed files with 18 additions and 11 deletions

View file

@ -8,34 +8,39 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
var positionToSpawn = Vec3.sum(MyAvatar.position, Quat.getFront(MyAvatar.rotation)); var forward = Quat.getFront(MyAvatar.orientation);
Vec3.print("Forward: ", forward);
var positionToSpawn = Vec3.sum(MyAvatar.position, Vec3.multiply(3, forward));
var scale = 0.5;
positionToSpawn.y += 0.5;
var stopwatchID = Entities.addEntity({ var stopwatchID = Entities.addEntity({
type: "Model", type: "Model",
name: "stopwatch/base", name: "stopwatch/base",
position: positionToSpawn, position: positionToSpawn,
modelURL: "http://hifi-content.s3.amazonaws.com/alan/dev/Stopwatch.fbx", modelURL: Script.resolvePath("models/Stopwatch.fbx"),
dimensions: {"x":4.129462242126465,"y":1.058512806892395,"z":5.773681640625} dimensions: Vec3.multiply(scale, {"x":4.129462242126465,"y":1.058512806892395,"z":5.773681640625}),
rotation: Quat.multiply(MyAvatar.orientation, Quat.fromPitchYawRollDegrees(90, 0, 0))
}); });
var secondHandID = Entities.addEntity({ var secondHandID = Entities.addEntity({
type: "Model", type: "Model",
name: "stopwatch/seconds", name: "stopwatch/seconds",
parentID: stopwatchID, parentID: stopwatchID,
localPosition: {"x":-0.004985813982784748,"y":0.39391064643859863,"z":0.8312804698944092}, localPosition: Vec3.multiply(scale, {"x":-0.004985813982784748,"y":0.39391064643859863,"z":0.8312804698944092}),
dimensions: {"x":0.14095762372016907,"y":0.02546107769012451,"z":1.6077008247375488}, dimensions: Vec3.multiply(scale, {"x":0.14095762372016907,"y":0.02546107769012451,"z":1.6077008247375488}),
registrationPoint: {"x":0.5,"y":0.5,"z":1}, registrationPoint: {"x":0.5,"y":0.5,"z":1},
modelURL: "http://hifi-content.s3.amazonaws.com/alan/dev/Stopwatch-sec-hand.fbx", modelURL: Script.resolvePath("models/Stopwatch-sec-hand.fbx"),
}); });
var minuteHandID = Entities.addEntity({ var minuteHandID = Entities.addEntity({
type: "Model", type: "Model",
name: "stopwatch/minutes", name: "stopwatch/minutes",
parentID: stopwatchID, parentID: stopwatchID,
localPosition: {"x":-0.0023056098725646734,"y":0.3308190703392029,"z":0.21810021996498108}, localPosition: Vec3.multiply(scale, {"x":-0.0023056098725646734,"y":0.3308190703392029,"z":0.21810021996498108}),
dimensions: {"x":0.045471154153347015,"y":0.015412690117955208,"z":0.22930574417114258}, dimensions: Vec3.multiply(scale, {"x":0.045471154153347015,"y":0.015412690117955208,"z":0.22930574417114258}),
registrationPoint: {"x":0.5,"y":0.5,"z":1}, registrationPoint: {"x":0.5,"y":0.5,"z":1},
modelURL: "http://hifi-content.s3.amazonaws.com/alan/dev/Stopwatch-min-hand.fbx", modelURL: Script.resolvePath("models/Stopwatch-min-hand.fbx"),
}); });
Entities.editEntity(stopwatchID, { Entities.editEntity(stopwatchID, {
@ -46,3 +51,5 @@ Entities.editEntity(stopwatchID, {
script: Script.resolvePath("stopwatchClient.js"), script: Script.resolvePath("stopwatchClient.js"),
serverScripts: Script.resolvePath("stopwatchServer.js") serverScripts: Script.resolvePath("stopwatchServer.js")
}); });
Script.stop()

View file

@ -17,11 +17,11 @@
self.secondHandID = null; self.secondHandID = null;
self.minuteHandID = null; self.minuteHandID = null;
self.tickSound = SoundCache.getSound("https://hifi-public.s3.amazonaws.com/huffman/tick.wav"); self.tickSound = SoundCache.getSound(Script.resolvePath("sounds/tick.wav"));
self.tickInjector = null; self.tickInjector = null;
self.tickIntervalID = null; self.tickIntervalID = null;
self.chimeSound = SoundCache.getSound("https://hifi-public.s3.amazonaws.com/huffman/chime.wav"); self.chimeSound = SoundCache.getSound(Script.resolvePath("sounds/chime.wav"));
self.preload = function(entityID) { self.preload = function(entityID) {
print("Preloading stopwatch: ", entityID); print("Preloading stopwatch: ", entityID);