DirectionalForce

Defines a directional force that affects all particles in the system.

var gravity = DirectionalForce.create([0.0, -0.1, 0.0])
DirectionalForce( vector )
src/forces/DirectionalForce.js:14
  • vector Array (Vec3)

    Direction vector

applyForce( ix, f0, p0, p1 ) protected
Defined in Force: src/forces/Force.js:67 Apply force to one particle in system.
  • ix Int
    Particle vector x index
  • f0 Float32Array (Vec3)
    Reference to ParticleSystem.accumulatedForces
  • p0 Float32Array (Vec3)
    Reference to ParticleSystem.positions
  • p1 Float32Array (Vec3)
    Reference to ParticleSystem.positionsPrev
create( ) static
src/forces/DirectionalForce.js:30

Create instance, accepts constructor arguments.

set( x, y, z )
Defined in Force: src/forces/Force.js:55 Alias for Vec3.set.
  • x Float
  • y Float
  • z Float
type Int (Enum)
src/forces/Force.js:43 Force type enum: Force.ATTRACTOR, Force.REPULSOR, Force.ATTRACTOR_REPULSOR.

Default: Force.ATTRACTOR