diff --git a/unpublishedScripts/DomainContent/Home/musicBox/createMusicBox.js b/unpublishedScripts/DomainContent/Home/musicBox/createMusicBox.js new file mode 100644 index 0000000000..1f741f81ab --- /dev/null +++ b/unpublishedScripts/DomainContent/Home/musicBox/createMusicBox.js @@ -0,0 +1,105 @@ +var SHOULD_CLEANUP = true; + +var WHITE = { + red: 255, + green: 255, + blue: 255 +}; + +var RED = { + red: 255, + green: 255, + blue: 255 +}; + +var GREEN = { + red: 255, + green: 255, + blue: 255 +}; + +var BLUE = { + red: 255, + green: 255, + blue: 255 +}; + +var center = Vec3.sum(Vec3.sum(MyAvatar.position, { + x: 0, + y: 0.5, + z: 0 +}), Vec3.multiply(1, Quat.getFront(Camera.getOrientation()))); + +var BASE_DIMENSIONS = { + x: 0.5, + y: 0.5, + z: 0.5 +}; + +var BASE_POSITION = center; + +var LID_OFFSET = { + x: 0, + y: BASE_DIMENSIONS.y / 2, + z: 0 +}; + +var LID_DIMENSIONS = { + x: BASE_DIMENSIONS.x, + y: BASE_DIMENSIONS.y / 8, + z: BASE_DIMENSIONS.z +}; + +var base, lid; + +function createBase() { + var baseProperties = { + name: 'hifi-home-music-box-base', + type: 'Box', + color: WHITE, + position: BASE_POSITION + } + + base = Entities.addEntity(base); +}; + +function createLid() { + + var lidPosition = Vec3.sum(lidPosition, LID_OFFSET); + var lidProperties = { + name: 'hifi-home-music-box-lid', + type: 'Box', + color: BLUE, + dimensions: LID_DIMENSIONS, + position: lidPosition, + userData:JSON.stringify({ + grabConstraintsKey:{ + positionLocked:true, + rotationLocked:false, + positionMod:false, + rotationMod:{ + pitch:{ + min:0, + max:100 + }, + yaw:false, + roll:false + } + } + }) + } + + lid = Entities.addEntity(lidProperties); +}; + +if (SHOULD_CLEANUP === true) { + Script.scriptEnding.connect(cleanup); +} + +function cleanup() { + Entities.deleteEntity(base); + Entities.deleteEntity(lid); +} + +createBase(); +createLid(); \ No newline at end of file diff --git a/unpublishedScripts/DomainContent/Home/musicBox/lid.js b/unpublishedScripts/DomainContent/Home/musicBox/lid.js new file mode 100644 index 0000000000..928dfcc1e9 --- /dev/null +++ b/unpublishedScripts/DomainContent/Home/musicBox/lid.js @@ -0,0 +1,33 @@ +(function() { + + var _this; + + function Lid() { + _this = this; + return this; + } + + Lid.prototype = { + preload: function() { + + }, + initialize: function() { + + }, + + startNearGrab: function() { + + }, + + releaseGrab: function() { + + }, + + unload: function() { + + }, + } + + + return new Lid(); +}) \ No newline at end of file