Update particle scripts

This commit is contained in:
David Rowe 2015-09-18 11:34:26 -07:00
parent 8634b59914
commit 68874eed96
5 changed files with 24 additions and 26 deletions

View file

@ -83,19 +83,18 @@
lastFrame: 10000, lastFrame: 10000,
running: true running: true
}); });
var PI = 3.141593;
var DEG_TO_RAD = PI / 180.0;
this.paintStream = Entities.addEntity({ this.paintStream = Entities.addEntity({
type: "ParticleEffect", type: "ParticleEffect",
animationSettings: animationSettings, animationSettings: animationSettings,
position: this.properties.position, position: this.properties.position,
textures: "https://raw.githubusercontent.com/ericrius1/SantasLair/santa/assets/smokeparticle.png", textures: "https://raw.githubusercontent.com/ericrius1/SantasLair/santa/assets/smokeparticle.png",
emitVelocity: ZERO_VEC, emitSpeed: 0,
speedSpread: 0.02,
polarFinish: 2 * DEG_TO_RAD,
emitAcceleration: ZERO_VEC, emitAcceleration: ZERO_VEC,
velocitySpread: {
x: .02,
y: .02,
z: 0.02
},
emitRate: 100, emitRate: 100,
particleRadius: 0.01, particleRadius: 0.01,
color: { color: {
@ -132,7 +131,8 @@
position = Vec3.sum(position, Vec3.multiply(upVec, TIP_OFFSET_Y)) position = Vec3.sum(position, Vec3.multiply(upVec, TIP_OFFSET_Y))
Entities.editEntity(self.paintStream, { Entities.editEntity(self.paintStream, {
position: position, position: position,
emitVelocity: Vec3.multiply(forwardVec, 4) emitOrientation: forwardVec,
emitSpeed: 4
}); });
//Now check for an intersection with an entity //Now check for an intersection with an entity

View file

@ -101,7 +101,6 @@ Rocket = function(point, colorPalette) {
this.burst = false; this.burst = false;
this.emitRate = randInt(80, 120); this.emitRate = randInt(80, 120);
this.emitStrength = randInt(5.0, 7.0);
this.rocket = Entities.addEntity({ this.rocket = Entities.addEntity({
type: "Sphere", type: "Sphere",
@ -163,6 +162,9 @@ Rocket.prototype.explode = function(position) {
}); });
var colorIndex = 0; var colorIndex = 0;
var PI = 3.141593;
var DEG_TO_RAD = PI / 180.0;
for (var i = 0; i < NUM_BURSTS; ++i) { for (var i = 0; i < NUM_BURSTS; ++i) {
var color = this.colors[colorIndex]; var color = this.colors[colorIndex];
print(JSON.stringify(color)); print(JSON.stringify(color));
@ -172,12 +174,7 @@ Rocket.prototype.explode = function(position) {
position: position, position: position,
textures: 'https://raw.githubusercontent.com/ericrius1/SantasLair/santa/assets/smokeparticle.png', textures: 'https://raw.githubusercontent.com/ericrius1/SantasLair/santa/assets/smokeparticle.png',
emitRate: this.emitRate, emitRate: this.emitRate,
emitStrength: this.emitStrength, polarFinish: 25 * DEG_TO_RAD,
emitDirection: {
x: Math.pow(-1, i) * randFloat(0.0, 1.4),
y: 1.0,
z: 0.0
},
color: color, color: color,
lifespan: 1.0, lifespan: 1.0,
visible: true, visible: true,

View file

@ -6,6 +6,9 @@
var AUDIO_RANGE = 0.5 * RANGE; var AUDIO_RANGE = 0.5 * RANGE;
var DIST_BETWEEN_BURSTS = 1.0; var DIST_BETWEEN_BURSTS = 1.0;
var PI = 3.141593;
var DEG_TO_RAD = PI / 180.0;
var LOUDNESS_RADIUS_RATIO = 10; var LOUDNESS_RADIUS_RATIO = 10;
var TEXTURE_PATH = 'https://raw.githubusercontent.com/ericrius1/SantasLair/santa/assets/smokeparticle.png'; var TEXTURE_PATH = 'https://raw.githubusercontent.com/ericrius1/SantasLair/santa/assets/smokeparticle.png';
@ -86,12 +89,7 @@
position: this.point, position: this.point,
textures: TEXTURE_PATH, textures: TEXTURE_PATH,
emitRate: this.emitRate, emitRate: this.emitRate,
emitStrength: this.emitStrength, polarFinish: 25 * DEG_TO_RAD,
emitDirection: {
x: Math.pow(-1, i) * randFloat(0.0, 0.4),
y: 1.0,
z: 0.0
},
color: color, color: color,
lifespan: 1.0, lifespan: 1.0,
visible: true, visible: true,

View file

@ -35,13 +35,16 @@
firstFrame: 0, firstFrame: 0,
lastFrame: 30, lastFrame: 30,
loop: true }); loop: true });
var PI = 3.141593;
var DEG_TO_RAD = PI / 180.0;
this.entity = Entities.addEntity({ type: "ParticleEffect", this.entity = Entities.addEntity({ type: "ParticleEffect",
animationSettings: animationSettings, animationSettings: animationSettings,
position: spawnPoint, position: spawnPoint,
dimensions: {x: 2, y: 2, z: 2}, dimensions: {x: 2, y: 2, z: 2},
emitVelocity: {x: 0, y: 5, z: 0}, emitSpeed: 5,
velocitySpread: {x: 2, y: 0, z: 2}, speedSpread: 2,
polarFinish: 30 * DEG_TO_RAD,
emitAcceleration: {x: 0, y: -9.8, z: 0}, emitAcceleration: {x: 0, y: -9.8, z: 0},
textures: "https://hifi-public.s3.amazonaws.com/alan/Particles/Particle-Sprite-Smoke-1.png", textures: "https://hifi-public.s3.amazonaws.com/alan/Particles/Particle-Sprite-Smoke-1.png",
color: color, color: color,

View file

@ -45,6 +45,8 @@ var explodeAnimationSettings = JSON.stringify({
var GRAVITY = -9.8; var GRAVITY = -9.8;
var TIME_TO_EXPLODE = 2500; var TIME_TO_EXPLODE = 2500;
var DISTANCE_IN_FRONT_OF_ME = 1.0; var DISTANCE_IN_FRONT_OF_ME = 1.0;
var PI = 3.141593;
var DEG_TO_RAD = PI / 180.0;
function makeGrenade() { function makeGrenade() {
var position = Vec3.sum(MyAvatar.position, var position = Vec3.sum(MyAvatar.position,
@ -87,8 +89,7 @@ function update() {
position: newProperties.position, position: newProperties.position,
textures: 'https://raw.githubusercontent.com/ericrius1/SantasLair/santa/assets/smokeparticle.png', textures: 'https://raw.githubusercontent.com/ericrius1/SantasLair/santa/assets/smokeparticle.png',
emitRate: 100, emitRate: 100,
emitStrength: 2.0, polarFinish: 25 * DEG_TO_RAD,
emitDirection: { x: 0.0, y: 1.0, z: 0.0 },
color: { red: 200, green: 0, blue: 0 }, color: { red: 200, green: 0, blue: 0 },
lifespan: 10.0, lifespan: 10.0,
visible: true, visible: true,
@ -145,8 +146,7 @@ function boom() {
position: properties.position, position: properties.position,
textures: 'https://raw.githubusercontent.com/ericrius1/SantasLair/santa/assets/smokeparticle.png', textures: 'https://raw.githubusercontent.com/ericrius1/SantasLair/santa/assets/smokeparticle.png',
emitRate: 200, emitRate: 200,
emitStrength: 3.0, polarFinish: 25 * DEG_TO_RAD,
emitDirection: { x: 0.0, y: 1.0, z: 0.0 },
color: { red: 255, green: 255, blue: 0 }, color: { red: 255, green: 255, blue: 0 },
lifespan: 2.0, lifespan: 2.0,
visible: true, visible: true,