[Issue]particle system behave weird about offset and size

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
dracula004
Prole
Posts: 17
Joined: Tue Mar 03, 2015 2:50 am
Location: Asia

[Issue]particle system behave weird about offset and size

Post by dracula004 »

love version:0.10.2
zzzz.gif
zzzz.gif (777.7 KiB) Viewed 2915 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)
Attachments
PS_TEST.love
(1.45 KiB) Downloaded 100 times
github:https://github.com/Nigh

email:xianyi.xia#outlook.com
User avatar
slime
Solid Snayke
Posts: 3161
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

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

Post 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.
User avatar
dracula004
Prole
Posts: 17
Joined: Tue Mar 03, 2015 2:50 am
Location: Asia

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

Post 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?
github:https://github.com/Nigh

email:xianyi.xia#outlook.com
User avatar
slime
Solid Snayke
Posts: 3161
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

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

Post 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).
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 2 guests