Changing Emitter's position

26 views
Skip to first unread message

Mike Wyatt

unread,
Oct 11, 2012, 2:15:56 AM10/11/12
to py-lept...@googlegroups.com
Is it possible to change the position of a StaticEmitter?  "emit" appears to be the only member exposed on the Python object.

I want to integrate PyLepton into my scene graph implementation, so each ParticleGroup would be wrapped by a node.  A node in turn would have a screen position, which when changed would need to move the emitter.

I'd welcome alternative solutions, if moving an emitter isn't feasible.

Thanks!

Casey Duncan

unread,
Oct 11, 2012, 2:08:00 PM10/11/12
to py-lept...@googlegroups.com
Hi Mike,

Yes, you can dynamically change the position of the emitted particles
by changing the template particle of the emitter. The flyby example
has code that does this.

Another option which is better if you are emitting from a very large
set of positions which may vary is to use a per-particle emitter. This
makes a particle group into a set of emitters. These particles can be
static, or dynamic to give a variety of effects (see the fireworks
example).

hth,

-Casey
> --
> You received this message because you are subscribed to the Google Groups
> "General discussion of the Lepton particle engine for Python" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/py-lepton-users/-/5mSNzOOH4mAJ.
> To post to this group, send email to py-lept...@googlegroups.com.
> To unsubscribe from this group, send email to
> py-lepton-use...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/py-lepton-users?hl=en.

Mike Wyatt

unread,
Oct 11, 2012, 10:26:06 PM10/11/12
to py-lept...@googlegroups.com
Thanks Casey.  I confirmed that that worked if I initialize my emitter by setting a position on the template Particle.  But what if I use the discrete position property of the emitter, and use a domain?  It doesn't seem possible to change that position attribute, or gain access to the domain and change that.

I like your other idea, but I'm hoping to build a more generic solution that doesn't require coupling between different "instances" of an effect.

Casey Duncan

unread,
Oct 12, 2012, 3:03:43 AM10/12/12
to py-lept...@googlegroups.com
I don't see a way to change discrete positions of an emitter after the
fact (forgive me as a younger version of myself is responsible and I
am reverse-engineering). I suspect this was never considered a
use-case.

As for domains, changing their position depends on the shape. Lines
have start_point and end_point, spheres have center, planes have
point. So it is possible, however the documentation is admittedly
lacking. The source code is unfortunately the best source of info
here.

I don't see any easy way to get the domain from the emitter, though
you could workaround this by creating the domain and storing it in
another attribute before passing it to the emitter. This would achieve
the same result.

-Casey
> https://groups.google.com/d/msg/py-lepton-users/-/mg_UngGK5soJ.

Mike Wyatt

unread,
Oct 13, 2012, 10:43:12 AM10/13/12
to py-lept...@googlegroups.com
Thanks Casey, that should work.
Reply all
Reply to author
Forward
0 new messages