Defold Learn logo


Box2D b2Joint documentation

Functions for interacting with native Box2D joints.

Version: alpha

FUNCTIONS
b2d.joint.create_distance() Create a distance joint.
b2d.joint.create_distance() Create a distance joint.
b2d.joint.create_filter() Create a filter joint.
b2d.joint.create_friction() Create a friction joint.
b2d.joint.create_gear() Create a gear joint.
b2d.joint.create_motor() Create a motor joint.
b2d.joint.create_mouse() Create a mouse joint.
b2d.joint.create_mouse() Create a mouse joint.
b2d.joint.create_prismatic() Create a prismatic joint.
b2d.joint.create_prismatic() Create a prismatic joint.
b2d.joint.create_pulley() Create a pulley joint.
b2d.joint.create_revolute() Create a revolute joint.
b2d.joint.create_revolute() Create a revolute joint.
b2d.joint.create_rope() Create a rope joint.
b2d.joint.create_weld() Create a weld joint.
b2d.joint.create_weld() Create a weld joint.
b2d.joint.create_wheel() Create a wheel joint.
b2d.joint.create_wheel() Create a wheel joint.
b2d.joint.destroy() Destroy a joint created by b2d.joint.
b2d.joint.destroy() Destroy a joint created by b2d.joint.
b2d.joint.enable_limit() Enable or disable joint limits.
b2d.joint.enable_limit() Enable or disable joint limits.
b2d.joint.enable_motor() Enable or disable the joint motor.
b2d.joint.enable_motor() Enable or disable the joint motor.
b2d.joint.enable_spring() Enable or disable joint spring behavior.
b2d.joint.get_anchor_a() Get the world anchor on body A.
b2d.joint.get_anchor_a() Get the world anchor on body A.
b2d.joint.get_anchor_b() Get the world anchor on body B.
b2d.joint.get_anchor_b() Get the world anchor on body B.
b2d.joint.get_angular_damping_ratio() Get weld joint angular damping ratio.
b2d.joint.get_angular_hertz() Get weld joint angular frequency.
b2d.joint.get_angular_offset() Get motor joint angular offset.
b2d.joint.get_body_a() Get the first body connected to a joint.
b2d.joint.get_body_a() Get the first body connected to a joint.
b2d.joint.get_body_b() Get the second body connected to a joint.
b2d.joint.get_body_b() Get the second body connected to a joint.
b2d.joint.get_collide_connected() Get whether connected bodies can collide.
b2d.joint.get_collide_connected() Get whether connected bodies can collide.
b2d.joint.get_correction_factor() Get motor joint correction factor.
b2d.joint.get_current_length() Get the current distance joint length.
b2d.joint.get_damping_ratio() Get spring damping ratio.
b2d.joint.get_damping_ratio() Alias for b2d.joint.get_spring_damping_ratio.
b2d.joint.get_frequency() Get spring frequency.
b2d.joint.get_frequency() Alias for b2d.joint.get_spring_hertz.
b2d.joint.get_ground_anchor_a() Get pulley ground anchor A.
b2d.joint.get_ground_anchor_b() Get pulley ground anchor B.
b2d.joint.get_hertz() Alias for b2d.joint.get_frequency.
b2d.joint.get_hertz() Alias for b2d.joint.get_spring_hertz.
b2d.joint.get_joint1() Get the first joint connected to a gear joint.
b2d.joint.get_joint2() Get the second joint connected to a gear joint.
b2d.joint.get_joint_angle() Get revolute joint angle.
b2d.joint.get_joint_angle() Get revolute joint angle.
b2d.joint.get_joint_speed() Get joint speed.
b2d.joint.get_joint_speed() Get joint speed.
b2d.joint.get_joint_translation() Get joint translation.
b2d.joint.get_joint_translation() Get joint translation.
b2d.joint.get_length() Get the distance joint length.
b2d.joint.get_length() Get the distance joint length.
b2d.joint.get_length_a() Get pulley segment length A.
b2d.joint.get_length_b() Get pulley segment length B.
b2d.joint.get_limit_state() Get rope limit state.
b2d.joint.get_linear_damping_ratio() Get weld joint linear damping ratio.
b2d.joint.get_linear_hertz() Get weld joint linear frequency.
b2d.joint.get_linear_offset() Get motor joint linear offset.
b2d.joint.get_local_anchor_a() Get the local anchor on body A.
b2d.joint.get_local_anchor_a() Get the local anchor on body A.
b2d.joint.get_local_anchor_b() Get the local anchor on body B.
b2d.joint.get_local_anchor_b() Get the local anchor on body B.
b2d.joint.get_local_axis_a() Get the local axis on body A.
b2d.joint.get_lower_limit() Get the lower joint limit.
b2d.joint.get_lower_limit() Get the lower joint limit.
b2d.joint.get_max_force() Get maximum force.
b2d.joint.get_max_force() Get maximum force.
b2d.joint.get_max_length() Get rope maximum length.
b2d.joint.get_max_length() Get the distance joint maximum length.
b2d.joint.get_max_motor_force() Get maximum motor force.
b2d.joint.get_max_motor_force() Get maximum motor force.
b2d.joint.get_max_motor_torque() Get maximum motor torque.
b2d.joint.get_max_motor_torque() Get maximum motor torque.
b2d.joint.get_max_torque() Get maximum torque.
b2d.joint.get_max_torque() Get maximum torque.
b2d.joint.get_min_length() Get the distance joint minimum length.
b2d.joint.get_motor_force() Get current motor force.
b2d.joint.get_motor_force() Get current motor force.
b2d.joint.get_motor_speed() Get motor speed.
b2d.joint.get_motor_speed() Get motor speed.
b2d.joint.get_motor_torque() Get current motor torque.
b2d.joint.get_motor_torque() Get current motor torque.
b2d.joint.get_mouse_target() Get the target for a mouse joint.
b2d.joint.get_mouse_target() Get the target for a mouse joint.
b2d.joint.get_ratio() Get joint ratio.
b2d.joint.get_reaction_force() Get reaction force.
b2d.joint.get_reaction_force() Get reaction force.
b2d.joint.get_reaction_torque() Get reaction torque.
b2d.joint.get_reaction_torque() Get reaction torque.
b2d.joint.get_reference_angle() Get the reference angle.
b2d.joint.get_reference_angle() Get weld joint reference angle.
b2d.joint.get_spring_damping_ratio() Alias for b2d.joint.get_damping_ratio.
b2d.joint.get_spring_damping_ratio() Get spring damping ratio.
b2d.joint.get_spring_hertz() Get spring frequency.
b2d.joint.get_type() Get the joint type.
b2d.joint.get_type() Get the joint type.
b2d.joint.get_upper_limit() Get the upper joint limit.
b2d.joint.get_upper_limit() Get the upper joint limit.
b2d.joint.is_active() Get whether the joint is active.
b2d.joint.is_limit_enabled() Get whether joint limits are enabled.
b2d.joint.is_limit_enabled() Get whether joint limits are enabled.
b2d.joint.is_motor_enabled() Get whether the joint motor is enabled.
b2d.joint.is_motor_enabled() Get whether the joint motor is enabled.
b2d.joint.is_spring_enabled() Get whether joint spring behavior is enabled.
b2d.joint.set_angular_damping_ratio() Set weld joint angular damping ratio.
b2d.joint.set_angular_hertz() Set weld joint angular frequency.
b2d.joint.set_angular_offset() Set motor joint angular offset.
b2d.joint.set_collide_connected() Set whether connected bodies can collide.
b2d.joint.set_correction_factor() Set motor joint correction factor.
b2d.joint.set_damping_ratio() Set spring damping ratio.
b2d.joint.set_damping_ratio() Alias for b2d.joint.set_spring_damping_ratio.
b2d.joint.set_frequency() Set spring frequency.
b2d.joint.set_frequency() Alias for b2d.joint.set_spring_hertz.
b2d.joint.set_hertz() Alias for b2d.joint.set_frequency.
b2d.joint.set_hertz() Alias for b2d.joint.set_spring_hertz.
b2d.joint.set_length() Set the distance joint length.
b2d.joint.set_length() Set the distance joint length.
b2d.joint.set_length_range() Set the distance joint length range.
b2d.joint.set_limits() Set joint limits.
b2d.joint.set_limits() Set joint limits.
b2d.joint.set_linear_damping_ratio() Set weld joint linear damping ratio.
b2d.joint.set_linear_hertz() Set weld joint linear frequency.
b2d.joint.set_linear_offset() Set motor joint linear offset.
b2d.joint.set_max_force() Set maximum force.
b2d.joint.set_max_force() Set maximum force.
b2d.joint.set_max_length() Set rope maximum length.
b2d.joint.set_max_length() Set the distance joint maximum length.
b2d.joint.set_max_motor_force() Set maximum motor force.
b2d.joint.set_max_motor_force() Set maximum motor force.
b2d.joint.set_max_motor_torque() Set maximum motor torque.
b2d.joint.set_max_motor_torque() Set maximum motor torque.
b2d.joint.set_max_torque() Set maximum torque.
b2d.joint.set_max_torque() Set maximum torque.
b2d.joint.set_min_length() Set the distance joint minimum length.
b2d.joint.set_motor_speed() Set motor speed.
b2d.joint.set_motor_speed() Set motor speed.
b2d.joint.set_mouse_target() Set the target for a mouse joint.
b2d.joint.set_mouse_target() Set the target for a mouse joint.
b2d.joint.set_ratio() Set gear joint ratio.
b2d.joint.set_reference_angle() Set weld joint reference angle.
b2d.joint.set_spring_damping_ratio() Alias for b2d.joint.set_damping_ratio.
b2d.joint.set_spring_damping_ratio() Set spring damping ratio.
b2d.joint.set_spring_hertz() Set spring frequency.
b2d.joint.wake_bodies() Wake the bodies connected to a joint.
CONSTANTS
b2d.joint.JOINT_TYPE_DISTANCE Distance joint type.
b2d.joint.JOINT_TYPE_DISTANCE Distance joint type.
b2d.joint.JOINT_TYPE_FILTER Filter joint type.
b2d.joint.JOINT_TYPE_FRICTION Friction joint type.
b2d.joint.JOINT_TYPE_GEAR Gear joint type.
b2d.joint.JOINT_TYPE_MOTOR Motor joint type.
b2d.joint.JOINT_TYPE_MOUSE Mouse joint type.
b2d.joint.JOINT_TYPE_MOUSE Mouse joint type.
b2d.joint.JOINT_TYPE_PRISMATIC Prismatic joint type.
b2d.joint.JOINT_TYPE_PRISMATIC Prismatic joint type.
b2d.joint.JOINT_TYPE_PULLEY Pulley joint type.
b2d.joint.JOINT_TYPE_REVOLUTE Revolute joint type.
b2d.joint.JOINT_TYPE_REVOLUTE Revolute joint type.
b2d.joint.JOINT_TYPE_ROPE Rope joint type.
b2d.joint.JOINT_TYPE_UNKNOWN Unknown joint type.
b2d.joint.JOINT_TYPE_WELD Weld joint type.
b2d.joint.JOINT_TYPE_WELD Weld joint type.
b2d.joint.JOINT_TYPE_WHEEL Wheel joint type.
b2d.joint.JOINT_TYPE_WHEEL Wheel joint type.
b2d.joint.LIMIT_STATE_AT_LOWER At lower limit state.
b2d.joint.LIMIT_STATE_AT_UPPER At upper limit state.
b2d.joint.LIMIT_STATE_EQUAL Equal limits state.
b2d.joint.LIMIT_STATE_INACTIVE Inactive limit state.

