mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 16:38:56 +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
|
||||
var lightBall = new LightBall(basePosition);
|
||||
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();
|
||||
|
@ -73,6 +74,7 @@ function cleanup() {
|
|||
Entities.deleteEntity(floor);
|
||||
lightBall.cleanup();
|
||||
raveStick.cleanup();
|
||||
raveStick2.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
|
||||
var RaveStick = function() {
|
||||
_this = this;
|
||||
this.colorPalette = [{
|
||||
red: 0,
|
||||
green: 200,
|
||||
blue: 40
|
||||
}, {
|
||||
red: 200,
|
||||
green: 10,
|
||||
blue: 40
|
||||
}];
|
||||
};
|
||||
|
||||
RaveStick.prototype = {
|
||||
|
@ -39,6 +48,7 @@
|
|||
|
||||
unload: function() {
|
||||
Entities.deleteEntity(this.beam);
|
||||
// Entities.deleteEntity(this.beamTrail);
|
||||
},
|
||||
|
||||
createBeam: function() {
|
||||
|
@ -50,27 +60,20 @@
|
|||
var position = Vec3.sum(props.position, Vec3.multiply(Quat.getFront(props.rotation), 0.1));
|
||||
position.z += 0.1;
|
||||
position.x += -0.035;
|
||||
var color = this.colorPalette[randInt(0, this.colorPalette.length)];
|
||||
var props = {
|
||||
type: "ParticleEffect",
|
||||
position: position,
|
||||
parentID: this.entityID,
|
||||
isEmitting: true,
|
||||
"name": "ParticlesTest Emitter",
|
||||
"colorStart": {
|
||||
red: 0,
|
||||
green: 200,
|
||||
blue: 40
|
||||
},
|
||||
"colorStart": color,
|
||||
color: {
|
||||
red: 200,
|
||||
green: 200,
|
||||
blue: 255
|
||||
},
|
||||
"colorFinish": {
|
||||
red: 25,
|
||||
green: 200,
|
||||
blue: 5
|
||||
},
|
||||
"colorFinish": color,
|
||||
"maxParticles": 100000,
|
||||
"lifespan": 2,
|
||||
"emitRate": 1000,
|
||||
|
@ -108,6 +111,9 @@
|
|||
}
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue