Game Development Community

Particle emitter positions...

by Stephen Nichols · in Torque Game Builder · 03/26/2009 (2:35 pm) · 1 replies

Hey, we've run into and fixed a neat bug with the particle system. It seems that particles emitted from a moving emitter are not using the render position of the emitter source, but the logical position instead. This causes particles to be emitted visually in the future. It's very disconcerting when emitters are 90 degress offset from the forward motion of the parent object.

It seems that the engine "tweens" positions for rendering between simulation updates (currently set to be 32ms). This means that "getPosition" on a scene object returns where the object will be at the next simulation step. Where the object is currently at visually does not match getPosition. Not a big deal once you know about it. :)

Take a look at t2dParticleEmitter.cc line 2938 in the default source. If mAttachPositionToEmitter is true then the system does some work to make sure it's attached properly. The rotation attach code seems to use getRenderRotation. However, the position attach code uses the "future" position of the object via getPosition. I've changed that to use the render position in my version of the source and the visual discrepency is fixed!

Perhaps this fix should make it into the released engine at some point?

steve

#1
05/22/2009 (5:18 am)
Nice catch. I have corrected this and it will be in the next release.

Ref: TGB-295