Gravity Engine 12.0
Unity Asset for Gravity
Loading...
Searching...
No Matches
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)
 Evolve for the specified evolveTime using a dedicated Leapfrog integrator.
 
double EvolveWithForce (double evolveTime, int numBodies, GravityState gravityState, IForceDelegate force)
 Evolves particles using massice bodies the with force delegate provided.
 
void UpdateParticles (float physicalScale, GravityEngine ge)
 Updates the particles positions in world space.
 
void MoveAll (ref double[] moveBy)
 
void AdjustVelocity (Vector3d velAdjust)
 

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

◆ Evolve()

double GravityParticles.Evolve ( double  evolveTime,
int  numBodies,
GravityState  gravityState 
)

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.

◆ EvolveWithForce()

double GravityParticles.EvolveWithForce ( double  evolveTime,
int  numBodies,
GravityState  gravityState,
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.

◆ UpdateParticles()

void GravityParticles.UpdateParticles ( float  physicalScale,
GravityEngine  ge 
)

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: