From 738d3d249b94f14b4ca805a159ad4c8febc33dd0 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Tue, 5 Apr 2016 15:54:13 -0700 Subject: [PATCH] lid stuff --- examples/controllers/handControllerGrab.js | 5 +++++ .../DomainContent/Home/musicBox/lid.js | 13 +++++++------ .../DomainContent/Home/musicBox/wrapper.js | 10 +++++++--- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/examples/controllers/handControllerGrab.js b/examples/controllers/handControllerGrab.js index 76146a1962..14a045bd7d 100644 --- a/examples/controllers/handControllerGrab.js +++ b/examples/controllers/handControllerGrab.js @@ -1712,12 +1712,17 @@ function MyController(hand) { modTypes.push('roll') } + var safeEuler = Quat.safeEulerAngles(grabbedProps.rotation); + + print('SAFE EULER FOR ROTAITON IS:: ' + JSON.stringify(safeEuler)) finalRotation = { x: 0, y: 0, z: 0 } + + finalRotation = safeEuler; modTypes.forEach(function(modType) { var value = handPosition[constraints.rotationMod[modType].startingAxis]; diff --git a/unpublishedScripts/DomainContent/Home/musicBox/lid.js b/unpublishedScripts/DomainContent/Home/musicBox/lid.js index e3d74fcb01..6e19203aee 100644 --- a/unpublishedScripts/DomainContent/Home/musicBox/lid.js +++ b/unpublishedScripts/DomainContent/Home/musicBox/lid.js @@ -168,13 +168,14 @@ var LATERAL_OFFSET = 0.0; var hatOffset = getOffsetFromCenter(VERTICAL_OFFSET, FORWARD_OFFSET, LATERAL_OFFSET) - var upOffset = Vec3.sum({ - x: 0, - y: hatHeight, - z: 0 - }, hatOffset) + + var baseProps = Entities.getEntityProperties(this.base); + + var upOffset = Vec3.multiply(hatHeight,Quat.getUp(baseProps.rotation)); + + var hatPosition = Vec3.sum(hatOffset, upOffset) Entities.editEntity(this.hat, { - position: upOffset + position: hatPosition }) }, diff --git a/unpublishedScripts/DomainContent/Home/musicBox/wrapper.js b/unpublishedScripts/DomainContent/Home/musicBox/wrapper.js index 97fcb80323..a7406fa912 100644 --- a/unpublishedScripts/DomainContent/Home/musicBox/wrapper.js +++ b/unpublishedScripts/DomainContent/Home/musicBox/wrapper.js @@ -159,7 +159,7 @@ HomeMusicBox = function(spawnPosition, spawnRotation) { name: 'home_music_box_key', type: 'Model', parentID: baseID, - angularDamping:1, + angularDamping: 1, angularVelocity: { x: 0, y: 0, @@ -187,9 +187,10 @@ HomeMusicBox = function(spawnPosition, spawnRotation) { modelURL: "atp:/MB_Box.fbx", name: 'home_music_box_base', type: 'Model', - shapeType:'box', position: BASE_POSITION, - dynamic:true, + dynamic: true, + shapeType: 'compound', + compoundShapeURL: 'atp:/boxHull2.obj', dimensions: { x: 0.1661, y: 0.0928, @@ -198,6 +199,9 @@ HomeMusicBox = function(spawnPosition, spawnRotation) { userData: JSON.stringify({ 'hifiHomeKey': { 'reset': true + }, + grabbableKey: { + disableReleaseVelocity: true } }) }