Functions

b2d.joint.create_distance()

b2d.joint.create_distance(body_a,body_b,definition)

Create a distance joint.

PARAMETERS

body_a b2Body
first body
body_b b2Body
second body
definition table
optional definition with local_anchor_a, local_anchor_b, length, frequency, damping_ratio, and collide_connected

RETURNS

joint b2Joint
created joint

b2d.joint.create_distance()

b2d.joint.create_distance(body_a,body_b,definition)

Create a distance joint.

PARAMETERS

body_a b2Body
first body
body_b b2Body
second body
definition table
optional definition with local_anchor_a, local_anchor_b, length, min_length, max_length, enable_spring, hertz or frequency, damping_ratio, enable_limit, enable_motor, max_motor_force, motor_speed, and collide_connected

RETURNS

joint b2Joint
created joint

b2d.joint.create_filter()

b2d.joint.create_filter(body_a,body_b,definition)

Create a filter joint.

PARAMETERS

body_a b2Body
first body
body_b b2Body
second body
definition table
optional definition table

RETURNS

joint b2Joint
created joint

b2d.joint.create_friction()

b2d.joint.create_friction(body_a,body_b,definition)

Create a friction joint.

PARAMETERS

body_a b2Body
first body
body_b b2Body
second body
definition table
optional definition with local_anchor_a, local_anchor_b, max_force, max_torque, and collide_connected

