gamelab / WebGL-Particles-Plugin

WebGL Particle Plugin for your HTML5 games
MIT License
9 stars 4 forks source link

Particle Emmiter - Rotation / Scale with images does not have desired result #5

Closed zfreiberg closed 10 years ago

zfreiberg commented 10 years ago

When scaling a particle effect the image of the particle does not scale with it. Therefore a particle effect with a x scale of negative one, the emission points are changed as expected but the sprites (images) that are used are backwards(the original direction). (Which is expected for a particle emitter but not desired in this case)

This is only a problem when using specific images like gun flares.

BenjaminDRichards commented 10 years ago

I've added the following config parameters:

This does not allow the user to freely scale or flip sprites, which would be significantly more involved. It also does not react to the user rotating the particle GameObject, which would be a very nice piece of functionality for top-down effects (for example). The new functionality sets the stage for object-based rotation, so I'm leaving this issue open until this is also fixed.

BenjaminDRichards commented 10 years ago

Problem as solved as it can ever be.

Because of the WebGL standards out of Khronos, we can't scale the sprites themselves. It is impossible to scale a particle object in -1 to flip its facing.

However, the particles now inherit world transforms, allowing you to rotate the particle object on its own or as part of a group, while preserving directionality. It also deals with camera rotation seamlessly.

Performance should not be greatly impacted. There is a tiny bit more data moving through the shader pipeline, but the uniforms and attribute counts are actually still the same. There was spare room in an input buffer.