Gravity Engine  1.5
Unity Asset for Gravity
GravityParticles Class Reference

Evolve particles in the gravitation field computed by the GravityEngine. More...

Inheritance diagram for GravityParticles:

Public Member Functions

double Evolve (double evolveTime, int numBodies, GravityState gravityState, ref double[] size2, ref byte[] info)
 Evolve for the specified evolveTime using a dedicated Leapfrog integrator. More...
 
double EvolveWithForce (double evolveTime, int numBodies, GravityState gravityState, ref double[] size2, ref byte[] info, IForceDelegate force)
 Evolves particles using massice bodies the with force delegate provided. More...
 
void UpdateParticles (float physicalScale)
 Updates the particles positions in world space. More...
 

Public Attributes

bool addNBodyVelocity = false
 If the particle system has an NBody or NBody parent, add the velocity of the NBody to particles that are created.
 
Vector3 initialVelocity = Vector3.zero
 Initial velocity to be added to particles (may be over-riden by an IGravityParticlesInit script, if present)
 

Detailed Description

Evolve particles in the gravitation field computed by the GravityEngine.

This script is attached to a Unity ParticleSystem. Initialization of the particles may be handled by a script implementing IGravityParticleInit. Two common examples are DustBall and DustRing. If there is no init delegate the Unity particle creation will be applied.

Each instance of GravityParticles manages the gravitational evolution of it's particle system. Particles are massless (they do not affect other particles) and are evolved with a built-in Leapfrog integrator. Particles which move within the particle capture radius of an NBody are made inactive and will not be further evolved. Particles that move outside the GravityEngine horizon are also made inactive.

Member Function Documentation

double GravityParticles.Evolve ( double  evolveTime,
int  numBodies,
GravityState  gravityState,
ref double[]  size2,
ref byte[]  info 
)

Evolve for the specified evolveTime using a dedicated Leapfrog integrator.

Evolve is called by GravityEngine on the fixed update loop. Do not call from scene scripts.

Parameters
evolveTimeEvolve time.
numBodiesNumber bodies.
mM.
r_mR m.
size2Size2.
infoInfo.
double GravityParticles.EvolveWithForce ( double  evolveTime,
int  numBodies,
GravityState  gravityState,
ref double[]  size2,
ref byte[]  info,
IForceDelegate  force 
)

Evolves particles using massice bodies the with force delegate provided.

Returns
The with force.
Parameters
evolveTimeEvolve time.
numBodiesNumber bodies.
mM.
r_mR m.
size2Size2.
infoInfo.
forceForce.
void GravityParticles.UpdateParticles ( float  physicalScale)

Updates the particles positions in world space.

UpdateParticles is called from the GravityEngine. Do not call from other scripts.

Parameters
physicalScalePhysical scale.

The documentation for this class was generated from the following file: