MCPcopy
hub / github.com/KilledByAPixel/LittleJS / applyForce

Method applyForce

plugins/box2d.js:529–534  ·  view source on GitHub ↗

Apply force to this object * @param {Vector2} force * @param {Vector2} [pos]

(force, pos)

Source from the content-addressed store, hash-verified

527 * @param {Vector2} force
528 * @param {Vector2} [pos] */
529 applyForce(force, pos)
530 {
531 pos ||= this.getCenterOfMass();
532 this.setAwake();
533 this.body.ApplyForce(box2d.vec2dTo(force), box2d.vec2dTo(pos));
534 }
535
536 /** Apply acceleration to this object (changes velocity by acceleration,
537 * mass-independent — matches EngineObject.applyAcceleration semantics).

Callers 3

explosionFunction · 0.45
explosionFunction · 0.45
collideWithObjectMethod · 0.45

Calls 3

getCenterOfMassMethod · 0.95
setAwakeMethod · 0.95
vec2dToMethod · 0.80

Tested by

no test coverage detected