RETURNS

joint b2Joint
created joint

b2d.joint.create_gear()

b2d.joint.create_gear(joint1,joint2,definition)

Create a gear joint.

PARAMETERS

joint1 b2Joint
first revolute or prismatic joint
joint2 b2Joint
second revolute or prismatic joint
definition table
optional definition with ratio

RETURNS

joint b2Joint
created joint

b2d.joint.create_motor()

b2d.joint.create_motor(body_a,body_b,definition)

Create a motor joint.

PARAMETERS

body_a b2Body
first body
body_b b2Body
second body
definition table
optional definition with linear_offset, angular_offset, max_force, max_torque, correction_factor, and collide_connected

RETURNS

joint b2Joint
created joint

b2d.joint.create_mouse()

b2d.joint.create_mouse(body_a,body_b,definition)

Create a mouse joint.

PARAMETERS

body_a b2Body
first body
body_b b2Body
second body
definition table
optional definition with target, max_force, frequency, damping_ratio, and collide_connected

RETURNS

joint b2Joint
created joint

b2d.joint.create_mouse()

b2d.joint.create_mouse(body_a,body_b,definition)

Create a mouse joint.

PARAMETERS

body_a b2Body
first body
body_b b2Body
second body
definition table
optional definition with target, hertz or frequency, damping_ratio, max_force, and collide_connected

RETURNS

joint b2Joint
created joint

b2d.joint.create_prismatic()

b2d.joint.create_prismatic(body_a,body_b,definition)

Create a prismatic joint.

PARAMETERS

body_a b2Body
first body
body_b b2Body
second body
definition table
optional definition with local_anchor_a, local_anchor_b, local_axis_a, reference_angle, enable_limit, lower_translation, upper_translation, enable_motor, max_motor_force, motor_speed, and collide_connected

RETURNS

joint b2Joint
created joint

b2d.joint.create_prismatic()

b2d.joint.create_prismatic(body_a,body_b,definition)

Create a prismatic joint.

PARAMETERS

body_a b2Body
first body
body_b b2Body
second body
definition table
optional definition with local_anchor_a, local_anchor_b, local_axis_a, reference_angle, enable_spring, hertz or frequency, damping_ratio, enable_limit, lower_translation, upper_translation, enable_motor, max_motor_force, motor_speed, and collide_connected

RETURNS

joint b2Joint
created joint

b2d.joint.create_pulley()

b2d.joint.create_pulley(body_a,body_b,definition)

Create a pulley joint.

PARAMETERS

body_a b2Body
first body
body_b b2Body
second body
definition table
optional definition with ground_anchor_a, ground_anchor_b, local_anchor_a, local_anchor_b, length_a, length_b, ratio, and collide_connected

RETURNS

joint b2Joint
created joint

b2d.joint.create_revolute()

b2d.joint.create_revolute(body_a,body_b,definition)

Create a revolute joint.

PARAMETERS

body_a b2Body
first body
body_b b2Body
second body
definition table
optional definition with local_anchor_a, local_anchor_b, reference_angle, enable_limit, lower_angle, upper_angle, enable_motor, max_motor_torque, motor_speed, and collide_connected

RETURNS

joint b2Joint
created joint

b2d.joint.create_revolute()

b2d.joint.create_revolute(body_a,body_b,definition)

Create a revolute joint.

PARAMETERS

body_a b2Body
first body
body_b b2Body
second body
definition table
optional definition with local_anchor_a, local_anchor_b, reference_angle, enable_spring, hertz or frequency, damping_ratio, enable_limit, lower_angle, upper_angle, enable_motor, max_motor_torque, motor_speed, and collide_connected

RETURNS

joint b2Joint
created joint

b2d.joint.create_rope()

b2d.joint.create_rope(body_a,body_b,definition)

Create a rope joint.

PARAMETERS

body_a b2Body
first body
body_b b2Body
second body
definition table
optional definition with local_anchor_a, local_anchor_b, max_length, and collide_connected

RETURNS

joint b2Joint
created joint

b2d.joint.create_weld()

b2d.joint.create_weld(body_a,body_b,definition)

Create a weld joint.

PARAMETERS

body_a b2Body
first body
body_b b2Body
second body
definition table
optional definition with local_anchor_a, local_anchor_b, reference_angle, frequency, damping_ratio, and collide_connected

RETURNS

joint b2Joint
created joint

b2d.joint.create_weld()

b2d.joint.create_weld(body_a,body_b,definition)

Create a weld joint.

PARAMETERS

body_a b2Body
first body
body_b b2Body
second body
definition table
optional definition with local_anchor_a, local_anchor_b, reference_angle, linear_hertz, angular_hertz, linear_damping_ratio, angular_damping_ratio, and collide_connected

RETURNS

joint b2Joint
created joint

b2d.joint.create_wheel()

b2d.joint.create_wheel(body_a,body_b,definition)

Create a wheel joint.

PARAMETERS

body_a b2Body
first body
body_b b2Body
second body
definition table
optional definition with local_anchor_a, local_anchor_b, local_axis_a, enable_motor, max_motor_torque, motor_speed, frequency, damping_ratio, and collide_connected

RETURNS

joint b2Joint
created joint

b2d.joint.create_wheel()

b2d.joint.create_wheel(body_a,body_b,definition)

Create a wheel joint.

PARAMETERS

body_a b2Body
first body
body_b b2Body
second body
definition table
optional definition with local_anchor_a, local_anchor_b, local_axis_a, enable_spring, hertz or frequency, damping_ratio, enable_limit, lower_translation, upper_translation, enable_motor, max_motor_torque, motor_speed, and collide_connected

