A Grabber joint enables you to grab sprites and move them with a max force towards a target position.
the point at which the sprite is grabbed
the sprite to grab
The Box2D joint ID. Don't change it!
The sprite being grabbed by the joint.
The first sprite in the joint.
The second sprite in the joint.
The type of joint. Can be one of:
"glue", "distance", "wheel", "hinge", "slider", or "grabber".
Can't be changed after the joint is created.
Determines whether to draw the joint if spriteA or spriteB is drawn.
Function that draws the joint. Can be overridden by the user.
The maximum spring force that the joint can exert on the sprite.
By default it's 500 * the sprite's mass.
The maximum torque that the joint can exert on the sprite.
By default it's 0.25 * the sprite's mass * the square root of the rotational inertia divided by the sprite's mass.
How much force the joint is applying to keep the two sprites together.
How much torque the joint is applying to keep the two sprites together.
The target position of the joint that the sprite will be moved towards. Can be a coordinate array or object with x and y properties.
Deletes the joint from the world and from each of the associated sprites' joints arrays.
This function is run when the joint's reaction force exceeds the force threshold or its reaction torque exceeds the torque threshold.
By default, the sprites' speed and rotation speed are set to 0 and the joint is deleted, simulating a break.
A Joint is used to constrain the movement of two sprites relative to each other, which can lead to nuanced physics interactions.