mirror of
https://github.com/lubosz/overte.git
synced 2025-08-04 10:29:32 +02:00
Added glow effect to ravestick
This commit is contained in:
parent
890b39f04b
commit
cc35eaf4be
3 changed files with 206 additions and 15 deletions
|
@ -24,6 +24,9 @@ RaveStick = function(spawnPosition) {
|
||||||
green: 10,
|
green: 10,
|
||||||
blue: 40
|
blue: 40
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var stick = Entities.addEntity({
|
var stick = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
name: "raveStick",
|
name: "raveStick",
|
||||||
|
@ -57,6 +60,8 @@ RaveStick = function(spawnPosition) {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var glowEmitter = createGlowEmitter();
|
||||||
|
|
||||||
var light = Entities.addEntity({
|
var light = Entities.addEntity({
|
||||||
type: 'Light',
|
type: 'Light',
|
||||||
name: "raveLight",
|
name: "raveLight",
|
||||||
|
@ -85,11 +90,73 @@ RaveStick = function(spawnPosition) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
Entities.deleteEntity(stick);
|
Entities.deleteEntity(stick);
|
||||||
Entities.deleteEntity(light);
|
Entities.deleteEntity(light);
|
||||||
|
Entities.deleteEntity(glowEmitter);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.cleanup = cleanup;
|
this.cleanup = cleanup;
|
||||||
|
|
||||||
|
function createGlowEmitter() {
|
||||||
|
var props = Entities.getEntityProperties(stick, ["position", "rotation"]);
|
||||||
|
var forwardVec = Quat.getFront(props.rotation);
|
||||||
|
var forwardQuat = Quat.rotationBetween(Vec3.UNIT_Z, forwardVec);
|
||||||
|
var position = props.position;
|
||||||
|
var color = {
|
||||||
|
red: 150,
|
||||||
|
green: 20,
|
||||||
|
blue: 100
|
||||||
|
}
|
||||||
|
var props = {
|
||||||
|
type: "ParticleEffect",
|
||||||
|
name: "Rave Stick Glow Emitter",
|
||||||
|
position: position,
|
||||||
|
parentID: stick,
|
||||||
|
isEmitting: true,
|
||||||
|
colorStart: color,
|
||||||
|
color: {
|
||||||
|
red: 200,
|
||||||
|
green: 200,
|
||||||
|
blue: 255
|
||||||
|
},
|
||||||
|
colorFinish: color,
|
||||||
|
maxParticles: 100000,
|
||||||
|
lifespan: 0.8,
|
||||||
|
emitRate: 1000,
|
||||||
|
emitOrientation: forwardQuat,
|
||||||
|
emitSpeed: 0.2,
|
||||||
|
speedSpread: 0.0,
|
||||||
|
emitDimensions: {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
},
|
||||||
|
polarStart: 0,
|
||||||
|
polarFinish: 0,
|
||||||
|
azimuthStart: 0.1,
|
||||||
|
azimuthFinish: 0.01,
|
||||||
|
emitAcceleration: {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
},
|
||||||
|
accelerationSpread: {
|
||||||
|
x: .00,
|
||||||
|
y: .00,
|
||||||
|
z: .00
|
||||||
|
},
|
||||||
|
radiusStart: 0.01,
|
||||||
|
radiusFinish: 0.005,
|
||||||
|
alpha: 0.7,
|
||||||
|
alphaSpread: 0.1,
|
||||||
|
alphaStart: 0.1,
|
||||||
|
alphaFinish: 0.1,
|
||||||
|
textures: "https://s3.amazonaws.com/hifi-public/eric/textures/particleSprites/beamParticle.png",
|
||||||
|
emitterShouldTrail: false
|
||||||
|
}
|
||||||
|
var glowEmitter = Entities.addEntity(props);
|
||||||
|
return glowEmitter;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -170,10 +170,12 @@
|
||||||
|
|
||||||
function createRaveStick(position) {
|
function createRaveStick(position) {
|
||||||
var modelURL = "http://hifi-content.s3.amazonaws.com/eric/models/raveStick.fbx";
|
var modelURL = "http://hifi-content.s3.amazonaws.com/eric/models/raveStick.fbx";
|
||||||
|
var rotation = Quat.fromPitchYawRollDegrees(0, 0, 0);
|
||||||
var stick = Entities.addEntity({
|
var stick = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
name: "raveStick",
|
name: "raveStick",
|
||||||
modelURL: modelURL,
|
modelURL: modelURL,
|
||||||
|
rotation: rotation,
|
||||||
position: position,
|
position: position,
|
||||||
shapeType: 'box',
|
shapeType: 'box',
|
||||||
collisionsWillMove: true,
|
collisionsWillMove: true,
|
||||||
|
@ -206,6 +208,66 @@
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var forwardVec = Quat.getFront(rotation);
|
||||||
|
var forwardQuat = Quat.rotationBetween(Vec3.UNIT_Z, forwardVec);
|
||||||
|
var color = {
|
||||||
|
red: 150,
|
||||||
|
green: 20,
|
||||||
|
blue: 100
|
||||||
|
}
|
||||||
|
var raveGlowEmitter = Entities.addEntity({
|
||||||
|
type: "ParticleEffect",
|
||||||
|
name: "Rave Stick Glow Emitter",
|
||||||
|
position: position,
|
||||||
|
parentID: stick,
|
||||||
|
isEmitting: true,
|
||||||
|
colorStart: color,
|
||||||
|
color: {
|
||||||
|
red: 200,
|
||||||
|
green: 200,
|
||||||
|
blue: 255
|
||||||
|
},
|
||||||
|
colorFinish: color,
|
||||||
|
maxParticles: 100000,
|
||||||
|
lifespan: 0.8,
|
||||||
|
emitRate: 1000,
|
||||||
|
emitOrientation: forwardQuat,
|
||||||
|
emitSpeed: 0.2,
|
||||||
|
speedSpread: 0.0,
|
||||||
|
emitDimensions: {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
},
|
||||||
|
polarStart: 0,
|
||||||
|
polarFinish: 0,
|
||||||
|
azimuthStart: 0.1,
|
||||||
|
azimuthFinish: 0.01,
|
||||||
|
emitAcceleration: {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
},
|
||||||
|
accelerationSpread: {
|
||||||
|
x: .00,
|
||||||
|
y: .00,
|
||||||
|
z: .00
|
||||||
|
},
|
||||||
|
radiusStart: 0.01,
|
||||||
|
radiusFinish: 0.005,
|
||||||
|
alpha: 0.7,
|
||||||
|
alphaSpread: 0.1,
|
||||||
|
alphaStart: 0.1,
|
||||||
|
alphaFinish: 0.1,
|
||||||
|
textures: "https://s3.amazonaws.com/hifi-public/eric/textures/particleSprites/beamParticle.png",
|
||||||
|
emitterShouldTrail: false,
|
||||||
|
userData: JSON.stringify({
|
||||||
|
resetMe: {
|
||||||
|
resetMe: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function createGun(position) {
|
function createGun(position) {
|
||||||
|
|
|
@ -149,10 +149,12 @@ MasterReset = function() {
|
||||||
|
|
||||||
function createRaveStick(position) {
|
function createRaveStick(position) {
|
||||||
var modelURL = "http://hifi-content.s3.amazonaws.com/eric/models/raveStick.fbx";
|
var modelURL = "http://hifi-content.s3.amazonaws.com/eric/models/raveStick.fbx";
|
||||||
|
var rotation = Quat.fromPitchYawRollDegrees(0, 0, 0);
|
||||||
var stick = Entities.addEntity({
|
var stick = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
name: "raveStick",
|
name: "raveStick",
|
||||||
modelURL: modelURL,
|
modelURL: modelURL,
|
||||||
|
rotation: rotation,
|
||||||
position: position,
|
position: position,
|
||||||
shapeType: 'box',
|
shapeType: 'box',
|
||||||
collisionsWillMove: true,
|
collisionsWillMove: true,
|
||||||
|
@ -189,6 +191,66 @@ MasterReset = function() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var forwardVec = Quat.getFront(rotation);
|
||||||
|
var forwardQuat = Quat.rotationBetween(Vec3.UNIT_Z, forwardVec);
|
||||||
|
var color = {
|
||||||
|
red: 150,
|
||||||
|
green: 20,
|
||||||
|
blue: 100
|
||||||
|
}
|
||||||
|
var raveGlowEmitter = Entities.addEntity({
|
||||||
|
type: "ParticleEffect",
|
||||||
|
name: "Rave Stick Glow Emitter",
|
||||||
|
position: position,
|
||||||
|
parentID: stick,
|
||||||
|
isEmitting: true,
|
||||||
|
colorStart: color,
|
||||||
|
color: {
|
||||||
|
red: 200,
|
||||||
|
green: 200,
|
||||||
|
blue: 255
|
||||||
|
},
|
||||||
|
colorFinish: color,
|
||||||
|
maxParticles: 100000,
|
||||||
|
lifespan: 0.8,
|
||||||
|
emitRate: 1000,
|
||||||
|
emitOrientation: forwardQuat,
|
||||||
|
emitSpeed: 0.2,
|
||||||
|
speedSpread: 0.0,
|
||||||
|
emitDimensions: {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
},
|
||||||
|
polarStart: 0,
|
||||||
|
polarFinish: 0,
|
||||||
|
azimuthStart: 0.1,
|
||||||
|
azimuthFinish: 0.01,
|
||||||
|
emitAcceleration: {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
},
|
||||||
|
accelerationSpread: {
|
||||||
|
x: .00,
|
||||||
|
y: .00,
|
||||||
|
z: .00
|
||||||
|
},
|
||||||
|
radiusStart: 0.01,
|
||||||
|
radiusFinish: 0.005,
|
||||||
|
alpha: 0.7,
|
||||||
|
alphaSpread: 0.1,
|
||||||
|
alphaStart: 0.1,
|
||||||
|
alphaFinish: 0.1,
|
||||||
|
textures: "https://s3.amazonaws.com/hifi-public/eric/textures/particleSprites/beamParticle.png",
|
||||||
|
emitterShouldTrail: false,
|
||||||
|
userData: JSON.stringify({
|
||||||
|
resetMe: {
|
||||||
|
resetMe: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function createGun(position) {
|
function createGun(position) {
|
||||||
|
|
Loading…
Reference in a new issue