RETURNS

joint b2Joint
created joint

b2d.joint.destroy()

b2d.joint.destroy(joint)

Destroy a joint created by b2d.joint.

PARAMETERS

joint b2Joint
joint

b2d.joint.destroy()

b2d.joint.destroy(joint)

Destroy a joint created by b2d.joint.

PARAMETERS

joint b2Joint
joint

b2d.joint.enable_limit()

b2d.joint.enable_limit(joint,enable)

Enable or disable joint limits.

PARAMETERS

joint b2Joint
prismatic or revolute joint
enable boolean
true to enable limits

b2d.joint.enable_limit()

b2d.joint.enable_limit(joint,enable)

Enable or disable joint limits.

PARAMETERS

joint b2Joint
distance, prismatic, revolute, or wheel joint
enable boolean
true to enable limits

b2d.joint.enable_motor()

b2d.joint.enable_motor(joint,enable)

Enable or disable the joint motor.

PARAMETERS

joint b2Joint
prismatic, revolute, or wheel joint
enable boolean
true to enable the motor

b2d.joint.enable_motor()

b2d.joint.enable_motor(joint,enable)

Enable or disable the joint motor.

PARAMETERS

joint b2Joint
distance, prismatic, revolute, or wheel joint
enable boolean
true to enable the motor

b2d.joint.enable_spring()

b2d.joint.enable_spring(joint,enable)

Enable or disable joint spring behavior.

PARAMETERS

joint b2Joint
distance, prismatic, revolute, or wheel joint
enable boolean
true to enable the spring

b2d.joint.get_anchor_a()

b2d.joint.get_anchor_a(joint)

Get the world anchor on body A.

PARAMETERS

joint b2Joint
joint

RETURNS

anchor vector3
world anchor

b2d.joint.get_anchor_a()

b2d.joint.get_anchor_a(joint)

Get the world anchor on body A.

PARAMETERS

joint b2Joint
joint

RETURNS

anchor vector3
world anchor

b2d.joint.get_anchor_b()

b2d.joint.get_anchor_b(joint)

Get the world anchor on body B.

PARAMETERS

joint b2Joint
joint

RETURNS

anchor vector3
world anchor

b2d.joint.get_anchor_b()

b2d.joint.get_anchor_b(joint)

Get the world anchor on body B.

PARAMETERS

joint b2Joint
joint

RETURNS

anchor vector3
world anchor

b2d.joint.get_angular_damping_ratio()

b2d.joint.get_angular_damping_ratio(joint)

Get weld joint angular damping ratio.

PARAMETERS

joint b2Joint
weld joint

RETURNS

ratio number
damping ratio

b2d.joint.get_angular_hertz()

b2d.joint.get_angular_hertz(joint)

Get weld joint angular frequency.

PARAMETERS

joint b2Joint
weld joint

RETURNS

hertz number
frequency in hertz

b2d.joint.get_angular_offset()

b2d.joint.get_angular_offset(joint)

Get motor joint angular offset.

PARAMETERS

joint b2Joint
motor joint

RETURNS

offset number
angular offset in radians

b2d.joint.get_body_a()

b2d.joint.get_body_a(joint)

Get the first body connected to a joint.

PARAMETERS

joint b2Joint
joint

RETURNS

body b2Body
body A

b2d.joint.get_body_a()

b2d.joint.get_body_a(joint)

Get the first body connected to a joint.

PARAMETERS

joint b2Joint
joint

RETURNS

body b2Body
body A

b2d.joint.get_body_b()

b2d.joint.get_body_b(joint)

Get the second body connected to a joint.

PARAMETERS

joint b2Joint
joint

RETURNS

body b2Body
body B

b2d.joint.get_body_b()

b2d.joint.get_body_b(joint)

Get the second body connected to a joint.

PARAMETERS

joint b2Joint
joint

RETURNS

body b2Body
body B

b2d.joint.get_collide_connected()

b2d.joint.get_collide_connected(joint)

Get whether connected bodies can collide.

PARAMETERS

joint b2Joint
joint

RETURNS

collide boolean
true if connected bodies can collide

b2d.joint.get_collide_connected()

b2d.joint.get_collide_connected(joint)

Get whether connected bodies can collide.

PARAMETERS

joint b2Joint
joint

RETURNS

collide boolean
true if connected bodies can collide

b2d.joint.get_correction_factor()

b2d.joint.get_correction_factor(joint)

Get motor joint correction factor.

PARAMETERS

joint b2Joint
motor joint

RETURNS

factor number
correction factor

b2d.joint.get_current_length()

b2d.joint.get_current_length(joint)

Get the current distance joint length.

PARAMETERS

joint b2Joint
distance joint

RETURNS

length number
current length in project units

b2d.joint.get_damping_ratio()

b2d.joint.get_damping_ratio(joint)

Get spring damping ratio.

PARAMETERS

joint b2Joint
distance, mouse, weld, or wheel joint

RETURNS

ratio number
damping ratio

b2d.joint.get_damping_ratio()

b2d.joint.get_damping_ratio(joint)

Alias for b2d.joint.get_spring_damping_ratio.

PARAMETERS

joint b2Joint
distance, mouse, prismatic, revolute, or wheel joint

RETURNS

ratio number
damping ratio

b2d.joint.get_frequency()

b2d.joint.get_frequency(joint)

Get spring frequency.

PARAMETERS

joint b2Joint
distance, mouse, weld, or wheel joint

RETURNS

frequency number
frequency in hertz

b2d.joint.get_frequency()

b2d.joint.get_frequency(joint)

Alias for b2d.joint.get_spring_hertz.

PARAMETERS

joint b2Joint
distance, mouse, prismatic, revolute, or wheel joint

RETURNS

frequency number
frequency in hertz

b2d.joint.get_ground_anchor_a()

b2d.joint.get_ground_anchor_a(joint)

Get pulley ground anchor A.

PARAMETERS

joint b2Joint
pulley joint

RETURNS

anchor vector3
world anchor

b2d.joint.get_ground_anchor_b()

b2d.joint.get_ground_anchor_b(joint)

Get pulley ground anchor B.

PARAMETERS

joint b2Joint
pulley joint

RETURNS

anchor vector3
world anchor

