Skip to content

Instantly share code, notes, and snippets.

@squarefeet
Created October 16, 2015 23:18
Show Gist options
  • Save squarefeet/7ce6fe42fcf9a803bd9c to your computer and use it in GitHub Desktop.
Save squarefeet/7ce6fe42fcf9a803bd9c to your computer and use it in GitHub Desktop.
SPE valueOverLifetimeLength bug
particleTexture = this.params.map ? ENGINE.loadCachedTexture('/img/particles/' + this.params.map + '.png') : null;
particleArray = ENGINE.mc.get('particleArray');
this.particleGroup = new SPE.Group({
texture: particleTexture,
fog: true
});
if( !this.initpos ){
if( this.params.initPos ){
this.initpos = this.params.initPos;
}else{
this.initpos = new THREE.Vector3();
}
}
var type;
switch( this.params.type ){
case 'cube':
type = SPE.distributions.BOX;
break;
case 'sphere':
type = SPE.distributions.SPHERE;
break;
}
this.emitter = new SPE.Emitter( {
particleCount: parseInt(this.params.resolution),
maxAge: {
value: parseInt(this.params.maxAge),
spread: 0
},
position: {
value: this.initpos,
spread: this.params.positionSpread,
spreadClamp: new THREE.Vector3( 0, 0, 0 ),
distribution: type,
randomise: false
},
radius: {
value: parseFloat(this.params.radius),
spread: 0,
scale: new THREE.Vector3( 1, 1, 1 )
},
velocity: {
value: this.params.velocity,
spread: this.params.velocitySpread,
distribution: type,
randomise: false
},
acceleration: {
value: this.params.acceleration,
spread: this.params.accelerationSpread,
distribution: type,
randomise: false
},
drag: {
value: 0,
spread: 0
},
wiggle: {
value: parseInt(this.params.wiggle),
spread: parseInt(this.params.wiggleSpread)
},
/*
rotation: {
axis: new THREE.Vector3( 0, 1, 0 ),
axisSpread: new THREE.Vector3( 0, 0, 0 ),
angle: Math.PI * 0.5, // radians
angleSpread: 0, // radians
static: false,
center: new THREE.Vector3( 0, 0, 0 )
},
*/
size: {
value: this.params.size,
spread: this.params.sizeSpread,
},
speed: {
value: parseFloat(this.params.speed),
spread: parseFloat(this.params.speedSpread),
},
color: {
value: [this.params.colorStart, this.params.colorMiddle, this.params.colorEnd ]
},
opacity: {
value: this.params.opacity,
spread: this.params.opacitySpread
},
angle: {
value: 0,
spread: 0
}
// duration: 5,
// activeMultiplier: 1,
// isStatic: true
});
if( parseInt(this.params.duration) ){
this.emitter.duration = parseInt(this.params.duration);
}
//dagger gold
params = {
type : 'cube',
velocity : new THREE.Vector3(0,4,0),
velocitySpread : new THREE.Vector3(0,6,0),
positionSpread : new THREE.Vector3(1,0,1),
colorStart : new THREE.Color(1,0.9,0.1),
colorMiddle : new THREE.Color(1,0.9,0.1),
colorEnd : new THREE.Color(1,0.9,0.1),
colorStartSpread : new THREE.Vector3(10,10,10),
duration : 0,
maxAge : 1,
size : [1,1,1],
sizeSpread : [5,10,5],
map : 4,
speed : 1,
speedSpread : 3,
resolution : 300,
radius : 1,
opacity : [0,1,0],
opacitySpread : [0,0,0],
angleVelocity : 1,
angleStart : 0,
acceleration : new THREE.Vector3(0,0,0),
accelerationSpread : new THREE.Vector3(0,0,0),
initPos : new THREE.Vector3(0,-1,0)
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment