Class

PhysicsParticle

PhysicsEngine.PhysicsParticle()

Physics particle class

Constructor

# new PhysicsParticle()

View Source utils/physicsEngine.js, line 121

Methods

# applyForce(force)

Apply force to particle

Parameters:
Name Type Description
force Vector2D

Force vector

View Source utils/physicsEngine.js, line 151

# applyGravity(other, G)

Apply gravitational force from another particle

Parameters:
Name Type Default Description
other PhysicsParticle

Other particle

G number 0.1

Gravitational constant

View Source utils/physicsEngine.js, line 262

# bounceOffBoundaries(width, height)

Bounce off boundaries

Parameters:
Name Type Description
width number

Boundary width

height number

Boundary height

View Source utils/physicsEngine.js, line 279

# collidesWith(other) → {boolean}

Check collision with another particle

Parameters:
Name Type Description
other PhysicsParticle

Other particle

View Source utils/physicsEngine.js, line 207

Collision detected

boolean

# resolveCollision(other)

Resolve collision with another particle

Parameters:
Name Type Description
other PhysicsParticle

Other particle

View Source utils/physicsEngine.js, line 216

# update(deltaTime)

Update particle physics

Parameters:
Name Type Description
deltaTime number

Time step

View Source utils/physicsEngine.js, line 159

# updateTrail()

Update particle trail

View Source utils/physicsEngine.js, line 194

# wrapAroundBoundaries(width, height)

Wrap around boundaries

Parameters:
Name Type Description
width number

Boundary width

height number

Boundary height

View Source utils/physicsEngine.js, line 302