b2d.joint.get_hertz()

b2d.joint.get_hertz(joint)

Alias for b2d.joint.get_frequency.

PARAMETERS

joint b2Joint
distance, mouse, weld, or wheel joint

RETURNS

hertz number
frequency in hertz

b2d.joint.get_hertz()

b2d.joint.get_hertz(joint)

Alias for b2d.joint.get_spring_hertz.

PARAMETERS

joint b2Joint
distance, mouse, prismatic, revolute, or wheel joint

RETURNS

hertz number
frequency in hertz

b2d.joint.get_joint1()

b2d.joint.get_joint1(joint)

Get the first joint connected to a gear joint.

PARAMETERS

joint b2Joint
gear joint

RETURNS

joint1 b2Joint
first connected joint

b2d.joint.get_joint2()

b2d.joint.get_joint2(joint)

Get the second joint connected to a gear joint.

PARAMETERS

joint b2Joint
gear joint

RETURNS

joint2 b2Joint
second connected joint

b2d.joint.get_joint_angle()

b2d.joint.get_joint_angle(joint)

Get revolute joint angle.

PARAMETERS

joint b2Joint
revolute joint

RETURNS

angle number
angle in radians

b2d.joint.get_joint_angle()

b2d.joint.get_joint_angle(joint)

Get revolute joint angle.

PARAMETERS

joint b2Joint
revolute joint

RETURNS

angle number
angle in radians

b2d.joint.get_joint_speed()

b2d.joint.get_joint_speed(joint)

Get joint speed.

PARAMETERS

joint b2Joint
prismatic, revolute, or wheel joint

RETURNS

speed number
joint speed

b2d.joint.get_joint_speed()

b2d.joint.get_joint_speed(joint)

Get joint speed.

PARAMETERS

joint b2Joint
prismatic joint

RETURNS

speed number
joint speed

b2d.joint.get_joint_translation()

b2d.joint.get_joint_translation(joint)

Get joint translation.

PARAMETERS

joint b2Joint
prismatic or wheel joint

RETURNS

translation number
translation in project units

b2d.joint.get_joint_translation()

b2d.joint.get_joint_translation(joint)

Get joint translation.

PARAMETERS

joint b2Joint
prismatic joint

RETURNS

translation number
translation in project units

b2d.joint.get_length()

b2d.joint.get_length(joint)

Get the distance joint length.

PARAMETERS

joint b2Joint
distance joint

RETURNS

length number
length in project units

b2d.joint.get_length()

b2d.joint.get_length(joint)

Get the distance joint length.

PARAMETERS

joint b2Joint
distance joint

RETURNS

length number
length in project units

b2d.joint.get_length_a()

b2d.joint.get_length_a(joint)

Get pulley segment length A.

PARAMETERS

joint b2Joint
pulley joint

RETURNS

length number
length in project units

b2d.joint.get_length_b()

b2d.joint.get_length_b(joint)

Get pulley segment length B.

PARAMETERS

joint b2Joint
pulley joint

RETURNS

length number
length in project units

b2d.joint.get_limit_state()

b2d.joint.get_limit_state(joint)

Get rope limit state.

PARAMETERS

joint b2Joint
rope joint

RETURNS

state number
one of the LIMIT_STATE_* constants

b2d.joint.get_linear_damping_ratio()

b2d.joint.get_linear_damping_ratio(joint)

Get weld joint linear damping ratio.

PARAMETERS

joint b2Joint
weld joint

RETURNS

ratio number
damping ratio

b2d.joint.get_linear_hertz()

b2d.joint.get_linear_hertz(joint)

Get weld joint linear frequency.

PARAMETERS

joint b2Joint
weld joint

RETURNS

hertz number
frequency in hertz

b2d.joint.get_linear_offset()

b2d.joint.get_linear_offset(joint)

Get motor joint linear offset.

PARAMETERS

joint b2Joint
motor joint

RETURNS

offset vector3
linear offset in project units

b2d.joint.get_local_anchor_a()

b2d.joint.get_local_anchor_a(joint)

Get the local anchor on body A.

PARAMETERS

joint b2Joint
joint

RETURNS

anchor vector3
local anchor

b2d.joint.get_local_anchor_a()

b2d.joint.get_local_anchor_a(joint)

Get the local anchor on body A.

PARAMETERS

joint b2Joint
joint

RETURNS

anchor vector3
local anchor

b2d.joint.get_local_anchor_b()

b2d.joint.get_local_anchor_b(joint)

Get the local anchor on body B.

PARAMETERS

joint b2Joint
joint

RETURNS

anchor vector3
local anchor

b2d.joint.get_local_anchor_b()

b2d.joint.get_local_anchor_b(joint)

Get the local anchor on body B.

PARAMETERS

joint b2Joint
joint

RETURNS

anchor vector3
local anchor

b2d.joint.get_local_axis_a()

b2d.joint.get_local_axis_a(joint)

Get the local axis on body A.

PARAMETERS

joint b2Joint
prismatic or wheel joint

RETURNS

axis vector3
local axis

b2d.joint.get_lower_limit()

b2d.joint.get_lower_limit(joint)

Get the lower joint limit.

PARAMETERS

joint b2Joint
prismatic or revolute joint

RETURNS

lower number
lower limit

b2d.joint.get_lower_limit()

b2d.joint.get_lower_limit(joint)

Get the lower joint limit.

PARAMETERS

joint b2Joint
prismatic, revolute, or wheel joint

RETURNS

lower number
lower limit

b2d.joint.get_max_force()

b2d.joint.get_max_force(joint)

Get maximum force.

PARAMETERS

joint b2Joint
mouse or friction joint

RETURNS

force number
maximum force

b2d.joint.get_max_force()

b2d.joint.get_max_force(joint)

Get maximum force.

PARAMETERS

joint b2Joint
mouse or motor joint

RETURNS

force number
maximum force

b2d.joint.get_max_length()

b2d.joint.get_max_length(joint)

Get rope maximum length.

PARAMETERS

joint b2Joint
rope joint

RETURNS

length number
maximum length in project units

b2d.joint.get_max_length()

b2d.joint.get_max_length(joint)

Get the distance joint maximum length.

PARAMETERS

joint b2Joint
distance joint

