LittleJS 1.30.1

Box2D

Box2dTargetJoint

Box2D Target Joint, also known as a mouse joint

  • Used to make a point on a object track a specific world point target
  • This a soft constraint with a max force
  • This allows the constraint to stretch and without applying huge forces
  • The object must be dynamic, and stay dynamic while the joint holds it, Box2D stops for good on one with no mass

Extends Box2dJoint

Constructor

new Box2dTargetJoint(object, fixedObject, worldPos)box2d.js:1493

Create a target joint

object Box2dObject
fixedObject Box2dObject
worldPos Vector2

Methods

Inherited from Box2dJoint

Methods

getFrequency() → numberbox2d.js:1534

Gets the joint frequency in Hertz

getMaxForce() → numberbox2d.js:1526

Gets the maximum force in Newtons

getTarget() → Vector2box2d.js:1518

Get the target point in world coordinates

setFrequency(hz)box2d.js:1530

Sets the joint frequency in Hertz, above 0, Box2D stops for good on 0

hz number
setMaxForce(force)box2d.js:1522

Sets the maximum force in Newtons

force number
setTarget(pos)box2d.js:1514

Set the target point in world coordinates

pos Vector2