public class Gravity extends Effector
|Modifier and Type||Field and Description|
|Constructor and Description|
Creates a gravity effector with earth equivalent gravity.
Creates a gravity effector.
|Modifier and Type||Method and Description|
Applies this effector to the
public static final float EARTH_G
public Gravity(float accel)
accel- the constant acceleration to apply to the y velocity of a particle. Positive accelerates the particle toward the bottom of the screen.
public void apply(int index, float data, int start, float now, float dt)
indexth particle in the supplied buffer. The effector must use the
ParticleBufferoffsets to extract fields from
data, for example:
float x = data[start+ParticleBuffer.POS_X].
index- the index of the particle, which can be used to index into other per-particle data arrays.
data- the particle field data.
start- the offset into
dataat which the particle's fields start.
now- the number of seconds elapsed since the emitter came into being. Can be used to compute a particle's age.
dt- the amount of time (in fractions of a second) that has elapsed since the last update.
Copyright © 2019. All rights reserved.