RETURNS

length number
maximum length in project units

b2d.joint.get_max_motor_force()

b2d.joint.get_max_motor_force(joint)

Get maximum motor force.

PARAMETERS

joint b2Joint
prismatic joint

RETURNS

force number
maximum motor force

b2d.joint.get_max_motor_force()

b2d.joint.get_max_motor_force(joint)

Get maximum motor force.

PARAMETERS

joint b2Joint
distance or prismatic joint

RETURNS

force number
maximum motor force

b2d.joint.get_max_motor_torque()

b2d.joint.get_max_motor_torque(joint)

Get maximum motor torque.

PARAMETERS

joint b2Joint
revolute or wheel joint

RETURNS

torque number
maximum motor torque

b2d.joint.get_max_motor_torque()

b2d.joint.get_max_motor_torque(joint)

Get maximum motor torque.

PARAMETERS

joint b2Joint
revolute or wheel joint

RETURNS

torque number
maximum motor torque

b2d.joint.get_max_torque()

b2d.joint.get_max_torque(joint)

Get maximum torque.

PARAMETERS

joint b2Joint
friction joint

RETURNS

torque number
maximum torque

b2d.joint.get_max_torque()

b2d.joint.get_max_torque(joint)

Get maximum torque.

PARAMETERS

joint b2Joint
motor joint

RETURNS

torque number
maximum torque

b2d.joint.get_min_length()

b2d.joint.get_min_length(joint)

Get the distance joint minimum length.

PARAMETERS

joint b2Joint
distance joint

RETURNS

length number
minimum length in project units

b2d.joint.get_motor_force()

b2d.joint.get_motor_force(joint,inv_dt)

Get current motor force.

PARAMETERS

joint b2Joint
prismatic joint
inv_dt number
inverse time step

RETURNS

force number
motor force

b2d.joint.get_motor_force()

b2d.joint.get_motor_force(joint)

Get current motor force.

PARAMETERS

joint b2Joint
distance or prismatic joint

RETURNS

force number
motor force

b2d.joint.get_motor_speed()

b2d.joint.get_motor_speed(joint)

Get motor speed.

PARAMETERS

joint b2Joint
prismatic, revolute, or wheel joint

RETURNS

speed number
motor speed

b2d.joint.get_motor_speed()

b2d.joint.get_motor_speed(joint)

Get motor speed.

PARAMETERS

joint b2Joint
distance, prismatic, revolute, or wheel joint

RETURNS

speed number
motor speed

b2d.joint.get_motor_torque()

b2d.joint.get_motor_torque(joint,inv_dt)

Get current motor torque.

PARAMETERS

joint b2Joint
revolute or wheel joint
inv_dt number
inverse time step

RETURNS

torque number
motor torque

b2d.joint.get_motor_torque()

b2d.joint.get_motor_torque(joint)

Get current motor torque.

PARAMETERS

joint b2Joint
revolute or wheel joint

RETURNS

torque number
motor torque

b2d.joint.get_mouse_target()

b2d.joint.get_mouse_target(joint)

Get the target for a mouse joint.

PARAMETERS

joint b2Joint
mouse joint

RETURNS

target vector3
world target

b2d.joint.get_mouse_target()

b2d.joint.get_mouse_target(joint)

Get the target for a mouse joint.

PARAMETERS

joint b2Joint
mouse joint

RETURNS

target vector3
world target

b2d.joint.get_ratio()

b2d.joint.get_ratio(joint)

Get joint ratio.

PARAMETERS

joint b2Joint
pulley or gear joint

RETURNS

ratio number
joint ratio

b2d.joint.get_reaction_force()

b2d.joint.get_reaction_force(joint,inv_dt)

Get reaction force.

PARAMETERS

joint b2Joint
joint
inv_dt number
inverse time step

RETURNS

force vector3
reaction force

b2d.joint.get_reaction_force()

b2d.joint.get_reaction_force(joint)

Get reaction force.

PARAMETERS

joint b2Joint
joint

RETURNS

force vector3
reaction force

b2d.joint.get_reaction_torque()

b2d.joint.get_reaction_torque(joint,inv_dt)

Get reaction torque.

PARAMETERS

joint b2Joint
joint
inv_dt number
inverse time step

RETURNS

torque number
reaction torque

b2d.joint.get_reaction_torque()

b2d.joint.get_reaction_torque(joint)

Get reaction torque.

PARAMETERS

joint b2Joint
joint

RETURNS

torque number
reaction torque

b2d.joint.get_reference_angle()

b2d.joint.get_reference_angle(joint)

Get the reference angle.

PARAMETERS

joint b2Joint
prismatic, revolute, or weld joint

RETURNS

angle number
reference angle in radians

b2d.joint.get_reference_angle()

b2d.joint.get_reference_angle(joint)

Get weld joint reference angle.

PARAMETERS

joint b2Joint
weld joint

RETURNS

angle number
reference angle in radians

b2d.joint.get_spring_damping_ratio()

b2d.joint.get_spring_damping_ratio(joint)

Alias for b2d.joint.get_damping_ratio.

PARAMETERS

joint b2Joint
distance, mouse, weld, or wheel joint

RETURNS

ratio number
damping ratio

b2d.joint.get_spring_damping_ratio()

b2d.joint.get_spring_damping_ratio(joint)

Get spring damping ratio.

PARAMETERS

joint b2Joint
distance, mouse, prismatic, revolute, or wheel joint

RETURNS

ratio number
damping ratio

b2d.joint.get_spring_hertz()

b2d.joint.get_spring_hertz(joint)

Get spring frequency.

PARAMETERS

joint b2Joint
distance, mouse, prismatic, revolute, or wheel joint

RETURNS

hertz number
frequency in hertz

b2d.joint.get_type()

b2d.joint.get_type(joint)

Get the joint type.

PARAMETERS

joint b2Joint
joint

RETURNS

type number
one of the JOINT_TYPE_* constants

b2d.joint.get_type()

b2d.joint.get_type(joint)

Get the joint type.

PARAMETERS

joint b2Joint
joint

RETURNS

type number
one of the JOINT_TYPE_* constants

b2d.joint.get_upper_limit()

b2d.joint.get_upper_limit(joint)

Get the upper joint limit.

