mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 06:10:52 +02:00
lightsabers
This commit is contained in:
parent
f9f496ef5a
commit
bb67ca87e2
2 changed files with 18 additions and 10 deletions
|
@ -23,6 +23,7 @@ basePosition.y = MyAvatar.position.y + 1;
|
||||||
// RAVE ITEMS
|
// RAVE ITEMS
|
||||||
var lightBall = new LightBall(basePosition);
|
var lightBall = new LightBall(basePosition);
|
||||||
var raveStick = new RaveStick(Vec3.sum(basePosition, {x: 1, y: 0.5, z: 1}));
|
var raveStick = new RaveStick(Vec3.sum(basePosition, {x: 1, y: 0.5, z: 1}));
|
||||||
|
var raveStick2 = new RaveStick(Vec3.sum(basePosition, {x: 2, y: 0.5, 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();
|
||||||
|
@ -73,6 +74,7 @@ function cleanup() {
|
||||||
Entities.deleteEntity(floor);
|
Entities.deleteEntity(floor);
|
||||||
lightBall.cleanup();
|
lightBall.cleanup();
|
||||||
raveStick.cleanup();
|
raveStick.cleanup();
|
||||||
|
raveStick2.cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
Script.scriptEnding.connect(cleanup);
|
Script.scriptEnding.connect(cleanup);
|
|
@ -15,6 +15,15 @@
|
||||||
// this is the "constructor" for the entity as a JS object we don't do much here
|
// this is the "constructor" for the entity as a JS object we don't do much here
|
||||||
var RaveStick = function() {
|
var RaveStick = function() {
|
||||||
_this = this;
|
_this = this;
|
||||||
|
this.colorPalette = [{
|
||||||
|
red: 0,
|
||||||
|
green: 200,
|
||||||
|
blue: 40
|
||||||
|
}, {
|
||||||
|
red: 200,
|
||||||
|
green: 10,
|
||||||
|
blue: 40
|
||||||
|
}];
|
||||||
};
|
};
|
||||||
|
|
||||||
RaveStick.prototype = {
|
RaveStick.prototype = {
|
||||||
|
@ -39,6 +48,7 @@
|
||||||
|
|
||||||
unload: function() {
|
unload: function() {
|
||||||
Entities.deleteEntity(this.beam);
|
Entities.deleteEntity(this.beam);
|
||||||
|
// Entities.deleteEntity(this.beamTrail);
|
||||||
},
|
},
|
||||||
|
|
||||||
createBeam: function() {
|
createBeam: function() {
|
||||||
|
@ -50,27 +60,20 @@
|
||||||
var position = Vec3.sum(props.position, Vec3.multiply(Quat.getFront(props.rotation), 0.1));
|
var position = Vec3.sum(props.position, Vec3.multiply(Quat.getFront(props.rotation), 0.1));
|
||||||
position.z += 0.1;
|
position.z += 0.1;
|
||||||
position.x += -0.035;
|
position.x += -0.035;
|
||||||
|
var color = this.colorPalette[randInt(0, this.colorPalette.length)];
|
||||||
var props = {
|
var props = {
|
||||||
type: "ParticleEffect",
|
type: "ParticleEffect",
|
||||||
position: position,
|
position: position,
|
||||||
parentID: this.entityID,
|
parentID: this.entityID,
|
||||||
isEmitting: true,
|
isEmitting: true,
|
||||||
"name": "ParticlesTest Emitter",
|
"name": "ParticlesTest Emitter",
|
||||||
"colorStart": {
|
"colorStart": color,
|
||||||
red: 0,
|
|
||||||
green: 200,
|
|
||||||
blue: 40
|
|
||||||
},
|
|
||||||
color: {
|
color: {
|
||||||
red: 200,
|
red: 200,
|
||||||
green: 200,
|
green: 200,
|
||||||
blue: 255
|
blue: 255
|
||||||
},
|
},
|
||||||
"colorFinish": {
|
"colorFinish": color,
|
||||||
red: 25,
|
|
||||||
green: 200,
|
|
||||||
blue: 5
|
|
||||||
},
|
|
||||||
"maxParticles": 100000,
|
"maxParticles": 100000,
|
||||||
"lifespan": 2,
|
"lifespan": 2,
|
||||||
"emitRate": 1000,
|
"emitRate": 1000,
|
||||||
|
@ -108,6 +111,9 @@
|
||||||
}
|
}
|
||||||
this.beam = Entities.addEntity(props);
|
this.beam = Entities.addEntity(props);
|
||||||
|
|
||||||
|
// props.emitterShouldTrail = true;
|
||||||
|
// this.beamTrail = Entities.addEntity(props);
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// entity scripts always need to return a newly constructed object of our type
|
// entity scripts always need to return a newly constructed object of our type
|
||||||
|
|
Loading…
Reference in a new issue