Provided By
All Implemented Interfaces

User interface controller for RigidBodySim, provides mouse dragging of nearest moveable RigidBody, and keyboard thrust controls for one or two selected RigidBodys.

Mouse Drag

When the Clock is running, mouse dragging is accomplished by connecting a spring between the RigidBody and the mouse position. The spring has zero rest length. The spring stiffness can be set via #setDragStiffness.

When the Clock is not running, mouse dragging will move the RigidBody. Holding down the alt, meta, or control key will rotate the RigidBody when moving the mouse.


One or two RigidBodys can be specified to have keyboard activated thruster controls with #setThrusters. You can specify a myphysicslab.lab.engine2D.ThrusterSet of thrust forces for each RigidBody. The keyboard commands to fire thrusters are:

  • Right hand controls: keys J, K, L, I and arrow keys.
  • Left hand controls: keys S, D, F, E.

Some of these key commands will fire pairs of 'side ways' thrust controls. Holding shift key with those changes the pair of thrusters to give a rotation effect.

new RigidBodyEventHandler( sim, clock )


the simulation to handle events for


the clock that determines whether the simulation is running

Instance Methods

Static Properties

Type Definitions