PARAMETERS

joint b2Joint
prismatic or revolute joint

RETURNS

upper number
upper limit

b2d.joint.get_upper_limit()

b2d.joint.get_upper_limit(joint)

Get the upper joint limit.

PARAMETERS

joint b2Joint
prismatic, revolute, or wheel joint

RETURNS

upper number
upper limit

b2d.joint.is_active()

b2d.joint.is_active(joint)

Get whether the joint is active.

PARAMETERS

joint b2Joint
joint

RETURNS

active boolean
true if the joint is active

b2d.joint.is_limit_enabled()

b2d.joint.is_limit_enabled(joint)

Get whether joint limits are enabled.

PARAMETERS

joint b2Joint
prismatic or revolute joint

RETURNS

enabled boolean
true if limits are enabled

b2d.joint.is_limit_enabled()

b2d.joint.is_limit_enabled(joint)

Get whether joint limits are enabled.

PARAMETERS

joint b2Joint
distance, prismatic, revolute, or wheel joint

RETURNS

enabled boolean
true if limits are enabled

b2d.joint.is_motor_enabled()

b2d.joint.is_motor_enabled(joint)

Get whether the joint motor is enabled.

PARAMETERS

joint b2Joint
prismatic, revolute, or wheel joint

RETURNS

enabled boolean
true if the motor is enabled

b2d.joint.is_motor_enabled()

b2d.joint.is_motor_enabled(joint)

Get whether the joint motor is enabled.

PARAMETERS

joint b2Joint
distance, prismatic, revolute, or wheel joint

RETURNS

enabled boolean
true if the motor is enabled

b2d.joint.is_spring_enabled()

b2d.joint.is_spring_enabled(joint)

Get whether joint spring behavior is enabled.

PARAMETERS

joint b2Joint
distance, prismatic, revolute, or wheel joint

RETURNS

enabled boolean
true if the spring is enabled

b2d.joint.set_angular_damping_ratio()

b2d.joint.set_angular_damping_ratio(joint,ratio)

Set weld joint angular damping ratio.

PARAMETERS

joint b2Joint
weld joint
ratio number
damping ratio

b2d.joint.set_angular_hertz()

b2d.joint.set_angular_hertz(joint,hertz)

Set weld joint angular frequency.

PARAMETERS

joint b2Joint
weld joint
hertz number
frequency in hertz

b2d.joint.set_angular_offset()

b2d.joint.set_angular_offset(joint,offset)

Set motor joint angular offset.

PARAMETERS

joint b2Joint
motor joint
offset number
angular offset in radians

b2d.joint.set_collide_connected()

b2d.joint.set_collide_connected(joint,collide)

Set whether connected bodies can collide.

PARAMETERS

joint b2Joint
joint
collide boolean
true if connected bodies can collide

b2d.joint.set_correction_factor()

b2d.joint.set_correction_factor(joint,factor)

Set motor joint correction factor.

PARAMETERS

joint b2Joint
motor joint
factor number
correction factor

b2d.joint.set_damping_ratio()

b2d.joint.set_damping_ratio(joint,ratio)

Set spring damping ratio.

PARAMETERS

joint b2Joint
distance, mouse, weld, or wheel joint
ratio number
damping ratio

b2d.joint.set_damping_ratio()

b2d.joint.set_damping_ratio(joint,ratio)

Alias for b2d.joint.set_spring_damping_ratio.

PARAMETERS

joint b2Joint
distance, mouse, prismatic, revolute, or wheel joint
ratio number
damping ratio

b2d.joint.set_frequency()

b2d.joint.set_frequency(joint,frequency)

Set spring frequency.

PARAMETERS

joint b2Joint
distance, mouse, weld, or wheel joint
frequency number
frequency in hertz

b2d.joint.set_frequency()

b2d.joint.set_frequency(joint,frequency)

Alias for b2d.joint.set_spring_hertz.

PARAMETERS

joint b2Joint
distance, mouse, prismatic, revolute, or wheel joint
frequency number
frequency in hertz

b2d.joint.set_hertz()

b2d.joint.set_hertz(joint,hertz)

Alias for b2d.joint.set_frequency.

PARAMETERS

joint b2Joint
distance, mouse, weld, or wheel joint
hertz number
frequency in hertz

b2d.joint.set_hertz()

b2d.joint.set_hertz(joint,hertz)

Alias for b2d.joint.set_spring_hertz.

PARAMETERS

joint b2Joint
distance, mouse, prismatic, revolute, or wheel joint
hertz number
frequency in hertz

b2d.joint.set_length()

b2d.joint.set_length(joint,length)

Set the distance joint length.

PARAMETERS

joint b2Joint
distance joint
length number
length in project units

b2d.joint.set_length()

b2d.joint.set_length(joint,length)

Set the distance joint length.

PARAMETERS

joint b2Joint
distance joint
length number
length in project units

b2d.joint.set_length_range()

b2d.joint.set_length_range(joint,min_length,max_length)

Set the distance joint length range.

PARAMETERS

joint b2Joint
distance joint
min_length number
minimum length in project units
max_length number
maximum length in project units

b2d.joint.set_limits()

b2d.joint.set_limits(joint,lower,upper)

Set joint limits.

PARAMETERS

joint b2Joint
prismatic or revolute joint
lower number
lower limit
upper number
upper limit

b2d.joint.set_limits()

b2d.joint.set_limits(joint,lower,upper)

Set joint limits.

PARAMETERS

joint b2Joint
prismatic, revolute, or wheel joint
lower number
lower limit
upper number
upper limit

b2d.joint.set_linear_damping_ratio()

b2d.joint.set_linear_damping_ratio(joint,ratio)

Set weld joint linear damping ratio.

PARAMETERS

joint b2Joint
weld joint
ratio number
damping ratio

b2d.joint.set_linear_hertz()

b2d.joint.set_linear_hertz(joint,hertz)

Set weld joint linear frequency.

PARAMETERS

joint b2Joint
weld joint
hertz number
frequency in hertz

b2d.joint.set_linear_offset()

b2d.joint.set_linear_offset(joint,offset)

Set motor joint linear offset.

PARAMETERS

joint b2Joint
motor joint
offset vector3
linear offset in project units

b2d.joint.set_max_force()

