adding rave stick

This commit is contained in:
ericrius1 2015-12-16 15:47:34 -08:00
parent 4155e3af71
commit 6a77ae5db2
4 changed files with 145 additions and 120 deletions

View file

@ -15,10 +15,12 @@
Script.include("../../libraries/utils.js"); Script.include("../../libraries/utils.js");
Script.include("lightBall/LightBall.js"); Script.include("lightBall/LightBall.js");
Script.include("raveStick/RaveStick.js");
var basePosition = Vec3.sum(MyAvatar.position, Vec3.multiply(1, Quat.getFront(Camera.getOrientation()))); var basePosition = Vec3.sum(MyAvatar.position, Vec3.multiply(1, Quat.getFront(Camera.getOrientation())));
basePosition.y = MyAvatar.position.y + 1 basePosition.y = MyAvatar.position.y + 1;
var lightBall = LightBall(basePosition); var lightBall = new LightBall(basePosition);
var raveStick = new RaveStick(Vec3.sum(basePosition, {x: 1, y: 1, z: 1}));
var modelURL = "file:///C:/Users/Eric/Desktop/RaveRoom.fbx?v1" + Math.random(); var modelURL = "file:///C:/Users/Eric/Desktop/RaveRoom.fbx?v1" + Math.random();
var roomDimensions = {x: 30.58, y: 15.29, z: 30.58}; var roomDimensions = {x: 30.58, y: 15.29, z: 30.58};
@ -41,8 +43,6 @@ var floor = Entities.addEntity({
var lightZone = Entities.addEntity({ var lightZone = Entities.addEntity({
type: "Zone", type: "Zone",
shapeType: 'box', shapeType: 'box',
@ -68,6 +68,7 @@ function cleanup() {
Entities.deleteEntity(lightZone) Entities.deleteEntity(lightZone)
Entities.deleteEntity(floor); Entities.deleteEntity(floor);
lightBall.cleanup(); lightBall.cleanup();
raveStick.cleanup();
} }
Script.scriptEnding.connect(cleanup); Script.scriptEnding.connect(cleanup);

View file

@ -1,6 +1,6 @@
Script.include("../../libraries/utils.js"); Script.include("../../libraries/utils.js");
LightBall = function(basePosition) { LightBall = function(spawnPosition) {
var colorPalette = [{ var colorPalette = [{
red: 25, red: 25,
@ -11,7 +11,7 @@
var containerBall = Entities.addEntity({ var containerBall = Entities.addEntity({
type: "Sphere", type: "Sphere",
position: Vec3.sum(basePosition, { position: Vec3.sum(spawnPosition, {
x: 0, x: 0,
y: .5, y: .5,
z: 0 z: 0
@ -32,7 +32,7 @@
spatialKey: { spatialKey: {
relativePosition: { relativePosition: {
x: 0, x: 0,
y: 1, y: .7,
z: 0 z: 0
} }
}, },
@ -76,8 +76,8 @@
blue: 255 blue: 255
}, },
"maxParticles": 100000, "maxParticles": 100000,
"lifespan": 5, "lifespan": 2,
"emitRate": 5000, "emitRate": 10000,
"emitSpeed": .1, "emitSpeed": .1,
"speedSpread": 0.0, "speedSpread": 0.0,
"emitDimensions": { "emitDimensions": {
@ -99,9 +99,9 @@
"y": .00, "y": .00,
"z": .00 "z": .00
}, },
"particleRadius": 0.04, "particleRadius": 0.02,
"radiusSpread": 0, "radiusSpread": 0,
"radiusStart": 0.05, "radiusStart": 0.03,
"radiusFinish": 0.0003, "radiusFinish": 0.0003,
"alpha": 0, "alpha": 0,
"alphaSpread": .5, "alphaSpread": .5,
@ -121,4 +121,4 @@
} }
this.cleanup = cleanup; this.cleanup = cleanup;
} }

View file

@ -0,0 +1,24 @@
Script.include("../../libraries/utils.js");
var modelURL = "file:///C:/Users/Eric/Desktop/raveStick.fbx?v1" + Math.random();
RaveStick = function(spawnPosition) {
var stick = Entities.addEntity({
type: "Model",
modelURL: modelURL,
position: spawnPosition,
shapeType: 'box',
userData: JSON.stringify({
grabbableKey: {
invertSolidWhileHeld: true
}
})
});
function cleanup() {
Entities.deleteEntity(stick);
}
this.cleanup = cleanup;
}