Particle system bug?
by Matthew Shapiro · in Torque X 2D · 09/17/2007 (5:40 am) · 2 replies
So I've been playing around with extending the tutorials and learning things with TX. I attached a particle effect to my bullets to create an exhaust trail behind bullets. I pretty much just created a particle effect where the particles don't move. In the code I clone the effect and mount it onto the bullet. That part works fine as you can see from this screenshot: http://img206.imageshack.us/my.php?image=strayparticlesei3.jpg.
If you look at the screenshot though you will notice a random stray particle. It seems to be one particle per shot that I fire and it always seems to go along the same line from my ship (assuming I dno't move my ship). Anyone have any idea why I would be having these stray particles?
Here's the code I'm using to mount it:
If you look at the screenshot though you will notice a random stray particle. It seems to be one particle per shot that I fire and it always seems to go along the same line from my ship (assuming I dno't move my ship). Anyone have any idea why I would be having these stray particles?
Here's the code I'm using to mount it:
if (exhaustTemplate != null)
{
// Attach it to the projectile
T2DSceneObject exhaust = exhaustTemplate.Clone() as T2DSceneObject;
TorqueObjectDatabase.Instance.Register(exhaust);
exhaust.Mount(projectile, "exhaust", true);
}
#2
*edit* Nevermind Josh was right. Pretty much it was a stray particle from moving the emitter from off the screen onto the projectile. Just setting the emitter's position to the position of the projectile fixed it.
09/17/2007 (3:36 pm)
Hrm actually I don't actually set a starting position when I clone the template. Could that be causing it (or would it clone it right ontop of where the template is located?). The template itself is way off the camera, but that doesn't make much sense figuring that the line that the stray particle will randomly spawn in is based on the ship's position.*edit* Nevermind Josh was right. Pretty much it was a stray particle from moving the emitter from off the screen onto the projectile. Just setting the emitter's position to the position of the projectile fixed it.
Torque Owner Josh Butterworth
I think the problem is that the particle effect starts before it's mounted to the projectile.