b2d.joint.set_max_force(joint,force)

Set maximum force.

PARAMETERS

joint b2Joint
mouse or friction joint
force number
maximum force

b2d.joint.set_max_force()

b2d.joint.set_max_force(joint,force)

Set maximum force.

PARAMETERS

joint b2Joint
mouse or motor joint
force number
maximum force

b2d.joint.set_max_length()

b2d.joint.set_max_length(joint,length)

Set rope maximum length.

PARAMETERS

joint b2Joint
rope joint
length number
maximum length in project units

b2d.joint.set_max_length()

b2d.joint.set_max_length(joint,length)

Set the distance joint maximum length.

PARAMETERS

joint b2Joint
distance joint
length number
maximum length in project units

b2d.joint.set_max_motor_force()

b2d.joint.set_max_motor_force(joint,force)

Set maximum motor force.

PARAMETERS

joint b2Joint
prismatic joint
force number
maximum motor force

b2d.joint.set_max_motor_force()

b2d.joint.set_max_motor_force(joint,force)

Set maximum motor force.

PARAMETERS

joint b2Joint
distance or prismatic joint
force number
maximum motor force

b2d.joint.set_max_motor_torque()

b2d.joint.set_max_motor_torque(joint,torque)

Set maximum motor torque.

PARAMETERS

joint b2Joint
revolute or wheel joint
torque number
maximum motor torque

b2d.joint.set_max_motor_torque()

b2d.joint.set_max_motor_torque(joint,torque)

Set maximum motor torque.

PARAMETERS

joint b2Joint
revolute or wheel joint
torque number
maximum motor torque

b2d.joint.set_max_torque()

b2d.joint.set_max_torque(joint,torque)

Set maximum torque.

PARAMETERS

joint b2Joint
friction joint
torque number
maximum torque

b2d.joint.set_max_torque()

b2d.joint.set_max_torque(joint,torque)

Set maximum torque.

PARAMETERS

joint b2Joint
motor joint
torque number
maximum torque

b2d.joint.set_min_length()

b2d.joint.set_min_length(joint,length)

Set the distance joint minimum length.

PARAMETERS

joint b2Joint
distance joint
length number
minimum length in project units

b2d.joint.set_motor_speed()

b2d.joint.set_motor_speed(joint,speed)

Set motor speed.

PARAMETERS

joint b2Joint
prismatic, revolute, or wheel joint
speed number
motor speed

b2d.joint.set_motor_speed()

b2d.joint.set_motor_speed(joint,speed)

Set motor speed.

PARAMETERS

joint b2Joint
distance, prismatic, revolute, or wheel joint
speed number
motor speed

b2d.joint.set_mouse_target()

b2d.joint.set_mouse_target(joint,target)

Set the target for a mouse joint.

PARAMETERS

joint b2Joint
mouse joint
target vector3
world target

b2d.joint.set_mouse_target()

b2d.joint.set_mouse_target(joint,target)

Set the target for a mouse joint.

PARAMETERS

joint b2Joint
mouse joint
target vector3
world target

b2d.joint.set_ratio()

b2d.joint.set_ratio(joint,ratio)

Set gear joint ratio.

PARAMETERS

joint b2Joint
gear joint
ratio number
gear ratio

b2d.joint.set_reference_angle()

b2d.joint.set_reference_angle(joint,angle)

Set weld joint reference angle.

PARAMETERS

joint b2Joint
weld joint
angle number
reference angle in radians

b2d.joint.set_spring_damping_ratio()

b2d.joint.set_spring_damping_ratio(joint,ratio)

Alias for b2d.joint.set_damping_ratio.

PARAMETERS

joint b2Joint
distance, mouse, weld, or wheel joint
ratio number
damping ratio

b2d.joint.set_spring_damping_ratio()

b2d.joint.set_spring_damping_ratio(joint,ratio)

Set spring damping ratio.

PARAMETERS

joint b2Joint
distance, mouse, prismatic, revolute, or wheel joint
ratio number
damping ratio

b2d.joint.set_spring_hertz()

b2d.joint.set_spring_hertz(joint,hertz)

Set spring frequency.

PARAMETERS

joint b2Joint
distance, mouse, prismatic, revolute, or wheel joint
hertz number
frequency in hertz

b2d.joint.wake_bodies()

b2d.joint.wake_bodies(joint)

Wake the bodies connected to a joint.

PARAMETERS

joint b2Joint
joint

Constants

b2d.joint.JOINT_TYPE_DISTANCE

Distance joint type.


b2d.joint.JOINT_TYPE_DISTANCE

Distance joint type.


b2d.joint.JOINT_TYPE_FILTER

Filter joint type.


b2d.joint.JOINT_TYPE_FRICTION

Friction joint type.


b2d.joint.JOINT_TYPE_GEAR

Gear joint type.


b2d.joint.JOINT_TYPE_MOTOR

Motor joint type.


b2d.joint.JOINT_TYPE_MOUSE

Mouse joint type.


b2d.joint.JOINT_TYPE_MOUSE

Mouse joint type.


b2d.joint.JOINT_TYPE_PRISMATIC

Prismatic joint type.


b2d.joint.JOINT_TYPE_PRISMATIC

Prismatic joint type.


b2d.joint.JOINT_TYPE_PULLEY

Pulley joint type.


b2d.joint.JOINT_TYPE_REVOLUTE

Revolute joint type.


b2d.joint.JOINT_TYPE_REVOLUTE

Revolute joint type.


b2d.joint.JOINT_TYPE_ROPE

Rope joint type.


b2d.joint.JOINT_TYPE_UNKNOWN

Unknown joint type.


b2d.joint.JOINT_TYPE_WELD

Weld joint type.


b2d.joint.JOINT_TYPE_WELD

Weld joint type.


b2d.joint.JOINT_TYPE_WHEEL

Wheel joint type.


b2d.joint.JOINT_TYPE_WHEEL

Wheel joint type.


b2d.joint.LIMIT_STATE_AT_LOWER

At lower limit state.


b2d.joint.LIMIT_STATE_AT_UPPER

At upper limit state.


b2d.joint.LIMIT_STATE_EQUAL

Equal limits state.


b2d.joint.LIMIT_STATE_INACTIVE

Inactive limit state.