Game Development Community

Particle effects stop on screen edge

by Brian Tan · in iTorque 2D · 06/05/2009 (3:50 pm) · 8 replies

I am seeing an issue on iTGB (not regular version of TGB) where the particle effects I have mounted on a moving object disappears/stops when it reaches the edge of the screen.
I looked around the forums and there wasn't anything closely related to my issue.
I tried calling setUsesPhysics(true) as well as setWorldLimit to the maximum values but it didn't help. From the echo statements I put for debugging, I see that onStopEffect is called when it reaches the edge of the screen so I suspect it has something to do with the camera but I can't seem to find a way to set the particle effect to ignore camera limits.

#1
06/05/2009 (4:02 pm)
This is part of PUAP_OPTIMIZE, when a particles world limit is off screen, the particle stops playing. You can disable this by removing the code that's inside the #ifdef PUAP_OPTIMIZE flag in the particle code files.
#2
06/05/2009 (4:06 pm)
Thanks for the quick reply!

I'm wondering though, is there any other way to handle this besides changing the engine's source code?
#3
06/05/2009 (4:14 pm)
Set a bigger world limit on your particle, it should only disable the effect when the world-limit is off-screen.
#4
06/05/2009 (4:44 pm)
I did actually. I used setWorldLimit( null, "-5000 -5000 5000 5000", true ); but it didn't work.

From looking at the source code where you mentioned to remove code, I see that it performs the check against the current scene window's camera size.

Did it work for you when you set the world limit larger?
#5
06/05/2009 (4:55 pm)
He meant the world limit of the particle effect, not of the scenegraph
#6
06/07/2009 (4:21 am)
This is an inconvenient optimization. It shouldn't be a part of PUAP_OPTIMIZE and is basically a bug. The only time a particle effect should stop is when its told to stop.
#7
06/08/2009 (11:41 am)
@Marc: I just tried %this.mParticle.setWorldLimit( OFF, "-5000 -5000 5000 5000"); after creating that particle object but it still didn't work.

I agree with Conor that it shouldn't really be part of PUAP_OPTIMIZE because if the particle was used as a smoke trail, when the tip gets to the edge of the camera, the whole effect vanishes and that looks really bad.

For now, I have commented out that optimize code as per Mat's initial suggestion but maybe future versions shouldn't even have this anymore?
#8
11/08/2009 (10:27 pm)
Oh My! Just spent the last 8 hours trying to figure out this problem then i read this thread. Thanks guys!

GG get your stuff together man.