mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-21 22:00:15 +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/utils.js");
|
||||||
Script.include("../../libraries/constants.js");
|
Script.include("../../libraries/constants.js");
|
||||||
|
|
||||||
var scriptURL = Script.resolvePath('pistol.js');
|
|
||||||
var _this;
|
var _this;
|
||||||
Pistol = function() {
|
Pistol = function() {
|
||||||
_this = this;
|
_this = this;
|
||||||
|
|
|
@ -17,7 +17,8 @@ var pistol = Entities.addEntity({
|
||||||
spatialKey: {
|
spatialKey: {
|
||||||
relativePosition: {x: 0, y: 0, z: 0},
|
relativePosition: {x: 0, y: 0, z: 0},
|
||||||
relativeRotation: Quat.fromPitchYawRollDegrees(45, 90 , 0)
|
relativeRotation: Quat.fromPitchYawRollDegrees(45, 90 , 0)
|
||||||
}
|
},
|
||||||
|
invertSolidWhileHeld: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
var _this;
|
var _this;
|
||||||
|
|
||||||
|
var gunScriptURL = Script.resolvePath("../examples/weapons/pistol/pistol.js");
|
||||||
var sprayPaintScriptURL = Script.resolvePath("../examples/toybox/spray_paint/sprayPaintCan.js");
|
var sprayPaintScriptURL = Script.resolvePath("../examples/toybox/spray_paint/sprayPaintCan.js");
|
||||||
var catScriptURL = Script.resolvePath("../examples/toybox/cat/cat.js");
|
var catScriptURL = Script.resolvePath("../examples/toybox/cat/cat.js");
|
||||||
var flashlightScriptURL = Script.resolvePath('../examples/toybox/flashlight/flashlight.js');
|
var flashlightScriptURL = Script.resolvePath('../examples/toybox/flashlight/flashlight.js');
|
||||||
|
@ -84,6 +85,12 @@
|
||||||
z: 505.09
|
z: 505.09
|
||||||
});
|
});
|
||||||
|
|
||||||
|
createGun({
|
||||||
|
x: 546.2,
|
||||||
|
y: 495.5,
|
||||||
|
z: 505.2
|
||||||
|
});
|
||||||
|
|
||||||
createWand({
|
createWand({
|
||||||
x: 546.71,
|
x: 546.71,
|
||||||
y: 495.55,
|
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() {
|
function createFire() {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
var utilitiesScript = Script.resolvePath("../examples/libraries/utils.js");
|
var utilitiesScript = Script.resolvePath("../examples/libraries/utils.js");
|
||||||
Script.include(utilitiesScript);
|
Script.include(utilitiesScript);
|
||||||
|
|
||||||
|
var gunScriptURL = Script.resolvePath("../examples/weapons/pistol/pistol.js");
|
||||||
var sprayPaintScriptURL = Script.resolvePath("../examples/toybox/spray_paint/sprayPaintCan.js");
|
var sprayPaintScriptURL = Script.resolvePath("../examples/toybox/spray_paint/sprayPaintCan.js");
|
||||||
var catScriptURL = Script.resolvePath("../examples/toybox/cat/cat.js");
|
var catScriptURL = Script.resolvePath("../examples/toybox/cat/cat.js");
|
||||||
var flashlightScriptURL = Script.resolvePath('../examples/toybox/flashlight/flashlight.js');
|
var flashlightScriptURL = Script.resolvePath('../examples/toybox/flashlight/flashlight.js');
|
||||||
|
@ -55,6 +56,13 @@ MasterReset = function() {
|
||||||
z: 505.09
|
z: 505.09
|
||||||
});
|
});
|
||||||
|
|
||||||
|
createGun({
|
||||||
|
x: 546.2,
|
||||||
|
y: 495.5,
|
||||||
|
z: 505.2
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
createWand({
|
createWand({
|
||||||
x: 546.71,
|
x: 546.71,
|
||||||
y: 495.55,
|
y: 495.55,
|
||||||
|
@ -104,7 +112,6 @@ MasterReset = function() {
|
||||||
z: 503.49
|
z: 503.49
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
createSprayCan({
|
createSprayCan({
|
||||||
x: 549.7,
|
x: 549.7,
|
||||||
y: 495.6,
|
y: 495.6,
|
||||||
|
@ -112,7 +119,6 @@ MasterReset = function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteAllToys() {
|
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() {
|
function createFire() {
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue