diff --git a/examples/weapons/pistol/pistol.js b/examples/weapons/pistol/pistol.js index 61cf9f9b83..42b3e48fb0 100644 --- a/examples/weapons/pistol/pistol.js +++ b/examples/weapons/pistol/pistol.js @@ -15,7 +15,6 @@ Script.include("../../libraries/utils.js"); Script.include("../../libraries/constants.js"); - var scriptURL = Script.resolvePath('pistol.js'); var _this; Pistol = function() { _this = this; diff --git a/examples/weapons/pistol/pistolSpawner.js b/examples/weapons/pistol/pistolSpawner.js index bd95aa9ead..0637f85379 100644 --- a/examples/weapons/pistol/pistolSpawner.js +++ b/examples/weapons/pistol/pistolSpawner.js @@ -17,7 +17,8 @@ var pistol = Entities.addEntity({ spatialKey: { relativePosition: {x: 0, y: 0, z: 0}, relativeRotation: Quat.fromPitchYawRollDegrees(45, 90 , 0) - } + }, + invertSolidWhileHeld: true } }) }); diff --git a/unpublishedScripts/hiddenEntityReset.js b/unpublishedScripts/hiddenEntityReset.js index a8b4383b04..94f34532e6 100644 --- a/unpublishedScripts/hiddenEntityReset.js +++ b/unpublishedScripts/hiddenEntityReset.js @@ -14,6 +14,7 @@ var _this; + var gunScriptURL = Script.resolvePath("../examples/weapons/pistol/pistol.js"); var sprayPaintScriptURL = Script.resolvePath("../examples/toybox/spray_paint/sprayPaintCan.js"); var catScriptURL = Script.resolvePath("../examples/toybox/cat/cat.js"); var flashlightScriptURL = Script.resolvePath('../examples/toybox/flashlight/flashlight.js'); @@ -84,6 +85,12 @@ z: 505.09 }); + createGun({ + x: 546.2, + y: 495.5, + z: 505.2 + }); + createWand({ x: 546.71, y: 495.55, @@ -148,6 +155,52 @@ }); } + + function createGun(position) { + var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/gun.fbx"; + + var pistol = Entities.addEntity({ + type: 'Model', + name: "pistol", + modelURL: modelURL, + position: position, + dimensions: { + x: 0.05, + y: .23, + z: .36 + }, + script: gunScriptURL, + color: { + red: 200, + green: 0, + blue: 20 + }, + shapeType: 'box', + gravity: { + x: 0, + y: -3.0, + z: 0 + }, + collisionsWillMove: true, + userData: JSON.stringify({ + grabbableKey: { + spatialKey: { + relativePosition: { + x: 0, + y: 0, + z: 0 + }, + relativeRotation: Quat.fromPitchYawRollDegrees(45, 90, 0) + }, + invertSolidWhileHeld: true + }, + resetMe: { + resetMe: true + } + }) + }); + } + function createFire() { diff --git a/unpublishedScripts/masterReset.js b/unpublishedScripts/masterReset.js index 1b4c83a1d5..8875a659ef 100644 --- a/unpublishedScripts/masterReset.js +++ b/unpublishedScripts/masterReset.js @@ -14,6 +14,7 @@ var utilitiesScript = Script.resolvePath("../examples/libraries/utils.js"); Script.include(utilitiesScript); +var gunScriptURL = Script.resolvePath("../examples/weapons/pistol/pistol.js"); var sprayPaintScriptURL = Script.resolvePath("../examples/toybox/spray_paint/sprayPaintCan.js"); var catScriptURL = Script.resolvePath("../examples/toybox/cat/cat.js"); var flashlightScriptURL = Script.resolvePath('../examples/toybox/flashlight/flashlight.js'); @@ -55,6 +56,13 @@ MasterReset = function() { z: 505.09 }); + createGun({ + x: 546.2, + y: 495.5, + z: 505.2 + }); + + createWand({ x: 546.71, y: 495.55, @@ -104,7 +112,6 @@ MasterReset = function() { z: 503.49 }); - createSprayCan({ x: 549.7, y: 495.6, @@ -112,7 +119,6 @@ MasterReset = function() { }); - } function deleteAllToys() { @@ -127,6 +133,47 @@ MasterReset = function() { }); } + function createGun(position) { + var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/gun.fbx"; + + var pistol = Entities.addEntity({ + type: 'Model', + name: "pistol", + modelURL: modelURL, + position: position, + dimensions: { + x: 0.05, + y: .23, + z: .36 + }, + script: gunScriptURL, + color: { + red: 200, + green: 0, + blue: 20 + }, + shapeType: 'box', + gravity: {x: 0, y: -3.0, z: 0}, + collisionsWillMove: true, + userData: JSON.stringify({ + grabbableKey: { + spatialKey: { + relativePosition: { + x: 0, + y: 0, + z: 0 + }, + relativeRotation: Quat.fromPitchYawRollDegrees(45, 90, 0) + }, + invertSolidWhileHeld: true + }, + resetMe: { + resetMe: true + } + }) + }); + } + function createFire() { @@ -883,7 +930,7 @@ MasterReset = function() { type: "Model", modelURL: MODEL_URL, shapeType: 'compound', - compoundShapeURL:COLLISION_HULL_URL, + compoundShapeURL: COLLISION_HULL_URL, script: pingPongScriptURL, position: position, rotation: rotation,