Page 1 of 1

[Issue]particle system behave weird about offset and size

Posted: Sun Nov 26, 2017 8:28 am
by dracula004
love version:0.10.2
zzzz.gif
zzzz.gif (777.7 KiB) Viewed 2962 times
in the gif above, every particle system, except the sizes, is exactly same.

the red rectangle is the area designed for particle spread,
but it seems that the size affects the offset in someway.

is it a bug of particle system?

Code: Select all

	ps0:setSizes(1)
	ps0:setParticleLifetime(1)
	ps0:setOffset( 0, offsetY )
	ps0:setAreaSpread( "uniform", 0, spreadY )
	ps0:setEmissionRate(100)
	ps0:start()
	table.insert(ps,ps0)

	table.insert(ps,ps0:clone())
	ps[#ps]:setSizes(0.7)

	table.insert(ps,ps0:clone())
	ps[#ps]:setSizes(0.5)

	table.insert(ps,ps0:clone())
	ps[#ps]:setSizes(0.3)

	table.insert(ps,ps0:clone())
	ps[#ps]:setSizes(0.3,1)

	table.insert(ps,ps0:clone())
	ps[#ps]:setSizes(0.3,1,0.3)

	table.insert(ps,ps0:clone())
	ps[#ps]:setSizes(1,0.3)

Re: [Issue]particle system behave weird about offset and size

Posted: Sun Nov 26, 2017 4:35 pm
by slime
ParticleSystem:setOffset is very similar to the offset parameters to love.graphics.draw – it sets the pivot point of each particle, relative to the top-left of the particle sprite (or quad).

When things are drawn with LÖVE, the origin offset is applied first, then it's scaled, rotated, and translated.

The code sets the offset to (0, -100) but the particle sprite is 8x8, so the pivot point (origin of rotation and scale etc.) of each sprite isn't even within the sprite's image.

Re: [Issue]particle system behave weird about offset and size

Posted: Tue Nov 28, 2017 8:41 am
by dracula004
slime wrote: Sun Nov 26, 2017 4:35 pm When things are drawn with LÖVE, the origin offset is applied first, then it's scaled, rotated, and translated.
So it seems difficult to get things work as I expect.

i found this issue while trying draw laser effect in my game.
or does anyone got other method to draw a cool laser?

Re: [Issue]particle system behave weird about offset and size

Posted: Tue Nov 28, 2017 9:40 pm
by slime
If you're trying to set the position of the particle system itself, you can use ParticleSystem:setPosition, ParticleSystem:moveTo, or the x and y parameters of love.graphics.draw (each method behaves slightly differently).