HomeHome  SearchSearch  RegisterRegister  Log inLog in  

Share
 

 changing emitter type dynamically, possible?

Go down 
AuthorMessage
enrac



Messages : 1
Date d'inscription : 2013-05-10

changing emitter type dynamically, possible? Empty
PostSubject: changing emitter type dynamically, possible?   changing emitter type dynamically, possible? Icon_minitimeFri May 10, 2013 3:26 pm

Hi there, I'm using Spark (and loving it so far), and I had a question. I'm trying to implement a system that creates one emitter object, which feeds into a group. I want to be able to change the emitter type dynamically. In my class, I have something like this:

Emitter* pointerToCurrentEmitterObject;
pointerToCurrentEmitterObject = SphericalEmitter::Create(...);

and the Group class adds this pointer later. Now, at some point, I want to change this to a Straight emitter:

Emitter* tmpEmitter = pointerToCurrentEmitterObject;
pointerToCurrentEmitterObject = StraightEmitter::Create(...);

if (tmpEmitter) delete tmpEmitter;

However, what happens is that the Spherical emitter stops, and the Striaght emitter doesn't work. I'm guessing that something underneath needs updating. Any thoughts on how I could do this?

cheers.
Back to top Go down
Darktib
Committer
Darktib

Messages : 389
Date d'inscription : 2009-07-20
Localisation : A coté de Paris

changing emitter type dynamically, possible? Empty
PostSubject: Re: changing emitter type dynamically, possible?   changing emitter type dynamically, possible? Icon_minitimeTue May 14, 2013 3:44 am

Well, you are just changing a pointer - this cannot work like this.

The best approach is:
- remove emitter from group
- (optional) delete it
- add the new emitter to the group

Also, I'm finalizing a part of SPARK 2.0, where such tasks will be a lot more easier to do (controls & attributes)

_________________
changing emitter type dynamically, possible? A824d8828e17173a5d5b383b8744118b28a79bc96c7deba8910bed109308d4304g
Back to top Go down
 
changing emitter type dynamically, possible?
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
 :: English Forum :: Questions (en)-
Jump to: