LittleJS 1.28.0

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:1449

Create a target joint

object Box2dObject
fixedObject Box2dObject
worldPos Vector2

Methods

Inherited from Box2dJoint

Methods

getFrequency() → numberbox2d.js:1489

Gets the joint frequency in Hertz

getMaxForce() → numberbox2d.js:1481

Gets the maximum force in Newtons

getTarget() → Vector2box2d.js:1473

Get the target point in world coordinates

setFrequency(hz)box2d.js:1485

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

hz number
setMaxForce(force)box2d.js:1477

Sets the maximum force in Newtons

force number
setTarget(pos)box2d.js:1469

Set the target point in world coordinates

pos Vector2