From 56a2aa101cc6d45f93cfeed60134a1598c6c0578 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Mon, 12 Oct 2015 10:44:18 -0700 Subject: [PATCH] baseline judder test for whiteboard painting- pre entity ray test --- .../whiteboard/whiteboardEntityScript.js | 48 +++++++++++++++++++ .../painting/whiteboard/whiteboardSpawner.js | 10 +++- 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 examples/painting/whiteboard/whiteboardEntityScript.js diff --git a/examples/painting/whiteboard/whiteboardEntityScript.js b/examples/painting/whiteboard/whiteboardEntityScript.js new file mode 100644 index 0000000000..da2e06d397 --- /dev/null +++ b/examples/painting/whiteboard/whiteboardEntityScript.js @@ -0,0 +1,48 @@ +// +// whiteBoardEntityScript.js +// examples/painting/whiteboard +// +// Created by Eric Levin on 10/12/15. +// Copyright 2015 High Fidelity, Inc. +// + +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html + +/*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, pointInExtents, vec3equal, setEntityCustomData, getEntityCustomData */ + +/*global Whiteboard */ + +(function() { + + var _this; + Whiteboard = function() { + _this = this; + }; + + Whiteboard.prototype = { + + setRightHand: function() { + this.hand = 'RIGHT'; + }, + + setLeftHand: function() { + this.hand = 'LEFT'; + }, + + startFarGrabNonColliding: function() { + this.whichHand = this.hand; + }, + + continueFarGrabbingNonColliding: function() {}, + + preload: function(entityID) { + this.entityID = entityID; + this.position = Entities.getEntityProperties(this.entityID, "position").position; + }, + + }; + + // entity scripts always need to return a newly constructed object of our type + return new Whiteboard(); +}); \ No newline at end of file diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index bf6253c0ac..31a72212c3 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -1,5 +1,5 @@ // -// whiteBoard.js +// whiteBoardSpawner.js // examples/painting // // Created by Eric Levina on 10/12/15. @@ -10,16 +10,22 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +/*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, pointInExtents, vec3equal, setEntityCustomData, getEntityCustomData */ + + Script.include("../../libraries/utils.js"); +var scriptURL = Script.resolvePath("whiteBoardEntityScript.js"); var rotation = Quat.safeEulerAngles(Camera.getOrientation()); -rotation = Quat.fromPitchYawRollDegrees(0, rotation.y, 0) +rotation = Quat.fromPitchYawRollDegrees(0, rotation.y, 0); var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(rotation))); +center.y += 0.4; var whiteboard = Entities.addEntity({ type: "Box", position: center, rotation: rotation, + script: scriptURL, dimensions: {x: 2, y: 1.5, z: 0.01}, color: {red: 255, green: 255, blue: 255} });