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,
running: true
});
var PI = 3.141593;
var DEG_TO_RAD = PI / 180.0;
this.paintStream = Entities.addEntity({
type: "ParticleEffect",
animationSettings: animationSettings,
position: this.properties.position,
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,
velocitySpread: {
x: .02,
y: .02,
z: 0.02
},
emitRate: 100,
particleRadius: 0.01,
color: {
@ -132,7 +131,8 @@
position = Vec3.sum(position, Vec3.multiply(upVec, TIP_OFFSET_Y))
Entities.editEntity(self.paintStream, {
position: position,
emitVelocity: Vec3.multiply(forwardVec, 4)
emitOrientation: forwardVec,
emitSpeed: 4
});
//Now check for an intersection with an entity

View file

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

View file

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

View file

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

View file

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