From d98732d5a1839724d2ae63825c664684c7f0d3f1 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Tue, 3 May 2016 12:08:44 -0700 Subject: [PATCH] dressing room updates --- .../Home/dressingRoom/transformer.js | 20 +++++ .../Home/dressingRoom/wrapper.js | 88 ++++++++++--------- .../DomainContent/Home/reset.js | 20 ++--- 3 files changed, 77 insertions(+), 51 deletions(-) diff --git a/unpublishedScripts/DomainContent/Home/dressingRoom/transformer.js b/unpublishedScripts/DomainContent/Home/dressingRoom/transformer.js index 7b94120370..df8fdf0644 100644 --- a/unpublishedScripts/DomainContent/Home/dressingRoom/transformer.js +++ b/unpublishedScripts/DomainContent/Home/dressingRoom/transformer.js @@ -78,6 +78,26 @@ _this.locked = true; _this.findRotatorBlock(); } else { + var transformerProps = Entities.getEntityProperties(_this.entityID, ["rotation", "position"]); + var eulerRotation = Quat.safeEulerAngles(transformerProps.rotation); + eulerRotation.x = 0; + eulerRotation.z = 0; + var newRotation = Quat.fromVec3Degrees(eulerRotation); + + //we zero out the velocity and angular velocity so the cow doesn't change position or spin + Entities.editEntity(_this.entityID, { + rotation: newRotation, + velocity: { + x: 0, + y: 0, + z: 0 + }, + angularVelocity: { + x: 0, + y: 0, + z: 0 + } + }); return; } }, diff --git a/unpublishedScripts/DomainContent/Home/dressingRoom/wrapper.js b/unpublishedScripts/DomainContent/Home/dressingRoom/wrapper.js index 458d5997f5..570b326183 100644 --- a/unpublishedScripts/DomainContent/Home/dressingRoom/wrapper.js +++ b/unpublishedScripts/DomainContent/Home/dressingRoom/wrapper.js @@ -9,48 +9,54 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // - var TRANSFORMER_SCRIPT = Script.resolvePath('transformer.js'); +var TRANSFORMER_SCRIPT = Script.resolvePath('transformer.js'); - var AVATAR_COLLISION_HULL = 'atp:/dressingRoom/Avatar-Hull-5.obj'; +var AVATAR_COLLISION_HULL = 'atp:/dressingRoom/Avatar-Hull-6.obj'; +var ROBOT_COLLISION_HULL = 'atp:/dressingRoom/robot_hull.obj'; +TransformerDoll = function(modelURL, spawnPosition, spawnRotation, dimensions) { + print('SCRIPT REF AT TRANSFORMER CREATE::' + TRANSFORMER_SCRIPT); + var transformerProps = { + name: 'hifi-home-dressing-room-little-transformer', + type: 'Model', + shapeType: 'compound', + compoundShapeURL: AVATAR_COLLISION_HULL, + position: spawnPosition, + rotation: Quat.fromPitchYawRollDegrees(spawnRotation.x, spawnRotation.y, spawnRotation.z), + modelURL: modelURL, + dynamic: true, + gravity: { + x: 0, + y: -10, + z: 0 + }, + visible: true, + restitution: 0.1, + damping: 0.9, + angularDamping: 0.9, + userData: JSON.stringify({ + 'grabbableKey': { + 'grabbable': true + }, + 'hifiHomeTransformerKey': { + 'basePosition': spawnPosition, + 'baseRotation': Quat.fromPitchYawRollDegrees(spawnRotation.x, spawnRotation.y, spawnRotation.z), + }, + 'hifiHomeKey': { + 'reset': true + } + }), + density: 7500, + dimensions: dimensions, + script: TRANSFORMER_SCRIPT + } - TransformerDoll = function(modelURL, spawnPosition, spawnRotation, dimensions) { - print('SCRIPT REF AT TRANSFORMER CREATE::' + TRANSFORMER_SCRIPT); - var transformerProps = { - name: 'hifi-home-dressing-room-little-transformer', - type: 'Model', - shapeType: 'compound', - compoundShapeURL: AVATAR_COLLISION_HULL, - position: spawnPosition, - rotation: Quat.fromPitchYawRollDegrees(spawnRotation.x, spawnRotation.y, spawnRotation.z), - modelURL: modelURL, - dynamic: true, - gravity: { - x: 0, - y: -10, - z: 0 - }, - visible: true, - damping: 0.8, - angularDamping: 0.8, - userData: JSON.stringify({ - 'grabbableKey': { - 'grabbable': true - }, - 'hifiHomeTransformerKey': { - 'basePosition': spawnPosition, - 'baseRotation': Quat.fromPitchYawRollDegrees(spawnRotation.x, spawnRotation.y, spawnRotation.z), - }, - 'hifiHomeKey': { - 'reset': true - } - }), - density: 5000, - dimensions: dimensions, - script: TRANSFORMER_SCRIPT - } - var transformer = Entities.addEntity(transformerProps); + if (modelURL.indexOf('robot') > -1) { + print('THIS IS A ROBOT, GIVE IT A DIFFERENT SHAPE TYPE') + transformerProps.compoundShapeURL =ROBOT_COLLISION_HULL; + } + var transformer = Entities.addEntity(transformerProps); - print('CREATED TRANSFORMER' + transformer); + print('CREATED TRANSFORMER' + transformer); - return this; - } \ No newline at end of file + return this; +} \ No newline at end of file diff --git a/unpublishedScripts/DomainContent/Home/reset.js b/unpublishedScripts/DomainContent/Home/reset.js index a12b7101f9..6f8dde1212 100644 --- a/unpublishedScripts/DomainContent/Home/reset.js +++ b/unpublishedScripts/DomainContent/Home/reset.js @@ -418,9 +418,9 @@ createTransformers: function() { var firstDollPosition = { - x: 1107.61, - y: 460.6, - z: -77.34 + x: 1107.6, + y: 460.575, + z: -77.37 } var dollRotation = { @@ -432,20 +432,15 @@ var rotationAsQuat = Quat.fromPitchYawRollDegrees(dollRotation.x, dollRotation.y, dollRotation.z); var dolls = [ - TRANSFORMER_URL_STYLIZED_FEMALE, TRANSFORMER_URL_ROBOT, TRANSFORMER_URL_BEING_OF_LIGHT, + TRANSFORMER_URL_STYLIZED_FEMALE, TRANSFORMER_URL_WILL, TRANSFORMER_URL_PRISCILLA, TRANSFORMER_URL_MATTHEW ]; var dollDimensions = [{ - //stylized female artemis - x: 1.6323, - y: 1.7705, - z: 0.2851 - }, { //robot x: 1.4439, y: 0.6224, @@ -455,6 +450,11 @@ x: 1.8838, y: 1.7865, z: 0.2955 + }, { + //stylized female artemis + x: 1.6323, + y: 1.7705, + z: 0.2851 }, { //will x: 1.6326, @@ -486,7 +486,7 @@ var left = Quat.getRight(rotationAsQuat); var distanceToLeft = Vec3.multiply(separation, left); var dollPosition = Vec3.sum(firstDollPosition, distanceToLeft); - if (index === 1) { + if (index === 0) { //special case for robot dollPosition.y += 0.15; }