mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-14 08:16:03 +02:00
added gun to toybox
This commit is contained in:
parent
c5898896bc
commit
8c5abd05c8
4 changed files with 105 additions and 5 deletions
|
@ -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;
|
||||
|
|
|
@ -17,7 +17,8 @@ var pistol = Entities.addEntity({
|
|||
spatialKey: {
|
||||
relativePosition: {x: 0, y: 0, z: 0},
|
||||
relativeRotation: Quat.fromPitchYawRollDegrees(45, 90 , 0)
|
||||
}
|
||||
},
|
||||
invertSolidWhileHeld: true
|
||||
}
|
||||
})
|
||||
});
|
||||
|
|
|
@ -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() {
|
||||
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue