MouseJoint class

Pulls a body toward a target point using a spring force.

Typical use: dragging bodies with a pointer. It is a Dart joint on both backends: on the native one its force goes into the native body.

Inheritance

Constructors

MouseJoint({required PhysicsBody body, required Vector2 target, double stiffness = 500.0, double damping = 0.7, double maxForce = 50000.0})

Properties

bodies → List<PhysicsBody>
The bodies the joint holds; empty where it does not say.
no setteroverride
body → PhysicsBody
final
damping ↔ double
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
maxForce ↔ double
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stiffness ↔ double
getter/setter pair
target → Vector2
World-space target position (update each frame to drag the body).
final
type → JointType
finalinherited

Methods

applyConstraint(double dt) → void
Apply the constraint for one physics step.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setTarget(double x, double y) → void
Move the target (call from the game loop when the pointer moves).
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited