@latest SVN
Reproduce:
change in the specialFX example the box emitter to a point emitter. you are lucky if you see any particle at all, even with a very small direction vector.
Possible reason:
Particle.pos was never initalized + it's passed by reference and thus adds up the starting position pretty fast.
fix:
reset the position to 0,0,0
e.g:
add the line
Particle.pos = core::vector3df(0.f, 0.f, 0.f);
inside the emit() method.
Bug in CParticlePointEmitter
I'm sure you didn't look up the code. It works pretty well.
1. Point Emitter:
The Particle structure is created just once and that is upon the creation of the emitter class.
2. ParticleSystemNode:
now the CParticleSystemNode calls the emitt() method:
3. Point Emitter:
inside the emitt() method the particle structure is passed back as a reference to the doParticleSystem() method of the CParticleSystemNode.
4. ParticleSystemNode:
later in the doParticleSystem() method the array.pos vector is being altered,
which is identical to the Point Emitter Particle member.
unless i'm a totally idiot and incapable of reading clean written code i claim that not resetting the particle.pos to (0,0,0) is a bug, and resetting it for each particle is one of the possible fixes. =P
1. Point Emitter:
The Particle structure is created just once and that is upon the creation of the emitter class.
2. ParticleSystemNode:
now the CParticleSystemNode calls the emitt() method:
Code: Select all
s32 newParticles = Emitter->emitt(now, timediff, array);
inside the emitt() method the particle structure is passed back as a reference to the doParticleSystem() method of the CParticleSystemNode.
Code: Select all
outArray = &Particle;
later in the doParticleSystem() method the array.pos vector is being altered,
Code: Select all
if (ParticlesAreGlobal)
AbsoluteTransformation.transformVect(array[i].pos);
unless i'm a totally idiot and incapable of reading clean written code i claim that not resetting the particle.pos to (0,0,0) is a bug, and resetting it for each particle is one of the possible fixes. =P
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Ok, in fact I did check the code, but assumed a better copy handling in the ParticleSystemSceneNode. I have now fixed the copying there, i.e. the ParticleData is copied first and the transformation is applied to the copied value. I guess it would be best to change the parameter to ref-pointer-const as well.
So in short: You were right, but I think my solution is safer for general Emitter implementations.
So in short: You were right, but I think my solution is safer for general Emitter implementations.