PowderForce

PowderForce is a NearBehavior that models the interaction between particles that are rigidly constrained (like a fine powder). It is a stiff deviation of Pressure behavior that directly applies a corrective impulse to maintain a target rest density. The idea for this behavior is inspired from the liquidFun engine. To simulate collision-like behavior, make the radius twice the size of the particle radius, and tune scaling and density values to fit to the collision stiffness. For more information on how this behavior works, go to the documentation for Pressure. This behavior can be used in conjunction with viscosity (0 quadratic drag) to simulate sliding friction.

Constructor

new PowderForce(radius, pScale, restDensity)

Instantiates new PowderForce behavior object

Parameters:
NameTypeDescription
radiusNumber

effective radius, determines the area of which density is sampled from

pScaleNumber

density relaxation scaling constant

restDensityNumber

target resting density (there are no units, its an approximate value)

Extends

Methods

applyBehavior(particle, particles, timeStep)

Calculates and applies the powder force relaxation

Parameters:
NameTypeDescription
particleParticle
particlesArray.<Particle>
timeStepNumber

applyCorrection(particle, particles)

This class does not require final position corrections

Parameters:
NameTypeDescription
particleParticle
particlesArray.<Particle>

findDensity(particle, particles) → {Array.<Number>}

Calculates the approximate density within the effective radius of the particle

Parameters:
NameTypeDescription
particleParticle
particlesArray.<Particle>
Returns:

an array of 2 numbers, [density, nearDensity]

Type: 
Array.<Number>

range() → {null}

Returns the effective range / defines the size of the nearby range

Returns:
Type: 
null