Tutorial: Particles

Particles from a Unity particle system can also be moved by GE2. Unity provides a lot of control over particle generation and lifetimes giving them “a life of their own”. This requires tight coupling between the gravitational force calculations and code that checks for particle creation/extinction. Particles can be created by the Unity using the standard Unity component ParticleSystem. If the same game object with the particle system has a GSParticles component then GE2 will handle the movement of the particles. Additional components can be added to manage the initial conditions of the particles. For example DustRing initializes particles in an orbit around a central body and DustBall creates a ball of particles with a specific world space position and velocity.

The evolution of particles is tightly linked to a specific display context and particle system so particles must be added to a GSDisplay managed object. This precludes having two views of the same exact particle positions. If a series of small objects in two views is required that is best done by adding them as massless bodies using GSBody.

Currently the evolution of the particles is done on the main thread (not job mode) independent of the choice of EvolveMode in the GSController. The eventual goal is to remove this limitation after more debugging (there were issues with particle spawning that were set aside for now).

The tutorial scene presents two GE2 particle components: DustBall and DustRing.

DustBall

DustRing

Implementation Notes