Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Finer Control for Emitter Particles?
Started by kcdev Nov 11 2017 12:23 AM

5 replies to this topic
emitter particle
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

kcdev

[GLOBAL: userInfoPane.html]
kcdev
  • Contributor

  • 115 posts
  • Corona SDK

Hi Corona Community,

 

I was wondering if we have finer control over each individual emitter particle. Namely, I have the 2 following questions:

1) Is it possible to rotate each individual particle, after it is created? (I am NOT talking about radialAcceleration,  tangentialAcceleration, or rotatePerSecond, which dictates the path of particles.) In particular, I want to achieve uniform linear motion (ULM) with rotation. If you are having trouble imagining this, think of wheels on a car, etc. If you are still having trouble comprehending, see this UFO .gif file attached. (Ignore the last second of the gif, where the UFO zooms off to infinity with near-infinite acceleration  -_-)

 

2) Is it possible to change the size of each individual particle externally after the emitter is started?

 

I've tried

transition.to(emitter, {time = 1000, xScale = 3, yScale = 3}) 

but what that did was multiply the distance of each particle from the origin by xScale and yScale, but did NOT increase the size of each particle, which is the behavior I wanted.

 

I even tried (out of desperation) the following:

transition.to(emitter, {time = 1000, startParticleSize = 300, finishParticleSize = 300}) 

in the hopes that the start/finishParticleSize parameters will be passed to the underlying object which is "emitter", but to absolutely no surprise, that did not work..

 

Is what I am trying to do even possible? And if so, how would I go about doing it?

 

Thanks in advance!  :)

Attached Files



[TOPIC: post.html]
#2

kcdev

[GLOBAL: userInfoPane.html]
kcdev
  • Contributor

  • 115 posts
  • Corona SDK

One more quick question.

 

For an emitter object, setting the x and y coordinates moves the location of the particles, but does not move the location of the origin.

 

Is there any way to move the origin of an emitter dynamically after creation?

 

Thanks!

KC



[TOPIC: post.html]
#3

mateusz8

[GLOBAL: userInfoPane.html]
mateusz8
  • Enthusiast

  • 31 posts
  • Corona SDK

I'm having similar problem, have you found any solution?



[TOPIC: post.html]
#4

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,594 posts
  • Corona SDK

What parts of that gif are you considering to be particles.  Everything in that picture looks like a sprite with some sort of transition to me except the smoke.

 

1. No you can't do anything with individual particles after they are created.  They are NOT display objects, they are managed by Corona.

 

2. Maybe, I'll think more about this.

 

 

If you want to have more control and the ability to dig into a particle system's code, use CBE: https://github.com/GymbylCoding/CBEffects or PRISM https://github.com/GymbylCoding/Prism



[TOPIC: post.html]
#5

Appletreeman

[GLOBAL: userInfoPane.html]
Appletreeman
  • Contributor

  • 450 posts
  • Corona SDK

I have a vague memory of one of my (many) unfinished projects where I changed particle values on the fly.  IIRC I think I changed the colours based on the players score.  When I get a chance I'll see if I can find it* and let you know how I did it.

 

 

 

*assuming I've still got it and haven't scrapped it/over written etc.



[TOPIC: post.html]
#6

Appletreeman

[GLOBAL: userInfoPane.html]
Appletreeman
  • Contributor

  • 450 posts
  • Corona SDK

@roaminggamer is spot on.  You can't change particles AFTER they've been created.  I had an emitter that was on constantly and I was changing the parameters so that any new particle created would have the new value.

For example, if you wanted your particles to change from purple to blue then you would just change the parameter:

emitter.startColorRed = 0

so that any new particles would be changed without having to stop and start the emitter.

 

i know that's not exactly what you were after (sorry) but it's still useful to know.




[topic_controls]
[/topic_controls]