From 837430329b2df0aae07d1608933d1fa3e8a34dba Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Mon, 26 Oct 2015 13:02:17 -0700 Subject: [PATCH 01/30] Fix collision start/end in single physics simulation to be lost --- libraries/physics/src/PhysicsEngine.cpp | 9 ++++++--- libraries/physics/src/ThreadSafeDynamicsWorld.cpp | 3 ++- libraries/physics/src/ThreadSafeDynamicsWorld.h | 6 +++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/libraries/physics/src/PhysicsEngine.cpp b/libraries/physics/src/PhysicsEngine.cpp index 75273e62ba..1e87fc9a5d 100644 --- a/libraries/physics/src/PhysicsEngine.cpp +++ b/libraries/physics/src/PhysicsEngine.cpp @@ -251,7 +251,12 @@ void PhysicsEngine::stepSimulation() { _characterController->preSimulation(timeStep); } - int numSubsteps = _dynamicsWorld->stepSimulation(timeStep, PHYSICS_ENGINE_MAX_NUM_SUBSTEPS, PHYSICS_ENGINE_FIXED_SUBSTEP); + auto onSubStep = [this]() { + updateContactMap(); + _hasOutgoingChanges = true; + }; + + int numSubsteps = _dynamicsWorld->stepSimulation(timeStep, PHYSICS_ENGINE_MAX_NUM_SUBSTEPS, PHYSICS_ENGINE_FIXED_SUBSTEP, onSubStep); if (numSubsteps > 0) { BT_PROFILE("postSimulation"); _numSubsteps += (uint32_t)numSubsteps; @@ -260,8 +265,6 @@ void PhysicsEngine::stepSimulation() { if (_characterController) { _characterController->postSimulation(); } - updateContactMap(); - _hasOutgoingChanges = true; } } diff --git a/libraries/physics/src/ThreadSafeDynamicsWorld.cpp b/libraries/physics/src/ThreadSafeDynamicsWorld.cpp index b59103339c..8bf7cdab20 100644 --- a/libraries/physics/src/ThreadSafeDynamicsWorld.cpp +++ b/libraries/physics/src/ThreadSafeDynamicsWorld.cpp @@ -27,7 +27,7 @@ ThreadSafeDynamicsWorld::ThreadSafeDynamicsWorld( : btDiscreteDynamicsWorld(dispatcher, pairCache, constraintSolver, collisionConfiguration) { } -int ThreadSafeDynamicsWorld::stepSimulation( btScalar timeStep, int maxSubSteps, btScalar fixedTimeStep) { +int ThreadSafeDynamicsWorld::stepSimulation( btScalar timeStep, int maxSubSteps, btScalar fixedTimeStep, SubStepCallback onSubStep) { BT_PROFILE("stepSimulation"); int subSteps = 0; if (maxSubSteps) { @@ -70,6 +70,7 @@ int ThreadSafeDynamicsWorld::stepSimulation( btScalar timeStep, int maxSubSteps, for (int i=0;i + +using SubStepCallback = std::function; + ATTRIBUTE_ALIGNED16(class) ThreadSafeDynamicsWorld : public btDiscreteDynamicsWorld { public: BT_DECLARE_ALIGNED_ALLOCATOR(); @@ -34,7 +38,7 @@ public: btCollisionConfiguration* collisionConfiguration); // virtual overrides from btDiscreteDynamicsWorld - int stepSimulation( btScalar timeStep, int maxSubSteps=1, btScalar fixedTimeStep=btScalar(1.)/btScalar(60.)); + int stepSimulation( btScalar timeStep, int maxSubSteps=1, btScalar fixedTimeStep=btScalar(1.)/btScalar(60.), SubStepCallback onSubStep = []() { }); void synchronizeMotionStates(); // btDiscreteDynamicsWorld::m_localTime is the portion of real-time that has not yet been simulated From 913026280c082a0d7df6311a1136ca95e45afac1 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Mon, 26 Oct 2015 13:02:39 -0700 Subject: [PATCH 02/30] Fix EntityTreeRenderer dropping contact end events --- libraries/entities-renderer/src/EntityTreeRenderer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index d5bf0bde8a..bed6ae1d0f 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -774,7 +774,7 @@ void EntityTreeRenderer::entityCollisionWithEntity(const EntityItemID& idA, cons } // Don't respond to small continuous contacts. const float COLLISION_MINUMUM_PENETRATION = 0.002f; - if ((collision.type != CONTACT_EVENT_TYPE_START) && (glm::length(collision.penetration) < COLLISION_MINUMUM_PENETRATION)) { + if ((collision.type == CONTACT_EVENT_TYPE_CONTINUE) && (glm::length(collision.penetration) < COLLISION_MINUMUM_PENETRATION)) { return; } From f5d12ee2c60a139cbde514d3a398cdbe098f60f3 Mon Sep 17 00:00:00 2001 From: black plastick Date: Mon, 26 Oct 2015 17:46:08 -0400 Subject: [PATCH 03/30] Added AvatarList script events for assigment client scripts: AvatarList.avatarAddedEvent(sessionUUID); AvatarList.avatarRemovedEvent(sessionUUID); --- assignment-client/src/avatars/AvatarMixer.cpp | 4 ++-- libraries/avatars/src/AvatarHashMap.cpp | 4 +++- libraries/avatars/src/AvatarHashMap.h | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/assignment-client/src/avatars/AvatarMixer.cpp b/assignment-client/src/avatars/AvatarMixer.cpp index 833b53b729..ae6a8247c1 100644 --- a/assignment-client/src/avatars/AvatarMixer.cpp +++ b/assignment-client/src/avatars/AvatarMixer.cpp @@ -254,10 +254,10 @@ void AvatarMixer::broadcastAvatarData() { // potentially update the max full rate distance for this frame maxAvatarDistanceThisFrame = std::max(maxAvatarDistanceThisFrame, distanceToAvatar); - if (distanceToAvatar != 0.0f + if (distanceToAvatar != 0.0f && distribution(generator) > (nodeData->getFullRateDistance() / distanceToAvatar)) { return; - } + } AvatarDataSequenceNumber lastSeqToReceiver = nodeData->getLastBroadcastSequenceNumber(otherNode->getUUID()); AvatarDataSequenceNumber lastSeqFromSender = otherNodeData->getLastReceivedSequenceNumber(); diff --git a/libraries/avatars/src/AvatarHashMap.cpp b/libraries/avatars/src/AvatarHashMap.cpp index 520bb34887..c02fe98b19 100644 --- a/libraries/avatars/src/AvatarHashMap.cpp +++ b/libraries/avatars/src/AvatarHashMap.cpp @@ -44,7 +44,7 @@ AvatarSharedPointer AvatarHashMap::addAvatar(const QUuid& sessionUUID, const QWe avatar->setSessionUUID(sessionUUID); avatar->setOwningAvatarMixer(mixerWeakPointer); _avatarHash.insert(sessionUUID, avatar); - + emit avatarAddedEvent(sessionUUID); return avatar; } @@ -131,10 +131,12 @@ void AvatarHashMap::processKillAvatar(QSharedPointer packet, SharedNod // read the node id QUuid sessionUUID = QUuid::fromRfc4122(packet->readWithoutCopy(NUM_BYTES_RFC4122_UUID)); removeAvatar(sessionUUID); + } void AvatarHashMap::removeAvatar(const QUuid& sessionUUID) { _avatarHash.remove(sessionUUID); + emit avatarRemovedEvent(sessionUUID); } void AvatarHashMap::sessionUUIDChanged(const QUuid& sessionUUID, const QUuid& oldUUID) { diff --git a/libraries/avatars/src/AvatarHashMap.h b/libraries/avatars/src/AvatarHashMap.h index 804233b76a..f90c61ec4d 100644 --- a/libraries/avatars/src/AvatarHashMap.h +++ b/libraries/avatars/src/AvatarHashMap.h @@ -33,6 +33,10 @@ public: const AvatarHash& getAvatarHash() { return _avatarHash; } int size() { return _avatarHash.size(); } +signals: + void avatarAddedEvent(const QUuid& sessionUUID); + void avatarRemovedEvent(const QUuid& sessionUUID); + public slots: bool isAvatarInRange(const glm::vec3 & position, const float range); From d34fc35544fa38715d1990f0e09f3201c1f68679 Mon Sep 17 00:00:00 2001 From: black plastick Date: Tue, 27 Oct 2015 08:11:20 -0400 Subject: [PATCH 04/30] added AvatarList.avatarSessionChanged(sessionUUID, oldUUID) for AC scripts. --- assignment-client/src/avatars/AvatarMixer.cpp | 6 +++--- libraries/avatars/src/AvatarHashMap.cpp | 1 + libraries/avatars/src/AvatarHashMap.h | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/assignment-client/src/avatars/AvatarMixer.cpp b/assignment-client/src/avatars/AvatarMixer.cpp index ae6a8247c1..0a455891f9 100644 --- a/assignment-client/src/avatars/AvatarMixer.cpp +++ b/assignment-client/src/avatars/AvatarMixer.cpp @@ -254,10 +254,10 @@ void AvatarMixer::broadcastAvatarData() { // potentially update the max full rate distance for this frame maxAvatarDistanceThisFrame = std::max(maxAvatarDistanceThisFrame, distanceToAvatar); - if (distanceToAvatar != 0.0f + if (distanceToAvatar != 0.0f && distribution(generator) > (nodeData->getFullRateDistance() / distanceToAvatar)) { - return; - } + return; + } AvatarDataSequenceNumber lastSeqToReceiver = nodeData->getLastBroadcastSequenceNumber(otherNode->getUUID()); AvatarDataSequenceNumber lastSeqFromSender = otherNodeData->getLastReceivedSequenceNumber(); diff --git a/libraries/avatars/src/AvatarHashMap.cpp b/libraries/avatars/src/AvatarHashMap.cpp index c02fe98b19..ddc9160041 100644 --- a/libraries/avatars/src/AvatarHashMap.cpp +++ b/libraries/avatars/src/AvatarHashMap.cpp @@ -141,4 +141,5 @@ void AvatarHashMap::removeAvatar(const QUuid& sessionUUID) { void AvatarHashMap::sessionUUIDChanged(const QUuid& sessionUUID, const QUuid& oldUUID) { _lastOwnerSessionUUID = oldUUID; + emit avatarSessionChangedEvent(sessionUUID, oldUUID); } diff --git a/libraries/avatars/src/AvatarHashMap.h b/libraries/avatars/src/AvatarHashMap.h index f90c61ec4d..c0c511bc3a 100644 --- a/libraries/avatars/src/AvatarHashMap.h +++ b/libraries/avatars/src/AvatarHashMap.h @@ -36,6 +36,7 @@ public: signals: void avatarAddedEvent(const QUuid& sessionUUID); void avatarRemovedEvent(const QUuid& sessionUUID); + void avatarSessionChangedEvent(const QUuid& sessionUUID,const QUuid& oldUUID); public slots: bool isAvatarInRange(const glm::vec3 & position, const float range); From 8a85468254d5cdbbc79a38528ed4e78cf25453eb Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 27 Oct 2015 10:39:44 -0700 Subject: [PATCH 05/30] changing model, repositioning --- .../whiteboard/whiteboardEntityScript.js | 2 +- .../painting/whiteboard/whiteboardSpawner.js | 241 ++++++++---------- 2 files changed, 107 insertions(+), 136 deletions(-) diff --git a/examples/painting/whiteboard/whiteboardEntityScript.js b/examples/painting/whiteboard/whiteboardEntityScript.js index f38073f389..2d34fc8c40 100644 --- a/examples/painting/whiteboard/whiteboardEntityScript.js +++ b/examples/painting/whiteboard/whiteboardEntityScript.js @@ -239,7 +239,7 @@ unload: function() { Overlays.deleteOverlay(this.laserPointer); - // this.eraseBoard(); + this.eraseBoard(); } }; diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index cbc26da670..0804b992c7 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -16,13 +16,16 @@ Script.include("../../libraries/utils.js"); var scriptURL = Script.resolvePath("whiteboardEntityScript.js"); +//var modelURL = "https://hifi-public.s3.amazonaws.com/ozan/support/for_eric/whiteboard/whiteboard.fbx"; +var modelURL = "http://localhost:8080/whiteboard.fbx?v1" + Math.random(); var rotation = Quat.safeEulerAngles(Camera.getOrientation()); rotation = Quat.fromPitchYawRollDegrees(0, rotation.y, 0); var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(rotation))); -center.y += 0.4; + +var whiteboardDimensions, colorIndicator, eraseAllText +var colorBoxes = []; var colors = [ - hexToRgb("#2F8E84"), hexToRgb("#66CCB3"), hexToRgb("#A43C37"), hexToRgb("#491849"), @@ -30,21 +33,13 @@ var colors = [ hexToRgb("#993369"), hexToRgb("#9B47C2") ]; - -//WHITEBOARD -var whiteboardDimensions = { - x: 2, - y: 1.5, - z: 0.08 -}; var whiteboard = Entities.addEntity({ type: "Model", - modelURL: "https://hifi-public.s3.amazonaws.com/ozan/support/for_eric/whiteboard/whiteboard.fbx", + modelURL: modelURL, name: "whiteboard", position: center, rotation: rotation, script: scriptURL, - dimensions: whiteboardDimensions, color: { red: 255, green: 255, @@ -52,144 +47,119 @@ var whiteboard = Entities.addEntity({ } }); +Script.setTimeout(function() { + whiteboardDimensions = Entities.getEntityProperties(whiteboard, "naturalDimensions").naturalDimensions; + setUp(); +}, 500) -// COLOR INDICATOR BOX -var colorIndicatorDimensions = { - x: whiteboardDimensions.x, - y: 0.05, - z: 0.02 -}; -scriptURL = Script.resolvePath("colorIndicatorEntityScript.js"); -var colorIndicatorPosition = Vec3.sum(center, { - x: 0, - y: whiteboardDimensions.y / 2 + colorIndicatorDimensions.y / 2, - z: 0 -}); -var colorIndicatorBox = Entities.addEntity({ - type: "Box", - name: "Color Indicator", - color: colors[0], - rotation: rotation, - position: colorIndicatorPosition, - dimensions: colorIndicatorDimensions, - script: scriptURL, - userData: JSON.stringify({ - whiteboard: whiteboard - }) -}); -Entities.editEntity(whiteboard, { - userData: JSON.stringify({ - color: { - currentColor: colors[0] - }, - colorIndicator: colorIndicatorBox - }) -}); - -//COLOR BOXES -var direction = Quat.getRight(rotation); -var colorBoxPosition = Vec3.subtract(center, Vec3.multiply(direction, whiteboardDimensions.x / 2)); -var colorBoxes = []; -var colorSquareDimensions = { - x: (whiteboardDimensions.x / 2) / (colors.length - 1), - y: 0.1, - z: 0.05 -}; -colorBoxPosition.y += whiteboardDimensions.y / 2 + colorIndicatorDimensions.y + colorSquareDimensions.y / 2; -var spaceBetweenColorBoxes = Vec3.multiply(direction, colorSquareDimensions.x * 2); -var scriptURL = Script.resolvePath("colorSelectorEntityScript.js"); -for (var i = 0; i < colors.length; i++) { - var colorBox = Entities.addEntity({ +function setUp() { + // COLOR INDICATOR BOX + var colorIndicatorDimensions = { + x: whiteboardDimensions.x, + y: 0.05, + z: 0.02 + }; + scriptURL = Script.resolvePath("colorIndicatorEntityScript.js"); + var colorIndicatorPosition = Vec3.sum(center, { + x: 0, + y: whiteboardDimensions.y / 2 + colorIndicatorDimensions.y / 2, + z: 0 + }); + colorIndicatorBox = Entities.addEntity({ type: "Box", - name: "Color Selector", - position: colorBoxPosition, - dimensions: colorSquareDimensions, + name: "Color Indicator", + color: colors[0], rotation: rotation, - color: colors[i], + position: colorIndicatorPosition, + dimensions: colorIndicatorDimensions, script: scriptURL, userData: JSON.stringify({ - whiteboard: whiteboard, + whiteboard: whiteboard + }) + }); + + Entities.editEntity(whiteboard, { + userData: JSON.stringify({ + color: { + currentColor: colors[0] + }, colorIndicator: colorIndicatorBox }) }); - colorBoxes.push(colorBox); - colorBoxPosition = Vec3.sum(colorBoxPosition, spaceBetweenColorBoxes); + + //COLOR BOXES + var direction = Quat.getRight(rotation); + var colorBoxPosition = Vec3.subtract(center, Vec3.multiply(direction, whiteboardDimensions.x / 2)); + var colorSquareDimensions = { + x: 0.1, + y: 0.1, + z: 0.002 + }; + colorBoxPosition.y += whiteboardDimensions.y / 2 + colorIndicatorDimensions.y + colorSquareDimensions.y / 2; + var spaceBetweenColorBoxes = Vec3.multiply(direction, colorSquareDimensions.x * 2); + var scriptURL = Script.resolvePath("colorSelectorEntityScript.js"); + for (var i = 0; i < colors.length; i++) { + var colorBox = Entities.addEntity({ + type: "Box", + name: "Color Selector", + position: colorBoxPosition, + dimensions: colorSquareDimensions, + rotation: rotation, + color: colors[i], + script: scriptURL, + userData: JSON.stringify({ + whiteboard: whiteboard, + colorIndicator: colorIndicatorBox + }) + }); + colorBoxes.push(colorBox); + colorBoxPosition = Vec3.sum(colorBoxPosition, spaceBetweenColorBoxes); + } + + + + var eraseBoxDimensions = { + x: 0.5, + y: 0.1, + z: 0.01 + }; + + + var eraseBoxPosition = Vec3.sum(center, Vec3.multiply(direction, whiteboardDimensions.x / 2 + eraseBoxDimensions.x / 2 + 0.01)); + eraseBoxPosition.y += 0.3; + scriptURL = Script.resolvePath("eraseBoardEntityScript.js"); + eraseAllText = Entities.addEntity({ + type: "Text", + position: eraseBoxPosition, + name: "Eraser", + script: scriptURL, + rotation: rotation, + dimensions: eraseBoxDimensions, + backgroundColor: { + red: 0, + green: 60, + blue: 0 + }, + textColor: { + red: 255, + green: 10, + blue: 10 + }, + text: "ERASE BOARD", + lineHeight: 0.07, + userData: JSON.stringify({ + whiteboard: whiteboard + }) + }); + + + } - -// BLACK BOX -var blackBoxDimensions = { - x: 0.3, - y: 0.3, - z: 0.01 -}; - -colorBoxPosition = Vec3.subtract(center, Vec3.multiply(direction, whiteboardDimensions.x / 2 + blackBoxDimensions.x / 2 - 0.01)); -colorBoxPosition.y += 0.3; -var fragShaderURL = Script.resolvePath('blackInk.fs?v1' + Math.random()); -var blackBox = Entities.addEntity({ - type: 'Box', - name: "Black Color", - position: colorBoxPosition, - dimensions: blackBoxDimensions, - rotation: rotation, - color: { - red: 0, - green: 0, - blue: 0 - }, - script: scriptURL, - userData: JSON.stringify({ - whiteboard: whiteboard, - version: 2, - ProceduralEntity: { - shaderUrl: fragShaderURL - } - }) -}); - - -var eraseBoxDimensions = { - x: 0.5, - y: 0.1, - z: 0.01 -}; - - -var eraseBoxPosition = Vec3.sum(center, Vec3.multiply(direction, whiteboardDimensions.x / 2 + eraseBoxDimensions.x / 2 + 0.01)); -eraseBoxPosition.y += 0.3; -scriptURL = Script.resolvePath("eraseBoardEntityScript.js"); -var eraseAllText = Entities.addEntity({ - type: "Text", - position: eraseBoxPosition, - name: "Eraser", - script: scriptURL, - rotation: rotation, - dimensions: eraseBoxDimensions, - backgroundColor: { - red: 0, - green: 60, - blue: 0 - }, - textColor: { - red: 255, - green: 10, - blue: 10 - }, - text: "ERASE BOARD", - lineHeight: 0.07, - userData: JSON.stringify({ - whiteboard: whiteboard - }) -}); - - - function cleanup() { Entities.deleteEntity(whiteboard); Entities.deleteEntity(eraseAllText); - Entities.deleteEntity(blackBox); Entities.deleteEntity(colorIndicatorBox); colorBoxes.forEach(function(colorBox) { Entities.deleteEntity(colorBox); @@ -197,5 +167,6 @@ function cleanup() { } + // Uncomment this line to delete whiteboard and all associated entity on script close Script.scriptEnding.connect(cleanup); \ No newline at end of file From fa22249f7a25a822791a20ae186829ef11630713 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 27 Oct 2015 12:03:30 -0700 Subject: [PATCH 06/30] Improving model --- .../painting/whiteboard/whiteboardSpawner.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index 0804b992c7..2de9821810 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -31,7 +31,7 @@ var colors = [ hexToRgb("#491849"), hexToRgb("#6AB03B"), hexToRgb("#993369"), - hexToRgb("#9B47C2") + hexToRgb("#000000") ]; var whiteboard = Entities.addEntity({ type: "Model", @@ -92,12 +92,19 @@ function setUp() { var direction = Quat.getRight(rotation); var colorBoxPosition = Vec3.subtract(center, Vec3.multiply(direction, whiteboardDimensions.x / 2)); var colorSquareDimensions = { - x: 0.1, - y: 0.1, + x: 0.13, + y: 0.13, z: 0.002 }; - colorBoxPosition.y += whiteboardDimensions.y / 2 + colorIndicatorDimensions.y + colorSquareDimensions.y / 2; - var spaceBetweenColorBoxes = Vec3.multiply(direction, colorSquareDimensions.x * 2); + + var palleteDepthOffset = -0.06; + var palleteHeightOffset = -0.28; + + colorBoxPosition = Vec3.sum(colorBoxPosition, Vec3.multiply(palleteDepthOffset, Quat.getFront(rotation))); + colorBoxPosition.y += palleteHeightOffset; + var spaceBetweenColorBoxes = Vec3.multiply(direction, colorSquareDimensions.x * 1.76); + var palleteXOffset = Vec3.multiply(direction, 0.43); + colorBoxPosition = Vec3.sum(colorBoxPosition, palleteXOffset); var scriptURL = Script.resolvePath("colorSelectorEntityScript.js"); for (var i = 0; i < colors.length; i++) { var colorBox = Entities.addEntity({ From f0a1335957aa0a80d61ecca1ddf98f03c4b03c4d Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 27 Oct 2015 12:09:07 -0700 Subject: [PATCH 07/30] fixed paint initially showing up white --- examples/painting/whiteboard/whiteboardSpawner.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index 2de9821810..6a4f800441 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -44,7 +44,12 @@ var whiteboard = Entities.addEntity({ red: 255, green: 255, blue: 255 - } + }, + userData: JSON.stringify({ + color: { + currentColor: colors[0] + } + }) }); Script.setTimeout(function() { From 8fcc07102699807e6eee5392c6765df9076e3ade Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 27 Oct 2015 12:24:29 -0700 Subject: [PATCH 08/30] only can draw on whiteboard --- .../painting/whiteboard/whiteboardSpawner.js | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index 6a4f800441..366aa2b73d 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -33,24 +33,32 @@ var colors = [ hexToRgb("#993369"), hexToRgb("#000000") ]; + var whiteboard = Entities.addEntity({ type: "Model", modelURL: modelURL, - name: "whiteboard", + name: "whiteboard base", position: center, rotation: rotation, +}); + +var surfaceCenter = Vec3.sum(center, Vec3.multiply(-0.1, Quat.getFront(rotation))); +surfaceCenter.y += 0.55; +var drawingSurface = Entities.addEntity({ + type: "Box", + color: {red: 255, green: 255, blue: 255}, + name: "whiteboard surface", + position: surfaceCenter, + dimensions: {x: 1.8, y: 1.4, z: 0.01}, script: scriptURL, - color: { - red: 255, - green: 255, - blue: 255 - }, - userData: JSON.stringify({ + rotation: rotation, + userData: JSON.stringify({ color: { currentColor: colors[0] } }) -}); + +}) Script.setTimeout(function() { whiteboardDimensions = Entities.getEntityProperties(whiteboard, "naturalDimensions").naturalDimensions; @@ -80,11 +88,11 @@ function setUp() { dimensions: colorIndicatorDimensions, script: scriptURL, userData: JSON.stringify({ - whiteboard: whiteboard + whiteboard: drawingSurface }) }); - Entities.editEntity(whiteboard, { + Entities.editEntity(drawingSurface, { userData: JSON.stringify({ color: { currentColor: colors[0] @@ -121,7 +129,7 @@ function setUp() { color: colors[i], script: scriptURL, userData: JSON.stringify({ - whiteboard: whiteboard, + whiteboard: drawingSurface, colorIndicator: colorIndicatorBox }) }); @@ -161,7 +169,7 @@ function setUp() { text: "ERASE BOARD", lineHeight: 0.07, userData: JSON.stringify({ - whiteboard: whiteboard + whiteboard: drawingSurface }) }); @@ -171,6 +179,7 @@ function setUp() { function cleanup() { Entities.deleteEntity(whiteboard); + Entities.deleteEntity(drawingSurface); Entities.deleteEntity(eraseAllText); Entities.deleteEntity(colorIndicatorBox); colorBoxes.forEach(function(colorBox) { From 25ded2bd9212f5c26a5285c64a79e8195fd18e16 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 27 Oct 2015 13:03:44 -0700 Subject: [PATCH 09/30] added shapetype --- examples/painting/whiteboard/whiteboardSpawner.js | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index 366aa2b73d..a7cfc0719a 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -36,6 +36,7 @@ var colors = [ var whiteboard = Entities.addEntity({ type: "Model", + shapeType: "box", modelURL: modelURL, name: "whiteboard base", position: center, From 0512da0e3971c21c57cb5c8e1233e3ba801004b2 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 27 Oct 2015 13:07:11 -0700 Subject: [PATCH 10/30] updated url --- examples/painting/whiteboard/whiteboardSpawner.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index a7cfc0719a..16953129af 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -17,7 +17,8 @@ Script.include("../../libraries/utils.js"); var scriptURL = Script.resolvePath("whiteboardEntityScript.js"); //var modelURL = "https://hifi-public.s3.amazonaws.com/ozan/support/for_eric/whiteboard/whiteboard.fbx"; -var modelURL = "http://localhost:8080/whiteboard.fbx?v1" + Math.random(); +//var modelURL = "http://localhost:8080/whiteboard.fbx?v1" + Math.random(); +var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/whiteboard.fbx"; var rotation = Quat.safeEulerAngles(Camera.getOrientation()); rotation = Quat.fromPitchYawRollDegrees(0, rotation.y, 0); var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(rotation))); From ed6a866ff9dddc7b6cf1aee39bdaf9b3f52e1eda Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 27 Oct 2015 13:43:13 -0700 Subject: [PATCH 11/30] ready for demo --- examples/painting/whiteboard/whiteboardEntityScript.js | 2 +- examples/painting/whiteboard/whiteboardSpawner.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/painting/whiteboard/whiteboardEntityScript.js b/examples/painting/whiteboard/whiteboardEntityScript.js index 2d34fc8c40..f38073f389 100644 --- a/examples/painting/whiteboard/whiteboardEntityScript.js +++ b/examples/painting/whiteboard/whiteboardEntityScript.js @@ -239,7 +239,7 @@ unload: function() { Overlays.deleteOverlay(this.laserPointer); - this.eraseBoard(); + // this.eraseBoard(); } }; diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index 16953129af..82d7f63239 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -17,7 +17,7 @@ Script.include("../../libraries/utils.js"); var scriptURL = Script.resolvePath("whiteboardEntityScript.js"); //var modelURL = "https://hifi-public.s3.amazonaws.com/ozan/support/for_eric/whiteboard/whiteboard.fbx"; -//var modelURL = "http://localhost:8080/whiteboard.fbx?v1" + Math.random(); +// var modelURL = "http://localhost:8080/whiteboard.fbx?v1" + Math.random(); var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/whiteboard.fbx"; var rotation = Quat.safeEulerAngles(Camera.getOrientation()); rotation = Quat.fromPitchYawRollDegrees(0, rotation.y, 0); @@ -192,4 +192,4 @@ function cleanup() { // Uncomment this line to delete whiteboard and all associated entity on script close -Script.scriptEnding.connect(cleanup); \ No newline at end of file +// Script.scriptEnding.connect(cleanup); \ No newline at end of file From d67f4958cdab2d60d2b7e08654e5b62667fbcb20 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 27 Oct 2015 13:44:29 -0700 Subject: [PATCH 12/30] wait longer for dimensions --- examples/painting/whiteboard/whiteboardSpawner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index 82d7f63239..4303803266 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -65,7 +65,7 @@ var drawingSurface = Entities.addEntity({ Script.setTimeout(function() { whiteboardDimensions = Entities.getEntityProperties(whiteboard, "naturalDimensions").naturalDimensions; setUp(); -}, 500) +}, 1000) function setUp() { From 2f835b19fa1c181513412293964ebce6c1f5f30f Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 27 Oct 2015 17:17:19 -0700 Subject: [PATCH 13/30] surface is now a model --- .../painting/whiteboard/whiteboardSpawner.js | 42 +++++++++++++------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index 4303803266..037be61459 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -17,13 +17,17 @@ Script.include("../../libraries/utils.js"); var scriptURL = Script.resolvePath("whiteboardEntityScript.js"); //var modelURL = "https://hifi-public.s3.amazonaws.com/ozan/support/for_eric/whiteboard/whiteboard.fbx"; -// var modelURL = "http://localhost:8080/whiteboard.fbx?v1" + Math.random(); -var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/whiteboard.fbx"; +var modelURL = "http://localhost:8080/whiteboard.fbx?v1" + Math.random(); +// var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/whiteboard.fbx"; + +var colorIndicatorBorderModelURL = "http://localhost:8080/colorIndicatorBorder.fbx?v1" + Math.random(); + +var surfaceModelURL = "http://localhost:8080/boardSurface.fbx?v1" + Math.random(); var rotation = Quat.safeEulerAngles(Camera.getOrientation()); rotation = Quat.fromPitchYawRollDegrees(0, rotation.y, 0); var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(rotation))); -var whiteboardDimensions, colorIndicator, eraseAllText +var whiteboardDimensions, colorIndicatorBoxDimensions, colorIndicatorBox, eraseAllText var colorBoxes = []; var colors = [ @@ -44,14 +48,26 @@ var whiteboard = Entities.addEntity({ rotation: rotation, }); +var colorIndicatorPosition = {x: center.x, y: center.y, z: center.z}; +colorIndicatorPosition.y += 1.55; +colorIndicatorPosition = Vec3.sum(colorIndicatorPosition, Vec3.multiply(-0.1, Quat.getFront(rotation))); +var colorIndicatorBorder = Entities.addEntity({ + type: "Model", + position: colorIndicatorPosition, + modelURL: colorIndicatorBorderModelURL, + rotation: rotation, + shapeType: "box" +}); + var surfaceCenter = Vec3.sum(center, Vec3.multiply(-0.1, Quat.getFront(rotation))); -surfaceCenter.y += 0.55; +surfaceCenter.y += 0.6; var drawingSurface = Entities.addEntity({ - type: "Box", - color: {red: 255, green: 255, blue: 255}, + type: "Model", + modelURL: surfaceModelURL, + shapeType: "box", name: "whiteboard surface", position: surfaceCenter, - dimensions: {x: 1.8, y: 1.4, z: 0.01}, + // dimensions: {x: 1.7, y: 1.3, z: 0.01}, script: scriptURL, rotation: rotation, userData: JSON.stringify({ @@ -64,15 +80,18 @@ var drawingSurface = Entities.addEntity({ Script.setTimeout(function() { whiteboardDimensions = Entities.getEntityProperties(whiteboard, "naturalDimensions").naturalDimensions; + colorIndicatorDimensions = Entities.getEntityProperties(colorIndicatorBorder, "naturalDimensions").naturalDimensions; setUp(); }, 1000) function setUp() { // COLOR INDICATOR BOX + + var colorIndicatorDimensions = { x: whiteboardDimensions.x, - y: 0.05, + y: 0.5, z: 0.02 }; scriptURL = Script.resolvePath("colorIndicatorEntityScript.js"); @@ -112,7 +131,7 @@ function setUp() { z: 0.002 }; - var palleteDepthOffset = -0.06; + var palleteDepthOffset = -0.07; var palleteHeightOffset = -0.28; colorBoxPosition = Vec3.sum(colorBoxPosition, Vec3.multiply(palleteDepthOffset, Quat.getFront(rotation))); @@ -139,8 +158,6 @@ function setUp() { colorBoxPosition = Vec3.sum(colorBoxPosition, spaceBetweenColorBoxes); } - - var eraseBoxDimensions = { x: 0.5, y: 0.1, @@ -182,6 +199,7 @@ function setUp() { function cleanup() { Entities.deleteEntity(whiteboard); Entities.deleteEntity(drawingSurface); + Entities.deleteEntity(colorIndicatorBorder); Entities.deleteEntity(eraseAllText); Entities.deleteEntity(colorIndicatorBox); colorBoxes.forEach(function(colorBox) { @@ -192,4 +210,4 @@ function cleanup() { // Uncomment this line to delete whiteboard and all associated entity on script close -// Script.scriptEnding.connect(cleanup); \ No newline at end of file +Script.scriptEnding.connect(cleanup); \ No newline at end of file From 40277823354d9ecd526628d799982356959d7e00 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Wed, 28 Oct 2015 13:18:57 -0700 Subject: [PATCH 14/30] Fixed issue with overlays disapearing on release grab --- .../whiteboard/whiteboardEntityScript.js | 4 + .../painting/whiteboard/whiteboardSpawner.js | 88 ++++++++----------- 2 files changed, 40 insertions(+), 52 deletions(-) diff --git a/examples/painting/whiteboard/whiteboardEntityScript.js b/examples/painting/whiteboard/whiteboardEntityScript.js index f38073f389..fffaa78a8c 100644 --- a/examples/painting/whiteboard/whiteboardEntityScript.js +++ b/examples/painting/whiteboard/whiteboardEntityScript.js @@ -47,6 +47,7 @@ if (this.painting) { return; } + this.whichHand = this.hand; if (this.hand === RIGHT_HAND) { this.getHandPosition = MyAvatar.getRightPalmPosition; this.getHandRotation = MyAvatar.getRightPalmRotation; @@ -183,6 +184,9 @@ }, releaseGrab: function() { + if(this.hand !== this.whichHand) { + return; + } this.stopPainting(); }, diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index 037be61459..c40a763bf6 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -22,12 +22,14 @@ var modelURL = "http://localhost:8080/whiteboard.fbx?v1" + Math.random(); var colorIndicatorBorderModelURL = "http://localhost:8080/colorIndicatorBorder.fbx?v1" + Math.random(); +var eraseModelURL = "http://localhost:8080/eraser.fbx?v1" + Math.random(); + var surfaceModelURL = "http://localhost:8080/boardSurface.fbx?v1" + Math.random(); var rotation = Quat.safeEulerAngles(Camera.getOrientation()); rotation = Quat.fromPitchYawRollDegrees(0, rotation.y, 0); var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(rotation))); -var whiteboardDimensions, colorIndicatorBoxDimensions, colorIndicatorBox, eraseAllText +var whiteboardDimensions, colorIndicatorBoxDimensions, colorIndicatorBox, eraser; var colorBoxes = []; var colors = [ @@ -48,7 +50,11 @@ var whiteboard = Entities.addEntity({ rotation: rotation, }); -var colorIndicatorPosition = {x: center.x, y: center.y, z: center.z}; +var colorIndicatorPosition = { + x: center.x, + y: center.y, + z: center.z +}; colorIndicatorPosition.y += 1.55; colorIndicatorPosition = Vec3.sum(colorIndicatorPosition, Vec3.multiply(-0.1, Quat.getFront(rotation))); var colorIndicatorBorder = Entities.addEntity({ @@ -60,27 +66,40 @@ var colorIndicatorBorder = Entities.addEntity({ }); var surfaceCenter = Vec3.sum(center, Vec3.multiply(-0.1, Quat.getFront(rotation))); -surfaceCenter.y += 0.6; +surfaceCenter.y += 0.6; var drawingSurface = Entities.addEntity({ type: "Model", modelURL: surfaceModelURL, shapeType: "box", name: "whiteboard surface", position: surfaceCenter, - // dimensions: {x: 1.7, y: 1.3, z: 0.01}, script: scriptURL, - rotation: rotation, - userData: JSON.stringify({ + rotation: rotation, + userData: JSON.stringify({ color: { currentColor: colors[0] } }) -}) +}); + +var eraseModelPosition = Vec3.sum(center, {x: 0, y: 2, z: 0 }); +scriptURL = Script.resolvePath("eraseBoardEntityScript.js"); +var eraser = Entities.addEntity({ + type: "Model", + modelURL: eraseModelURL, + position: eraseModelPosition, + name: "Eraser", + script: scriptURL, + rotation: rotation, + userData: JSON.stringify({ + whiteboard: drawingSurface + }) +}); Script.setTimeout(function() { whiteboardDimensions = Entities.getEntityProperties(whiteboard, "naturalDimensions").naturalDimensions; - colorIndicatorDimensions = Entities.getEntityProperties(colorIndicatorBorder, "naturalDimensions").naturalDimensions; + colorIndicatorBorderDimensions = Entities.getEntityProperties(colorIndicatorBorder, "naturalDimensions").naturalDimensions; setUp(); }, 1000) @@ -89,24 +108,25 @@ function setUp() { // COLOR INDICATOR BOX - var colorIndicatorDimensions = { - x: whiteboardDimensions.x, - y: 0.5, - z: 0.02 - }; + var eraseModelDimensions = Entities.getEntityProperties(eraser, "naturalDimensions").naturalDimensions; + Entities.editEntity(eraser, {dimensions: eraseModelDimensions}); + Entities.editEntity(colorIndicatorBorder, {dimensions: colorIndicatorBorderDimensions}); + scriptURL = Script.resolvePath("colorIndicatorEntityScript.js"); var colorIndicatorPosition = Vec3.sum(center, { x: 0, - y: whiteboardDimensions.y / 2 + colorIndicatorDimensions.y / 2, + y: whiteboardDimensions.y / 2 + colorIndicatorBorderDimensions.y / 2, z: 0 }); + colorIndicatorPosition = Vec3.sum(colorIndicatorPosition, Vec3.multiply(-.1, Quat.getFront(rotation))); + var colorIndicatorBoxDimensions = Vec3.multiply(colorIndicatorBorderDimensions, 0.9); colorIndicatorBox = Entities.addEntity({ type: "Box", name: "Color Indicator", color: colors[0], rotation: rotation, position: colorIndicatorPosition, - dimensions: colorIndicatorDimensions, + dimensions: colorIndicatorBoxDimensions, script: scriptURL, userData: JSON.stringify({ whiteboard: drawingSurface @@ -158,49 +178,13 @@ function setUp() { colorBoxPosition = Vec3.sum(colorBoxPosition, spaceBetweenColorBoxes); } - var eraseBoxDimensions = { - x: 0.5, - y: 0.1, - z: 0.01 - }; - - - var eraseBoxPosition = Vec3.sum(center, Vec3.multiply(direction, whiteboardDimensions.x / 2 + eraseBoxDimensions.x / 2 + 0.01)); - eraseBoxPosition.y += 0.3; - scriptURL = Script.resolvePath("eraseBoardEntityScript.js"); - eraseAllText = Entities.addEntity({ - type: "Text", - position: eraseBoxPosition, - name: "Eraser", - script: scriptURL, - rotation: rotation, - dimensions: eraseBoxDimensions, - backgroundColor: { - red: 0, - green: 60, - blue: 0 - }, - textColor: { - red: 255, - green: 10, - blue: 10 - }, - text: "ERASE BOARD", - lineHeight: 0.07, - userData: JSON.stringify({ - whiteboard: drawingSurface - }) - }); - - - } function cleanup() { Entities.deleteEntity(whiteboard); Entities.deleteEntity(drawingSurface); Entities.deleteEntity(colorIndicatorBorder); - Entities.deleteEntity(eraseAllText); + Entities.deleteEntity(eraser); Entities.deleteEntity(colorIndicatorBox); colorBoxes.forEach(function(colorBox) { Entities.deleteEntity(colorBox); From ac2effb33cce4e55c9c91e0b3263cd0177da4979 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Wed, 28 Oct 2015 13:32:10 -0700 Subject: [PATCH 15/30] Not erasing board, models hosted on s3 --- .../whiteboard/whiteboardEntityScript.js | 4 +--- .../painting/whiteboard/whiteboardSpawner.js | 21 +++++++------------ 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/examples/painting/whiteboard/whiteboardEntityScript.js b/examples/painting/whiteboard/whiteboardEntityScript.js index fffaa78a8c..ce0e8a82b1 100644 --- a/examples/painting/whiteboard/whiteboardEntityScript.js +++ b/examples/painting/whiteboard/whiteboardEntityScript.js @@ -243,12 +243,10 @@ unload: function() { Overlays.deleteOverlay(this.laserPointer); - // this.eraseBoard(); + this.eraseBoard(); } - }; - // 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 c40a763bf6..573432b77a 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -16,15 +16,11 @@ Script.include("../../libraries/utils.js"); var scriptURL = Script.resolvePath("whiteboardEntityScript.js"); -//var modelURL = "https://hifi-public.s3.amazonaws.com/ozan/support/for_eric/whiteboard/whiteboard.fbx"; -var modelURL = "http://localhost:8080/whiteboard.fbx?v1" + Math.random(); -// var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/whiteboard.fbx"; +var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/whiteboard.fbx"; -var colorIndicatorBorderModelURL = "http://localhost:8080/colorIndicatorBorder.fbx?v1" + Math.random(); - -var eraseModelURL = "http://localhost:8080/eraser.fbx?v1" + Math.random(); - -var surfaceModelURL = "http://localhost:8080/boardSurface.fbx?v1" + Math.random(); +var colorIndicatorBorderModelURL = "https://s3.amazonaws.com/hifi-public/eric/models/colorIndicatorBorder.fbx"; +var eraserModelURL = "https://s3.amazonaws.com/hifi-public/eric/models/eraser.fbx"; +var surfaceModelURL = "https://s3.amazonaws.com/hifi-public/eric/models/boardSurface.fbx"; var rotation = Quat.safeEulerAngles(Camera.getOrientation()); rotation = Quat.fromPitchYawRollDegrees(0, rotation.y, 0); var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(rotation))); @@ -87,7 +83,7 @@ var eraseModelPosition = Vec3.sum(center, {x: 0, y: 2, z: 0 }); scriptURL = Script.resolvePath("eraseBoardEntityScript.js"); var eraser = Entities.addEntity({ type: "Model", - modelURL: eraseModelURL, + modelURL: eraserModelURL, position: eraseModelPosition, name: "Eraser", script: scriptURL, @@ -101,13 +97,10 @@ Script.setTimeout(function() { whiteboardDimensions = Entities.getEntityProperties(whiteboard, "naturalDimensions").naturalDimensions; colorIndicatorBorderDimensions = Entities.getEntityProperties(colorIndicatorBorder, "naturalDimensions").naturalDimensions; setUp(); -}, 1000) +}, 2000) function setUp() { - // COLOR INDICATOR BOX - - var eraseModelDimensions = Entities.getEntityProperties(eraser, "naturalDimensions").naturalDimensions; Entities.editEntity(eraser, {dimensions: eraseModelDimensions}); Entities.editEntity(colorIndicatorBorder, {dimensions: colorIndicatorBorderDimensions}); @@ -194,4 +187,4 @@ function cleanup() { // Uncomment this line to delete whiteboard and all associated entity on script close -Script.scriptEnding.connect(cleanup); \ No newline at end of file +// Script.scriptEnding.connect(cleanup); \ No newline at end of file From e9bdb872bdd8d3c78a6c0f6e3f28b2b407c64bc7 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Wed, 28 Oct 2015 15:25:11 -0700 Subject: [PATCH 16/30] added light to whiteboard --- examples/painting/whiteboard/whiteboardSpawner.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index 573432b77a..b08c9bd624 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -79,6 +79,14 @@ var drawingSurface = Entities.addEntity({ }); +var lightPosition = Vec3.sum(center, Vec3.multiply(-2, Quat.getFront(rotation))); +var light = Entities.addEntity({ + type: 'Light', + position: lightPosition, + dimensions: {x: 5, y: 5, z: 5}, + color: {red: 255, green: 255, blue: 255} +}); + var eraseModelPosition = Vec3.sum(center, {x: 0, y: 2, z: 0 }); scriptURL = Script.resolvePath("eraseBoardEntityScript.js"); var eraser = Entities.addEntity({ @@ -179,6 +187,7 @@ function cleanup() { Entities.deleteEntity(colorIndicatorBorder); Entities.deleteEntity(eraser); Entities.deleteEntity(colorIndicatorBox); + Entities.deleteEntity(light); colorBoxes.forEach(function(colorBox) { Entities.deleteEntity(colorBox); }); From 1b1490bb75403a6f31040d234035c5af67092c76 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Wed, 28 Oct 2015 16:02:15 -0700 Subject: [PATCH 17/30] added blocker so user cant get so close to whiteboard --- .../painting/whiteboard/whiteboardSpawner.js | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index b08c9bd624..29183dcc76 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -25,7 +25,7 @@ var rotation = Quat.safeEulerAngles(Camera.getOrientation()); rotation = Quat.fromPitchYawRollDegrees(0, rotation.y, 0); var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(rotation))); -var whiteboardDimensions, colorIndicatorBoxDimensions, colorIndicatorBox, eraser; +var whiteboardDimensions, colorIndicatorBoxDimensions, colorIndicatorBox, eraser, blocker; var colorBoxes = []; var colors = [ @@ -87,12 +87,13 @@ var light = Entities.addEntity({ color: {red: 255, green: 255, blue: 255} }); -var eraseModelPosition = Vec3.sum(center, {x: 0, y: 2, z: 0 }); +var eraserPosition = Vec3.sum(center, {x: 0, y: 2.05, z: 0 }); +eraserPosition = Vec3.sum(eraserPosition, Vec3.multiply(-0.1, rotation)); scriptURL = Script.resolvePath("eraseBoardEntityScript.js"); var eraser = Entities.addEntity({ type: "Model", modelURL: eraserModelURL, - position: eraseModelPosition, + position: eraserPosition, name: "Eraser", script: scriptURL, rotation: rotation, @@ -109,6 +110,17 @@ Script.setTimeout(function() { function setUp() { + var blockerPosition = Vec3.sum(center, {x: 0, y: -1, z: 0 }); + blockerPosition = Vec3.sum(blockerPosition, Vec3.multiply(-1, Quat.getFront(rotation))); + blocker = Entities.addEntity({ + type: "Box", + rotation: rotation, + position: blockerPosition, + dimensions: {x: whiteboardDimensions.x, y: 1, z: 0.1}, + shapeType: "box", + visible: false + }); + var eraseModelDimensions = Entities.getEntityProperties(eraser, "naturalDimensions").naturalDimensions; Entities.editEntity(eraser, {dimensions: eraseModelDimensions}); Entities.editEntity(colorIndicatorBorder, {dimensions: colorIndicatorBorderDimensions}); @@ -187,6 +199,7 @@ function cleanup() { Entities.deleteEntity(colorIndicatorBorder); Entities.deleteEntity(eraser); Entities.deleteEntity(colorIndicatorBox); + Entities.deleteEntity(blocker); Entities.deleteEntity(light); colorBoxes.forEach(function(colorBox) { Entities.deleteEntity(colorBox); @@ -196,4 +209,4 @@ function cleanup() { // Uncomment this line to delete whiteboard and all associated entity on script close -// Script.scriptEnding.connect(cleanup); \ No newline at end of file +Script.scriptEnding.connect(cleanup); \ No newline at end of file From 49877c2dffba35b6902e3c92dfd9568615dcab78 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 29 Oct 2015 10:19:18 -0700 Subject: [PATCH 18/30] Move _hasOutgoingChanges in onSubStep to previous location --- libraries/physics/src/PhysicsEngine.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/physics/src/PhysicsEngine.cpp b/libraries/physics/src/PhysicsEngine.cpp index 1e87fc9a5d..7af1c12917 100644 --- a/libraries/physics/src/PhysicsEngine.cpp +++ b/libraries/physics/src/PhysicsEngine.cpp @@ -253,7 +253,6 @@ void PhysicsEngine::stepSimulation() { auto onSubStep = [this]() { updateContactMap(); - _hasOutgoingChanges = true; }; int numSubsteps = _dynamicsWorld->stepSimulation(timeStep, PHYSICS_ENGINE_MAX_NUM_SUBSTEPS, PHYSICS_ENGINE_FIXED_SUBSTEP, onSubStep); @@ -265,6 +264,8 @@ void PhysicsEngine::stepSimulation() { if (_characterController) { _characterController->postSimulation(); } + + _hasOutgoingChanges = true; } } From 143b9c663f2e6cb530133aadf19e6f27d49ebe2d Mon Sep 17 00:00:00 2001 From: Ken Cooke Date: Thu, 29 Oct 2015 12:21:28 -0700 Subject: [PATCH 19/30] Quick fix for audio having channels swapped under Qt 5.5.1. --- libraries/audio-client/src/AudioClient.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index b528b67745..c321a32211 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -313,7 +313,9 @@ QAudioDeviceInfo defaultAudioDeviceForMode(QAudio::Mode mode) { bool adjustedFormatForAudioDevice(const QAudioDeviceInfo& audioDevice, const QAudioFormat& desiredAudioFormat, QAudioFormat& adjustedAudioFormat) { - if (!audioDevice.isFormatSupported(desiredAudioFormat)) { + // FIXME: direcly using 24khz has a bug somewhere that causes channels to be swapped. + // Continue using our internal resampler, for now. + if (false && !audioDevice.isFormatSupported(desiredAudioFormat)) { qCDebug(audioclient) << "The desired format for audio I/O is" << desiredAudioFormat; qCDebug(audioclient, "The desired audio format is not supported by this device"); From 4d576d7aaff7284d4d5d10640d1ab97c27b4405c Mon Sep 17 00:00:00 2001 From: Ken Cooke Date: Thu, 29 Oct 2015 12:23:36 -0700 Subject: [PATCH 20/30] Fix typo --- libraries/audio-client/src/AudioClient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index c321a32211..a67ab460d1 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -313,7 +313,7 @@ QAudioDeviceInfo defaultAudioDeviceForMode(QAudio::Mode mode) { bool adjustedFormatForAudioDevice(const QAudioDeviceInfo& audioDevice, const QAudioFormat& desiredAudioFormat, QAudioFormat& adjustedAudioFormat) { - // FIXME: direcly using 24khz has a bug somewhere that causes channels to be swapped. + // FIXME: directly using 24khz has a bug somewhere that causes channels to be swapped. // Continue using our internal resampler, for now. if (false && !audioDevice.isFormatSupported(desiredAudioFormat)) { qCDebug(audioclient) << "The desired format for audio I/O is" << desiredAudioFormat; From 1c2973f17d9b292c699a5899385d392ae8cb779a Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Thu, 29 Oct 2015 12:34:24 -0700 Subject: [PATCH 21/30] removed old metavoxel example, since the api is no longer available --- examples/example/metavoxels/metavoxels.js | 41 ----------------------- 1 file changed, 41 deletions(-) delete mode 100644 examples/example/metavoxels/metavoxels.js diff --git a/examples/example/metavoxels/metavoxels.js b/examples/example/metavoxels/metavoxels.js deleted file mode 100644 index 32177cdcba..0000000000 --- a/examples/example/metavoxels/metavoxels.js +++ /dev/null @@ -1,41 +0,0 @@ -// -// metavoxels.js -// examples -// -// Copyright 2014 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 -// - -Script.setInterval(function() { - var spanner; - if (Math.random() < 0.5) { - spanner = new Sphere(); - } else { - spanner = new Cuboid(); - spanner.aspectX = 0.1 + Math.random() * 1.9; - spanner.aspectY = 0.1 + Math.random() * 1.9; - } - spanner.scale = 0.1 + Math.random() * 1.9; - spanner.rotation = Quat.fromPitchYawRollDegrees(Math.random() * 360.0, Math.random() * 360.0, Math.random() * 360.0); - spanner.translation = { x: 10.0 + Math.random() * 10.0, y: 10.0 + Math.random() * 10.0, z: 10.0 + Math.random() * 10.0 }; - - if (Math.random() < 0.5) { - var material = new MaterialObject(); - if (Math.random() < 0.5) { - material.diffuse = "http://www.fungibleinsight.com/faces/grass.jpg"; - } else { - material.diffuse = "http://www.fungibleinsight.com/faces/soil.jpg"; - } - Metavoxels.setVoxelMaterial(spanner, material); - - } else if (Math.random() < 0.5) { - Metavoxels.setVoxelColor(spanner, { red: Math.random() * 255.0, green: Math.random() * 255.0, - blue: Math.random() * 255.0 }); - - } else { - Metavoxels.setVoxelColor(spanner, { red: 0, green: 0, blue: 0, alpha: 0 }); - } -}, 1000); - From fb55f0becbbb1a0ae589224f4f26906d939ed191 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 29 Oct 2015 12:50:34 -0700 Subject: [PATCH 22/30] guard timeElapsed for simulateKinematicMotion to max 1s --- libraries/entities/src/EntityItem.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index f012ba6eee..cce3045049 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -736,18 +736,11 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef // is sending us data with a known "last simulated" time. That time is likely in the past, and therefore // this "new" data is actually slightly out of date. We calculate the time we need to skip forward and // use our simulation helper routine to get a best estimate of where the entity should be. - const float MIN_TIME_SKIP = 0.0f; - const float MAX_TIME_SKIP = 1.0f; // in seconds - float skipTimeForward = glm::clamp((float)(now - lastSimulatedFromBufferAdjusted) / (float)(USECS_PER_SECOND), - MIN_TIME_SKIP, MAX_TIME_SKIP); - if (skipTimeForward > 0.0f) { - #ifdef WANT_DEBUG - qCDebug(entities) << "skipTimeForward:" << skipTimeForward; - #endif - // we want to extrapolate the motion forward to compensate for packet travel time, but - // we don't want the side effect of flag setting. - simulateKinematicMotion(skipTimeForward, false); - } + float skipTimeForward = (float)(now - lastSimulatedFromBufferAdjusted) / (float)(USECS_PER_SECOND); + + // we want to extrapolate the motion forward to compensate for packet travel time, but + // we don't want the side effect of flag setting. + simulateKinematicMotion(skipTimeForward, false); } if (overwriteLocalData) { @@ -887,6 +880,15 @@ void EntityItem::simulate(const quint64& now) { } void EntityItem::simulateKinematicMotion(float timeElapsed, bool setFlags) { +#ifdef WANT_DEBUG + qCDebug(entities) << "EntityItem::simulateKinematicMotion timeElapsed" << timeElapsed; +#endif + + const float MIN_TIME_SKIP = 0.0f; + const float MAX_TIME_SKIP = 1.0f; // in seconds + + timeElapsed = glm::clamp(timeElapsed, MIN_TIME_SKIP, MAX_TIME_SKIP); + if (hasActions()) { return; } From 1eabb924f1ce844332bc9e7f001bf50a6bc9fb27 Mon Sep 17 00:00:00 2001 From: Ken Cooke Date: Thu, 29 Oct 2015 12:53:47 -0700 Subject: [PATCH 23/30] Fixed the logic to be correct --- libraries/audio-client/src/AudioClient.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index a67ab460d1..d4980596dd 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -315,7 +315,7 @@ bool adjustedFormatForAudioDevice(const QAudioDeviceInfo& audioDevice, QAudioFormat& adjustedAudioFormat) { // FIXME: directly using 24khz has a bug somewhere that causes channels to be swapped. // Continue using our internal resampler, for now. - if (false && !audioDevice.isFormatSupported(desiredAudioFormat)) { + if (true || !audioDevice.isFormatSupported(desiredAudioFormat)) { qCDebug(audioclient) << "The desired format for audio I/O is" << desiredAudioFormat; qCDebug(audioclient, "The desired audio format is not supported by this device"); @@ -323,7 +323,7 @@ bool adjustedFormatForAudioDevice(const QAudioDeviceInfo& audioDevice, adjustedAudioFormat = desiredAudioFormat; adjustedAudioFormat.setChannelCount(2); - if (audioDevice.isFormatSupported(adjustedAudioFormat)) { + if (false && audioDevice.isFormatSupported(adjustedAudioFormat)) { return true; } else { adjustedAudioFormat.setChannelCount(1); From 904326cd1c15911a307b5beebb382afdd13578fe Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 29 Oct 2015 14:11:27 -0700 Subject: [PATCH 24/30] edit.js fix --- examples/html/entityProperties.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/html/entityProperties.html b/examples/html/entityProperties.html index b3d7a5f6b6..fe40311b5f 100644 --- a/examples/html/entityProperties.html +++ b/examples/html/entityProperties.html @@ -1520,7 +1520,7 @@
Ambient URL
- +
From 020566b76a996c931aece545e98782124f329397 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Thu, 29 Oct 2015 14:14:15 -0700 Subject: [PATCH 25/30] no deleting --- examples/painting/whiteboard/whiteboardEntityScript.js | 2 +- examples/painting/whiteboard/whiteboardSpawner.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/painting/whiteboard/whiteboardEntityScript.js b/examples/painting/whiteboard/whiteboardEntityScript.js index ce0e8a82b1..c10a8c23fe 100644 --- a/examples/painting/whiteboard/whiteboardEntityScript.js +++ b/examples/painting/whiteboard/whiteboardEntityScript.js @@ -243,7 +243,7 @@ unload: function() { Overlays.deleteOverlay(this.laserPointer); - this.eraseBoard(); + // this.eraseBoard(); } }; diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index 29183dcc76..b2156dc898 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -209,4 +209,4 @@ function cleanup() { // Uncomment this line to delete whiteboard and all associated entity on script close -Script.scriptEnding.connect(cleanup); \ No newline at end of file +// Script.scriptEnding.connect(cleanup); \ No newline at end of file From c237072195288e18c8c643c07c35d3e5a5544c72 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 29 Oct 2015 15:29:12 -0700 Subject: [PATCH 26/30] edit.js fix --- examples/edit.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/edit.js b/examples/edit.js index c45e66986a..447455e999 100644 --- a/examples/edit.js +++ b/examples/edit.js @@ -1510,7 +1510,7 @@ PropertiesTool = function(opts) { if (entity.properties.rotation !== undefined) { entity.properties.rotation = Quat.safeEulerAngles(entity.properties.rotation); } - if (entity.properties.keyLight.direction !== undefined) { + if (entity.properties.type === "Zone" && entity.properties.keyLight.direction !== undefined) { entity.properties.keyLight.direction = Vec3.multiply(RADIANS_TO_DEGREES, Vec3.toPolar(entity.properties.keyLight.direction)); entity.properties.keyLight.direction.z = 0.0; } @@ -1541,7 +1541,7 @@ PropertiesTool = function(opts) { var rotation = data.properties.rotation; data.properties.rotation = Quat.fromPitchYawRollDegrees(rotation.x, rotation.y, rotation.z); } - if (data.properties.keyLight.direction !== undefined) { + if (entity.properties.type === "Zone" && data.properties.keyLight.direction !== undefined) { data.properties.keyLight.direction = Vec3.fromPolar( data.properties.keyLight.direction.x * DEGREES_TO_RADIANS, data.properties.keyLight.direction.y * DEGREES_TO_RADIANS); } From 047614b2eb70fc7e60faef1486de3b515078344b Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Thu, 29 Oct 2015 16:18:15 -0700 Subject: [PATCH 27/30] New left and right grab animations. --- .../defaultAvatar_full/avatar-animation.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/interface/resources/meshes/defaultAvatar_full/avatar-animation.json b/interface/resources/meshes/defaultAvatar_full/avatar-animation.json index 682e0be1bf..515f6e96fe 100644 --- a/interface/resources/meshes/defaultAvatar_full/avatar-animation.json +++ b/interface/resources/meshes/defaultAvatar_full/avatar-animation.json @@ -197,7 +197,7 @@ "id": "rightHandOpen", "type": "clip", "data": { - "url": "http://hifi-public.s3.amazonaws.com/ozan/anim/hand_anims/point_right_hand.fbx", + "url": "https://hifi-public.s3.amazonaws.com/ozan/anim/grab/grab_right.fbx", "startFrame": 0.0, "endFrame": 0.0, "timeScale": 1.0, @@ -209,9 +209,9 @@ "id": "rightHandClose", "type": "clip", "data": { - "url": "http://hifi-public.s3.amazonaws.com/ozan/anim/squeeze_hands/right_hand_anim.fbx", - "startFrame": 15.0, - "endFrame": 15.0, + "url": "https://hifi-public.s3.amazonaws.com/ozan/anim/grab/grab_right.fbx", + "startFrame": 10.0, + "endFrame": 10.0, "timeScale": 1.0, "loopFlag": true }, @@ -346,7 +346,7 @@ "id": "leftHandOpen", "type": "clip", "data": { - "url": "http://hifi-public.s3.amazonaws.com/ozan/anim/hand_anims/point_left_hand.fbx", + "url": "https://hifi-public.s3.amazonaws.com/ozan/anim/grab/grab_left.fbx", "startFrame": 0.0, "endFrame": 0.0, "timeScale": 1.0, @@ -358,9 +358,9 @@ "id": "leftHandClose", "type": "clip", "data": { - "url": "http://hifi-public.s3.amazonaws.com/ozan/anim/squeeze_hands/left_hand_anim.fbx", - "startFrame": 15.0, - "endFrame": 15.0, + "url": "https://hifi-public.s3.amazonaws.com/ozan/anim/grab/grab_left.fbx", + "startFrame": 10.0, + "endFrame": 10.0, "timeScale": 1.0, "loopFlag": true }, From b6b71e7e7693aa92962ff080f562909e82238dec Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Thu, 29 Oct 2015 16:40:50 -0700 Subject: [PATCH 28/30] increased range and intensity of light --- examples/painting/whiteboard/whiteboardSpawner.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index b2156dc898..fa5040ed4b 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -79,11 +79,13 @@ var drawingSurface = Entities.addEntity({ }); -var lightPosition = Vec3.sum(center, Vec3.multiply(-2, Quat.getFront(rotation))); +var lightPosition = Vec3.sum(center, Vec3.multiply(-4, Quat.getFront(rotation))); var light = Entities.addEntity({ type: 'Light', + name: 'whiteboard light', position: lightPosition, - dimensions: {x: 5, y: 5, z: 5}, + dimensions: {x: 10, y: 10, z: 10}, + intensity: 2, color: {red: 255, green: 255, blue: 255} }); From 8b46ed7dff4e54bf9817bf0ee3df69ba62997bb2 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 29 Oct 2015 16:42:48 -0700 Subject: [PATCH 29/30] Check keyLight is defined --- examples/edit.js | 4 ++-- examples/html/entityProperties.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/edit.js b/examples/edit.js index 447455e999..7a16030afc 100644 --- a/examples/edit.js +++ b/examples/edit.js @@ -1510,7 +1510,7 @@ PropertiesTool = function(opts) { if (entity.properties.rotation !== undefined) { entity.properties.rotation = Quat.safeEulerAngles(entity.properties.rotation); } - if (entity.properties.type === "Zone" && entity.properties.keyLight.direction !== undefined) { + if (entity.properties.keyLight !== undefined && entity.properties.keyLight.direction !== undefined) { entity.properties.keyLight.direction = Vec3.multiply(RADIANS_TO_DEGREES, Vec3.toPolar(entity.properties.keyLight.direction)); entity.properties.keyLight.direction.z = 0.0; } @@ -1541,7 +1541,7 @@ PropertiesTool = function(opts) { var rotation = data.properties.rotation; data.properties.rotation = Quat.fromPitchYawRollDegrees(rotation.x, rotation.y, rotation.z); } - if (entity.properties.type === "Zone" && data.properties.keyLight.direction !== undefined) { + if (data.properties.keyLight !== undefined && data.properties.keyLight.direction !== undefined) { data.properties.keyLight.direction = Vec3.fromPolar( data.properties.keyLight.direction.x * DEGREES_TO_RADIANS, data.properties.keyLight.direction.y * DEGREES_TO_RADIANS); } diff --git a/examples/html/entityProperties.html b/examples/html/entityProperties.html index fe40311b5f..412b413b2b 100644 --- a/examples/html/entityProperties.html +++ b/examples/html/entityProperties.html @@ -830,7 +830,7 @@ elZoneKeyLightColorRed.addEventListener('change', zoneKeyLightColorChangeFunction); elZoneKeyLightColorGreen.addEventListener('change', zoneKeyLightColorChangeFunction); elZoneKeyLightColorBlue.addEventListener('change', zoneKeyLightColorChangeFunction); - elZoneKeyLightIntensity.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('intensity','keyLight')); + elZoneKeyLightIntensity.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('keyLight','intensity')); elZoneKeyLightAmbientIntensity.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('keyLight','ambientIntensity')); var zoneKeyLightDirectionChangeFunction = createEmitGroupVec3PropertyUpdateFunction('keyLight','direction', elZoneKeyLightDirectionX, elZoneKeyLightDirectionY, elZoneKeyLightDirectionZ); elZoneKeyLightDirectionX.addEventListener('change', zoneKeyLightDirectionChangeFunction); From 6bdf66534f323d1710878bcc5f6d48f32e9a1992 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Thu, 29 Oct 2015 16:53:03 -0700 Subject: [PATCH 30/30] light tweak --- examples/painting/whiteboard/whiteboardSpawner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index fa5040ed4b..701112e1a8 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -79,7 +79,7 @@ var drawingSurface = Entities.addEntity({ }); -var lightPosition = Vec3.sum(center, Vec3.multiply(-4, Quat.getFront(rotation))); +var lightPosition = Vec3.sum(center, Vec3.multiply(-3, Quat.getFront(rotation))); var light = Entities.addEntity({ type: 'Light', name: 'whiteboard light',