Hi guys,
We're currently working on smoke grenades for the game, and we're using particles for it, it's really nice but we have a question. We want to control particles scaterring to not let them go through walls or pilars for instance, like in this image:
We want the particules to stay in the area we've computed (the white limits), is there any way to do it?
Thanks!
Particles scattering
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Particles scattering
You would need to get the position of each particle and then apply collision detection on it. In LÖVE's particleSystem, I don't see any method for getting the particle positions. So you would have to implement an own particle system.
Check out my blog on gamedev
Re: Particles scattering
Thanks, I was a bit afraid of this answer...
What I'm also considering is to render the particles into a canvas and apply it in my final scene with a mask cropping what I don't want, but I'm afraid it'll be quite strange on the edges, maybe by applying a gradient it'll be acceptable.
But before going this route I wanted to be sure that there's no other solution, so d'ont hesitate if you have any idea!
What I'm also considering is to render the particles into a canvas and apply it in my final scene with a mask cropping what I don't want, but I'm afraid it'll be quite strange on the edges, maybe by applying a gradient it'll be acceptable.
But before going this route I wanted to be sure that there's no other solution, so d'ont hesitate if you have any idea!
Re: Particles scattering
I have an idea, but I've never done it. You can apply a shader to a particle system. You could draw the area you computed to a texture and multiply it with the particles. Then any particles out side of the computed area would simply be not-visible, yes?
Re: Particles scattering
Take a look at stencils. http://www.love2d.org/wiki/love.graphics.setStencil
You can use a stencil the shape of your area and then draw your particle system, I'm not sure whether a gradient would work as a stencil to smooth the edges.
You can use a stencil the shape of your area and then draw your particle system, I'm not sure whether a gradient would work as a stencil to smooth the edges.
Who is online
Users browsing this forum: No registered users and 64 guests