b2d.joint
Functions for interacting with native Box2D joints.
Functions
b2d.joint.create_distance(body_a:Opaque<"b2Body">, body_b:Opaque<"b2Body">, definition?:b2d.joint.DistanceDefinition):Opaque<"b2Joint">Nb2d.joint.create_filter(body_a:Opaque<"b2Body">, body_b:Opaque<"b2Body">, definition?:b2d.joint.FilterDefinition):Opaque<"b2Joint">Nb2d.joint.create_friction(body_a:Opaque<"b2Body">, body_b:Opaque<"b2Body">, definition?:b2d.joint.FrictionDefinition):Opaque<"b2Joint">Nb2d.joint.create_gear(joint1:Opaque<"b2Joint">, joint2:Opaque<"b2Joint">, definition?:b2d.joint.GearDefinition):Opaque<"b2Joint">Nb2d.joint.create_motor(body_a:Opaque<"b2Body">, body_b:Opaque<"b2Body">, definition?:b2d.joint.MotorDefinition):Opaque<"b2Joint">Nb2d.joint.create_mouse(body_a:Opaque<"b2Body">, body_b:Opaque<"b2Body">, definition?:b2d.joint.MouseDefinition):Opaque<"b2Joint">Nb2d.joint.create_prismatic(body_a:Opaque<"b2Body">, body_b:Opaque<"b2Body">, definition?:b2d.joint.PrismaticDefinition):Opaque<"b2Joint">Nb2d.joint.create_pulley(body_a:Opaque<"b2Body">, body_b:Opaque<"b2Body">, definition?:b2d.joint.PulleyDefinition):Opaque<"b2Joint">Nb2d.joint.create_revolute(body_a:Opaque<"b2Body">, body_b:Opaque<"b2Body">, definition?:b2d.joint.RevoluteDefinition):Opaque<"b2Joint">Nb2d.joint.create_rope(body_a:Opaque<"b2Body">, body_b:Opaque<"b2Body">, definition?:b2d.joint.RopeDefinition):Opaque<"b2Joint">Nb2d.joint.create_weld(body_a:Opaque<"b2Body">, body_b:Opaque<"b2Body">, definition?:b2d.joint.WeldDefinition):Opaque<"b2Joint">Nb2d.joint.create_wheel(body_a:Opaque<"b2Body">, body_b:Opaque<"b2Body">, definition?:b2d.joint.WheelDefinition):Opaque<"b2Joint">Nb2d.joint.destroy(joint:Opaque<"b2Joint">): voidNb2d.joint.enable_limit(joint:Opaque<"b2Joint">, enable: boolean): voidNb2d.joint.enable_motor(joint:Opaque<"b2Joint">, enable: boolean): voidNb2d.joint.enable_spring(joint:Opaque<"b2Joint">, enable: boolean): voidNb2d.joint.get_anchor_a(joint:Opaque<"b2Joint">): Vector3Nb2d.joint.get_anchor_b(joint:Opaque<"b2Joint">): Vector3Nb2d.joint.get_angular_damping_ratio(joint:Opaque<"b2Joint">): numberNb2d.joint.get_angular_hertz(joint:Opaque<"b2Joint">): numberNb2d.joint.get_angular_offset(joint:Opaque<"b2Joint">): numberNb2d.joint.get_body_a(joint:Opaque<"b2Joint">):Opaque<"b2Body">Nb2d.joint.get_body_b(joint:Opaque<"b2Joint">):Opaque<"b2Body">Nb2d.joint.get_collide_connected(joint:Opaque<"b2Joint">): booleanNb2d.joint.get_correction_factor(joint:Opaque<"b2Joint">): numberNb2d.joint.get_current_length(joint:Opaque<"b2Joint">): numberNb2d.joint.get_damping_ratio(joint:Opaque<"b2Joint">): numberNb2d.joint.get_frequency(joint:Opaque<"b2Joint">): numberNb2d.joint.get_ground_anchor_a(joint:Opaque<"b2Joint">): Vector3Nb2d.joint.get_ground_anchor_b(joint:Opaque<"b2Joint">): Vector3Nb2d.joint.get_hertz(joint:Opaque<"b2Joint">): numberNb2d.joint.get_joint_angle(joint:Opaque<"b2Joint">): numberNb2d.joint.get_joint_speed(joint:Opaque<"b2Joint">): numberNb2d.joint.get_joint_translation(joint:Opaque<"b2Joint">): numberNb2d.joint.get_joint1(joint:Opaque<"b2Joint">):Opaque<"b2Joint">Nb2d.joint.get_joint2(joint:Opaque<"b2Joint">):Opaque<"b2Joint">Nb2d.joint.get_length(joint:Opaque<"b2Joint">): numberNb2d.joint.get_length_a(joint:Opaque<"b2Joint">): numberNb2d.joint.get_length_b(joint:Opaque<"b2Joint">): numberNb2d.joint.get_limit_state(joint:Opaque<"b2Joint">):b2d.joint.LimitStateNb2d.joint.get_linear_damping_ratio(joint:Opaque<"b2Joint">): numberNb2d.joint.get_linear_hertz(joint:Opaque<"b2Joint">): numberNb2d.joint.get_linear_offset(joint:Opaque<"b2Joint">): Vector3Nb2d.joint.get_local_anchor_a(joint:Opaque<"b2Joint">): Vector3Nb2d.joint.get_local_anchor_b(joint:Opaque<"b2Joint">): Vector3Nb2d.joint.get_local_axis_a(joint:Opaque<"b2Joint">): Vector3Nb2d.joint.get_lower_limit(joint:Opaque<"b2Joint">): numberNb2d.joint.get_max_force(joint:Opaque<"b2Joint">): numberNb2d.joint.get_max_length(joint:Opaque<"b2Joint">): numberNb2d.joint.get_max_motor_force(joint:Opaque<"b2Joint">): numberNb2d.joint.get_max_motor_torque(joint:Opaque<"b2Joint">): numberNb2d.joint.get_max_torque(joint:Opaque<"b2Joint">): numberNb2d.joint.get_min_length(joint:Opaque<"b2Joint">): numberNb2d.joint.get_motor_force(2 overloads): numberNb2d.joint.get_motor_speed(joint:Opaque<"b2Joint">): numberNb2d.joint.get_motor_torque(2 overloads): numberNb2d.joint.get_mouse_target(joint:Opaque<"b2Joint">): Vector3Nb2d.joint.get_ratio(joint:Opaque<"b2Joint">): numberNb2d.joint.get_reaction_force(2 overloads): Vector3Nb2d.joint.get_reaction_torque(2 overloads): numberNb2d.joint.get_reference_angle(joint:Opaque<"b2Joint">): numberNb2d.joint.get_spring_damping_ratio(joint:Opaque<"b2Joint">): numberNb2d.joint.get_spring_hertz(joint:Opaque<"b2Joint">): numberNb2d.joint.get_type(joint:Opaque<"b2Joint">):b2d.joint.JointTypeNb2d.joint.get_upper_limit(joint:Opaque<"b2Joint">): numberNb2d.joint.get_world(joint:Opaque<"b2Joint">):Opaque<"b2World">Nb2d.joint.is_active(joint:Opaque<"b2Joint">): booleanNb2d.joint.is_limit_enabled(joint:Opaque<"b2Joint">): booleanNb2d.joint.is_motor_enabled(joint:Opaque<"b2Joint">): booleanNb2d.joint.is_spring_enabled(joint:Opaque<"b2Joint">): booleanNb2d.joint.is_valid(joint:Opaque<"b2Joint">): booleanNb2d.joint.set_angular_damping_ratio(joint:Opaque<"b2Joint">, ratio: number): voidNb2d.joint.set_angular_hertz(joint:Opaque<"b2Joint">, hertz: number): voidNb2d.joint.set_angular_offset(joint:Opaque<"b2Joint">, offset: number): voidNb2d.joint.set_collide_connected(joint:Opaque<"b2Joint">, collide: boolean): voidNb2d.joint.set_correction_factor(joint:Opaque<"b2Joint">, factor: number): voidNb2d.joint.set_damping_ratio(joint:Opaque<"b2Joint">, ratio: number): voidNb2d.joint.set_frequency(joint:Opaque<"b2Joint">, frequency: number): voidNb2d.joint.set_hertz(joint:Opaque<"b2Joint">, hertz: number): voidNb2d.joint.set_length(joint:Opaque<"b2Joint">, length: number): voidNb2d.joint.set_length_range(joint:Opaque<"b2Joint">, min_length: number, max_length: number): voidNb2d.joint.set_limits(joint:Opaque<"b2Joint">, lower: number, upper: number): voidNb2d.joint.set_linear_damping_ratio(joint:Opaque<"b2Joint">, ratio: number): voidNb2d.joint.set_linear_hertz(joint:Opaque<"b2Joint">, hertz: number): voidNb2d.joint.set_linear_offset(joint:Opaque<"b2Joint">, offset: Vector3): voidNb2d.joint.set_max_force(joint:Opaque<"b2Joint">, force: number): voidNb2d.joint.set_max_length(joint:Opaque<"b2Joint">, length: number): voidNb2d.joint.set_max_motor_force(joint:Opaque<"b2Joint">, force: number): voidNb2d.joint.set_max_motor_torque(joint:Opaque<"b2Joint">, torque: number): voidNb2d.joint.set_max_torque(joint:Opaque<"b2Joint">, torque: number): voidNb2d.joint.set_min_length(joint:Opaque<"b2Joint">, length: number): voidNb2d.joint.set_motor_speed(joint:Opaque<"b2Joint">, speed: number): voidNb2d.joint.set_mouse_target(joint:Opaque<"b2Joint">, target: Vector3): voidNb2d.joint.set_ratio(joint:Opaque<"b2Joint">, ratio: number): voidNb2d.joint.set_reference_angle(joint:Opaque<"b2Joint">, angle: number): voidNb2d.joint.set_spring_damping_ratio(joint:Opaque<"b2Joint">, ratio: number): voidNb2d.joint.set_spring_hertz(joint:Opaque<"b2Joint">, hertz: number): voidNb2d.joint.wake_bodies(joint:Opaque<"b2Joint">): voidN
b2d.joint.create_distance(body_a: Opaque<"b2Body">, body_b: Opaque<"b2Body">, definition?: b2d.joint.DistanceDefinition): Opaque<"b2Joint">N
- Since Defold 1.13.0
Create a distance joint.
Parameters
body_a:Opaque<"b2Body">— first bodybody_b:Opaque<"b2Body">— second bodydefinition?:b2d.joint.DistanceDefinition— optional joint definition
Returns
joint:Opaque<"b2Joint">— created joint
b2d.joint.create_filter(body_a: Opaque<"b2Body">, body_b: Opaque<"b2Body">, definition?: b2d.joint.FilterDefinition): Opaque<"b2Joint">N
- Since Defold 1.13.0
Create a filter joint.
Parameters
body_a:Opaque<"b2Body">— first bodybody_b:Opaque<"b2Body">— second bodydefinition?:b2d.joint.FilterDefinition— optional definition table
Returns
joint:Opaque<"b2Joint">— created joint
b2d.joint.create_friction(body_a: Opaque<"b2Body">, body_b: Opaque<"b2Body">, definition?: b2d.joint.FrictionDefinition): Opaque<"b2Joint">N
- Since Defold 1.13.0
Create a friction joint.
Parameters
body_a:Opaque<"b2Body">— first bodybody_b:Opaque<"b2Body">— second bodydefinition?:b2d.joint.FrictionDefinition— optional joint definition
Returns
joint:Opaque<"b2Joint">— created joint
b2d.joint.create_gear(joint1: Opaque<"b2Joint">, joint2: Opaque<"b2Joint">, definition?: b2d.joint.GearDefinition): Opaque<"b2Joint">N
- Since Defold 1.13.0
Create a gear joint.
Parameters
joint1:Opaque<"b2Joint">— first revolute or prismatic jointjoint2:Opaque<"b2Joint">— second revolute or prismatic jointdefinition?:b2d.joint.GearDefinition— optional joint definition
Returns
joint:Opaque<"b2Joint">— created joint
b2d.joint.create_motor(body_a: Opaque<"b2Body">, body_b: Opaque<"b2Body">, definition?: b2d.joint.MotorDefinition): Opaque<"b2Joint">N
- Since Defold 1.13.0
Create a motor joint.
Parameters
body_a:Opaque<"b2Body">— first bodybody_b:Opaque<"b2Body">— second bodydefinition?:b2d.joint.MotorDefinition— optional joint definition
Returns
joint:Opaque<"b2Joint">— created joint
b2d.joint.create_mouse(body_a: Opaque<"b2Body">, body_b: Opaque<"b2Body">, definition?: b2d.joint.MouseDefinition): Opaque<"b2Joint">N
- Since Defold 1.13.0
Create a mouse joint.
Parameters
body_a:Opaque<"b2Body">— first bodybody_b:Opaque<"b2Body">— second bodydefinition?:b2d.joint.MouseDefinition— optional joint definition
Returns
joint:Opaque<"b2Joint">— created joint
b2d.joint.create_prismatic(body_a: Opaque<"b2Body">, body_b: Opaque<"b2Body">, definition?: b2d.joint.PrismaticDefinition): Opaque<"b2Joint">N
- Since Defold 1.13.0
Create a prismatic joint.
Parameters
body_a:Opaque<"b2Body">— first bodybody_b:Opaque<"b2Body">— second bodydefinition?:b2d.joint.PrismaticDefinition— optional joint definition
Returns
joint:Opaque<"b2Joint">— created joint
b2d.joint.create_pulley(body_a: Opaque<"b2Body">, body_b: Opaque<"b2Body">, definition?: b2d.joint.PulleyDefinition): Opaque<"b2Joint">N
- Since Defold 1.13.0
Create a pulley joint.
Parameters
body_a:Opaque<"b2Body">— first bodybody_b:Opaque<"b2Body">— second bodydefinition?:b2d.joint.PulleyDefinition— optional joint definition
Returns
joint:Opaque<"b2Joint">— created joint
b2d.joint.create_revolute(body_a: Opaque<"b2Body">, body_b: Opaque<"b2Body">, definition?: b2d.joint.RevoluteDefinition): Opaque<"b2Joint">N
- Since Defold 1.13.0
Create a revolute joint.
Parameters
body_a:Opaque<"b2Body">— first bodybody_b:Opaque<"b2Body">— second bodydefinition?:b2d.joint.RevoluteDefinition— optional joint definition
Returns
joint:Opaque<"b2Joint">— created joint
b2d.joint.create_rope(body_a: Opaque<"b2Body">, body_b: Opaque<"b2Body">, definition?: b2d.joint.RopeDefinition): Opaque<"b2Joint">N
- Since Defold 1.13.0
Create a rope joint.
Parameters
body_a:Opaque<"b2Body">— first bodybody_b:Opaque<"b2Body">— second bodydefinition?:b2d.joint.RopeDefinition— optional joint definition
Returns
joint:Opaque<"b2Joint">— created joint
b2d.joint.create_weld(body_a: Opaque<"b2Body">, body_b: Opaque<"b2Body">, definition?: b2d.joint.WeldDefinition): Opaque<"b2Joint">N
- Since Defold 1.13.0
Create a weld joint.
Parameters
body_a:Opaque<"b2Body">— first bodybody_b:Opaque<"b2Body">— second bodydefinition?:b2d.joint.WeldDefinition— optional joint definition
Returns
joint:Opaque<"b2Joint">— created joint
b2d.joint.create_wheel(body_a: Opaque<"b2Body">, body_b: Opaque<"b2Body">, definition?: b2d.joint.WheelDefinition): Opaque<"b2Joint">N
- Since Defold 1.13.0
Create a wheel joint.
Parameters
body_a:Opaque<"b2Body">— first bodybody_b:Opaque<"b2Body">— second bodydefinition?:b2d.joint.WheelDefinition— optional joint definition
Returns
joint:Opaque<"b2Joint">— created joint
b2d.joint.destroy(joint: Opaque<"b2Joint">): voidN
- Since Defold 1.13.0
Destroy a joint created by b2d.joint.
Parameters
joint:Opaque<"b2Joint">— joint
b2d.joint.enable_limit(joint: Opaque<"b2Joint">, enable: boolean): voidN
- Since Defold 1.13.0
Enable or disable joint limits.
Parameters
joint:Opaque<"b2Joint">— prismatic or revolute jointenable:boolean— true to enable limits
b2d.joint.enable_motor(joint: Opaque<"b2Joint">, enable: boolean): voidN
- Since Defold 1.13.0
Enable or disable the joint motor.
Parameters
joint:Opaque<"b2Joint">— prismatic, revolute, or wheel jointenable:boolean— true to enable the motor
b2d.joint.enable_spring(joint: Opaque<"b2Joint">, enable: boolean): voidN
- Since Defold 1.13.0
Enable or disable joint spring behavior.
Parameters
joint:Opaque<"b2Joint">— distance, prismatic, revolute, or wheel jointenable:boolean— true to enable the spring
b2d.joint.get_anchor_a(joint: Opaque<"b2Joint">): Vector3N
- Since Defold 1.13.0
Get the world anchor on body A.
Parameters
joint:Opaque<"b2Joint">— joint
Returns
anchor:Vector3— world anchor
b2d.joint.get_anchor_b(joint: Opaque<"b2Joint">): Vector3N
- Since Defold 1.13.0
Get the world anchor on body B.
Parameters
joint:Opaque<"b2Joint">— joint
Returns
anchor:Vector3— world anchor
b2d.joint.get_angular_damping_ratio(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get weld joint angular damping ratio.
Parameters
joint:Opaque<"b2Joint">— weld joint
Returns
ratio:number— damping ratio
b2d.joint.get_angular_hertz(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get weld joint angular frequency.
Parameters
joint:Opaque<"b2Joint">— weld joint
Returns
hertz:number— frequency in hertz
b2d.joint.get_angular_offset(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get motor joint angular offset.
Parameters
joint:Opaque<"b2Joint">— motor joint
Returns
offset:number— angular offset in radians
b2d.joint.get_body_a(joint: Opaque<"b2Joint">): Opaque<"b2Body">N
- Since Defold 1.13.0
Get the first body connected to a joint.
Parameters
joint:Opaque<"b2Joint">— joint
Returns
body:Opaque<"b2Body">— body A
b2d.joint.get_body_b(joint: Opaque<"b2Joint">): Opaque<"b2Body">N
- Since Defold 1.13.0
Get the second body connected to a joint.
Parameters
joint:Opaque<"b2Joint">— joint
Returns
body:Opaque<"b2Body">— body B
b2d.joint.get_collide_connected(joint: Opaque<"b2Joint">): booleanN
- Since Defold 1.13.0
Get whether connected bodies can collide.
Parameters
joint:Opaque<"b2Joint">— joint
Returns
collide:boolean— true if connected bodies can collide
b2d.joint.get_correction_factor(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get motor joint correction factor.
Parameters
joint:Opaque<"b2Joint">— motor joint
Returns
factor:number— correction factor
b2d.joint.get_current_length(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get the current distance joint length.
Parameters
joint:Opaque<"b2Joint">— distance joint
Returns
length:number— current length in project units
b2d.joint.get_damping_ratio(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get spring damping ratio.
Parameters
joint:Opaque<"b2Joint">— distance, mouse, weld, or wheel joint
Returns
ratio:number— damping ratio
b2d.joint.get_frequency(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get spring frequency.
Parameters
joint:Opaque<"b2Joint">— distance, mouse, weld, or wheel joint
Returns
frequency:number— frequency in hertz
b2d.joint.get_ground_anchor_a(joint: Opaque<"b2Joint">): Vector3N
- Since Defold 1.13.0
Get pulley ground anchor A.
Parameters
joint:Opaque<"b2Joint">— pulley joint
Returns
anchor:Vector3— world anchor
b2d.joint.get_ground_anchor_b(joint: Opaque<"b2Joint">): Vector3N
- Since Defold 1.13.0
Get pulley ground anchor B.
Parameters
joint:Opaque<"b2Joint">— pulley joint
Returns
anchor:Vector3— world anchor
b2d.joint.get_hertz(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Alias for b2d.joint.get_frequency.
Parameters
joint:Opaque<"b2Joint">— distance, mouse, weld, or wheel joint
Returns
hertz:number— frequency in hertz
b2d.joint.get_joint_angle(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get revolute joint angle.
Parameters
joint:Opaque<"b2Joint">— revolute joint
Returns
angle:number— angle in radians
b2d.joint.get_joint_speed(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get joint speed.
Parameters
joint:Opaque<"b2Joint">— prismatic, revolute, or wheel joint
Returns
speed:number— joint speed
b2d.joint.get_joint_translation(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get joint translation.
Parameters
joint:Opaque<"b2Joint">— prismatic or wheel joint
Returns
translation:number— translation in project units
b2d.joint.get_joint1(joint: Opaque<"b2Joint">): Opaque<"b2Joint">N
- Since Defold 1.13.0
Get the first joint connected to a gear joint.
Parameters
joint:Opaque<"b2Joint">— gear joint
Returns
joint1:Opaque<"b2Joint">— first connected joint
b2d.joint.get_joint2(joint: Opaque<"b2Joint">): Opaque<"b2Joint">N
- Since Defold 1.13.0
Get the second joint connected to a gear joint.
Parameters
joint:Opaque<"b2Joint">— gear joint
Returns
joint2:Opaque<"b2Joint">— second connected joint
b2d.joint.get_length(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get the distance joint length.
Parameters
joint:Opaque<"b2Joint">— distance joint
Returns
length:number— length in project units
b2d.joint.get_length_a(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get pulley segment length A.
Parameters
joint:Opaque<"b2Joint">— pulley joint
Returns
length:number— length in project units
b2d.joint.get_length_b(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get pulley segment length B.
Parameters
joint:Opaque<"b2Joint">— pulley joint
Returns
length:number— length in project units
b2d.joint.get_limit_state(joint: Opaque<"b2Joint">): b2d.joint.LimitStateN
- Since Defold 1.13.0
Get rope limit state.
Parameters
joint:Opaque<"b2Joint">— rope joint
Returns
state:b2d.joint.LimitState— one of theLIMIT_STATE_*constants
b2d.joint.get_linear_damping_ratio(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get weld joint linear damping ratio.
Parameters
joint:Opaque<"b2Joint">— weld joint
Returns
ratio:number— damping ratio
b2d.joint.get_linear_hertz(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get weld joint linear frequency.
Parameters
joint:Opaque<"b2Joint">— weld joint
Returns
hertz:number— frequency in hertz
b2d.joint.get_linear_offset(joint: Opaque<"b2Joint">): Vector3N
- Since Defold 1.13.0
Get motor joint linear offset.
Parameters
joint:Opaque<"b2Joint">— motor joint
Returns
offset:Vector3— linear offset in project units
b2d.joint.get_local_anchor_a(joint: Opaque<"b2Joint">): Vector3N
- Since Defold 1.13.0
Get the local anchor on body A.
Parameters
joint:Opaque<"b2Joint">— joint
Returns
anchor:Vector3— local anchor
b2d.joint.get_local_anchor_b(joint: Opaque<"b2Joint">): Vector3N
- Since Defold 1.13.0
Get the local anchor on body B.
Parameters
joint:Opaque<"b2Joint">— joint
Returns
anchor:Vector3— local anchor
b2d.joint.get_local_axis_a(joint: Opaque<"b2Joint">): Vector3N
- Since Defold 1.13.0
Get the local axis on body A.
Parameters
joint:Opaque<"b2Joint">— prismatic or wheel joint
Returns
axis:Vector3— local axis
b2d.joint.get_lower_limit(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get the lower joint limit.
Parameters
joint:Opaque<"b2Joint">— prismatic or revolute joint
Returns
lower:number— lower limit
b2d.joint.get_max_force(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get maximum force.
Parameters
joint:Opaque<"b2Joint">— mouse or friction joint
Returns
force:number— maximum force
b2d.joint.get_max_length(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get rope maximum length.
Parameters
joint:Opaque<"b2Joint">— rope joint
Returns
length:number— maximum length in project units
b2d.joint.get_max_motor_force(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get maximum motor force.
Parameters
joint:Opaque<"b2Joint">— prismatic joint
Returns
force:number— maximum motor force
b2d.joint.get_max_motor_torque(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get maximum motor torque.
Parameters
joint:Opaque<"b2Joint">— revolute or wheel joint
Returns
torque:number— maximum motor torque
b2d.joint.get_max_torque(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get maximum torque.
Parameters
joint:Opaque<"b2Joint">— friction joint
Returns
torque:number— maximum torque
b2d.joint.get_min_length(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get the distance joint minimum length.
Parameters
joint:Opaque<"b2Joint">— distance joint
Returns
length:number— minimum length in project units
b2d.joint.get_motor_force(2 overloads): numberN
- Since Defold 1.13.0
Get current motor force.
(joint: Opaque<"b2Joint">, inv_dt: number)NParameters
joint:Opaque<"b2Joint">— prismatic jointinv_dt:number— inverse time step
(joint: Opaque<"b2Joint">)NParameters
joint:Opaque<"b2Joint">— distance or prismatic joint
Returns
force:number— motor force
b2d.joint.get_motor_speed(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get motor speed.
Parameters
joint:Opaque<"b2Joint">— prismatic, revolute, or wheel joint
Returns
speed:number— motor speed
b2d.joint.get_motor_torque(2 overloads): numberN
- Since Defold 1.13.0
Get current motor torque.
(joint: Opaque<"b2Joint">, inv_dt: number)NParameters
joint:Opaque<"b2Joint">— revolute or wheel jointinv_dt:number— inverse time step
(joint: Opaque<"b2Joint">)NParameters
joint:Opaque<"b2Joint">— revolute or wheel joint
Returns
torque:number— motor torque
b2d.joint.get_mouse_target(joint: Opaque<"b2Joint">): Vector3N
- Since Defold 1.13.0
Get the target for a mouse joint.
Parameters
joint:Opaque<"b2Joint">— mouse joint
Returns
target:Vector3— world target
b2d.joint.get_ratio(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get joint ratio.
Parameters
joint:Opaque<"b2Joint">— pulley or gear joint
Returns
ratio:number— joint ratio
b2d.joint.get_reaction_force(2 overloads): Vector3N
- Since Defold 1.13.0
Get reaction force.
(joint: Opaque<"b2Joint">, inv_dt: number)NParameters
joint:Opaque<"b2Joint">— jointinv_dt:number— inverse time step
(joint: Opaque<"b2Joint">)NParameters
joint:Opaque<"b2Joint">— joint
Returns
force:Vector3— reaction force
b2d.joint.get_reaction_torque(2 overloads): numberN
- Since Defold 1.13.0
Get reaction torque.
(joint: Opaque<"b2Joint">, inv_dt: number)NParameters
joint:Opaque<"b2Joint">— jointinv_dt:number— inverse time step
(joint: Opaque<"b2Joint">)NParameters
joint:Opaque<"b2Joint">— joint
Returns
torque:number— reaction torque
b2d.joint.get_reference_angle(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get the reference angle.
Parameters
joint:Opaque<"b2Joint">— prismatic, revolute, or weld joint
Returns
angle:number— reference angle in radians
b2d.joint.get_spring_damping_ratio(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Alias for b2d.joint.get_damping_ratio.
Parameters
joint:Opaque<"b2Joint">— distance, mouse, weld, or wheel joint
Returns
ratio:number— damping ratio
b2d.joint.get_spring_hertz(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get spring frequency.
Parameters
joint:Opaque<"b2Joint">— distance, mouse, prismatic, revolute, or wheel joint
Returns
hertz:number— frequency in hertz
b2d.joint.get_type(joint: Opaque<"b2Joint">): b2d.joint.JointTypeN
- Since Defold 1.13.0
Get the joint type.
Parameters
joint:Opaque<"b2Joint">— joint
Returns
type:b2d.joint.JointType— one of theJOINT_TYPE_*constants
b2d.joint.get_upper_limit(joint: Opaque<"b2Joint">): numberN
- Since Defold 1.13.0
Get the upper joint limit.
Parameters
joint:Opaque<"b2Joint">— prismatic or revolute joint
Returns
upper:number— upper limit
b2d.joint.get_world(joint: Opaque<"b2Joint">): Opaque<"b2World">N
- Since Defold 1.13.0
Get the world owning a joint.
Parameters
joint:Opaque<"b2Joint">— joint
Returns
world:Opaque<"b2World">— owning world
b2d.joint.is_active(joint: Opaque<"b2Joint">): booleanN
- Since Defold 1.13.0
Get whether the joint is active.
Parameters
joint:Opaque<"b2Joint">— joint
Returns
active:boolean— true if the joint is active
b2d.joint.is_limit_enabled(joint: Opaque<"b2Joint">): booleanN
- Since Defold 1.13.0
Get whether joint limits are enabled.
Parameters
joint:Opaque<"b2Joint">— prismatic or revolute joint
Returns
enabled:boolean— true if limits are enabled
b2d.joint.is_motor_enabled(joint: Opaque<"b2Joint">): booleanN
- Since Defold 1.13.0
Get whether the joint motor is enabled.
Parameters
joint:Opaque<"b2Joint">— prismatic, revolute, or wheel joint
Returns
enabled:boolean— true if the motor is enabled
b2d.joint.is_spring_enabled(joint: Opaque<"b2Joint">): booleanN
- Since Defold 1.13.0
Get whether joint spring behavior is enabled.
Parameters
joint:Opaque<"b2Joint">— distance, prismatic, revolute, or wheel joint
Returns
enabled:boolean— true if the spring is enabled
b2d.joint.is_valid(joint: Opaque<"b2Joint">): booleanN
- Since Defold 1.13.0
Validate a joint handle.
Parameters
joint:Opaque<"b2Joint">— joint
Returns
valid:boolean— true if the joint handle still refers to a live Box2D joint
b2d.joint.set_angular_damping_ratio(joint: Opaque<"b2Joint">, ratio: number): voidN
- Since Defold 1.13.0
Set weld joint angular damping ratio.
Parameters
joint:Opaque<"b2Joint">— weld jointratio:number— damping ratio
b2d.joint.set_angular_hertz(joint: Opaque<"b2Joint">, hertz: number): voidN
- Since Defold 1.13.0
Set weld joint angular frequency.
Parameters
joint:Opaque<"b2Joint">— weld jointhertz:number— frequency in hertz
b2d.joint.set_angular_offset(joint: Opaque<"b2Joint">, offset: number): voidN
- Since Defold 1.13.0
Set motor joint angular offset.
Parameters
joint:Opaque<"b2Joint">— motor jointoffset:number— angular offset in radians
b2d.joint.set_collide_connected(joint: Opaque<"b2Joint">, collide: boolean): voidN
- Since Defold 1.13.0
Set whether connected bodies can collide.
Parameters
joint:Opaque<"b2Joint">— jointcollide:boolean— true if connected bodies can collide
b2d.joint.set_correction_factor(joint: Opaque<"b2Joint">, factor: number): voidN
- Since Defold 1.13.0
Set motor joint correction factor.
Parameters
joint:Opaque<"b2Joint">— motor jointfactor:number— correction factor
b2d.joint.set_damping_ratio(joint: Opaque<"b2Joint">, ratio: number): voidN
- Since Defold 1.13.0
Set spring damping ratio.
Parameters
joint:Opaque<"b2Joint">— distance, mouse, weld, or wheel jointratio:number— damping ratio
b2d.joint.set_frequency(joint: Opaque<"b2Joint">, frequency: number): voidN
- Since Defold 1.13.0
Set spring frequency.
Parameters
joint:Opaque<"b2Joint">— distance, mouse, weld, or wheel jointfrequency:number— frequency in hertz
b2d.joint.set_hertz(joint: Opaque<"b2Joint">, hertz: number): voidN
- Since Defold 1.13.0
Alias for b2d.joint.set_frequency.
Parameters
joint:Opaque<"b2Joint">— distance, mouse, weld, or wheel jointhertz:number— frequency in hertz
b2d.joint.set_length(joint: Opaque<"b2Joint">, length: number): voidN
- Since Defold 1.13.0
Set the distance joint length.
Parameters
joint:Opaque<"b2Joint">— distance jointlength:number— length in project units
b2d.joint.set_length_range(joint: Opaque<"b2Joint">, min_length: number, max_length: number): voidN
- Since Defold 1.13.0
Set the distance joint length range.
Parameters
joint:Opaque<"b2Joint">— distance jointmin_length:number— minimum length in project unitsmax_length:number— maximum length in project units
b2d.joint.set_limits(joint: Opaque<"b2Joint">, lower: number, upper: number): voidN
- Since Defold 1.13.0
Set joint limits.
Parameters
joint:Opaque<"b2Joint">— prismatic or revolute jointlower:number— lower limitupper:number— upper limit
b2d.joint.set_linear_damping_ratio(joint: Opaque<"b2Joint">, ratio: number): voidN
- Since Defold 1.13.0
Set weld joint linear damping ratio.
Parameters
joint:Opaque<"b2Joint">— weld jointratio:number— damping ratio
b2d.joint.set_linear_hertz(joint: Opaque<"b2Joint">, hertz: number): voidN
- Since Defold 1.13.0
Set weld joint linear frequency.
Parameters
joint:Opaque<"b2Joint">— weld jointhertz:number— frequency in hertz
b2d.joint.set_linear_offset(joint: Opaque<"b2Joint">, offset: Vector3): voidN
- Since Defold 1.13.0
Set motor joint linear offset.
Parameters
joint:Opaque<"b2Joint">— motor jointoffset:Vector3— linear offset in project units
b2d.joint.set_max_force(joint: Opaque<"b2Joint">, force: number): voidN
- Since Defold 1.13.0
Set maximum force.
Parameters
joint:Opaque<"b2Joint">— mouse or friction jointforce:number— maximum force
b2d.joint.set_max_length(joint: Opaque<"b2Joint">, length: number): voidN
- Since Defold 1.13.0
Set rope maximum length.
Parameters
joint:Opaque<"b2Joint">— rope jointlength:number— maximum length in project units
b2d.joint.set_max_motor_force(joint: Opaque<"b2Joint">, force: number): voidN
- Since Defold 1.13.0
Set maximum motor force.
Parameters
joint:Opaque<"b2Joint">— prismatic jointforce:number— maximum motor force
b2d.joint.set_max_motor_torque(joint: Opaque<"b2Joint">, torque: number): voidN
- Since Defold 1.13.0
Set maximum motor torque.
Parameters
joint:Opaque<"b2Joint">— revolute or wheel jointtorque:number— maximum motor torque
b2d.joint.set_max_torque(joint: Opaque<"b2Joint">, torque: number): voidN
- Since Defold 1.13.0
Set maximum torque.
Parameters
joint:Opaque<"b2Joint">— friction jointtorque:number— maximum torque
b2d.joint.set_min_length(joint: Opaque<"b2Joint">, length: number): voidN
- Since Defold 1.13.0
Set the distance joint minimum length.
Parameters
joint:Opaque<"b2Joint">— distance jointlength:number— minimum length in project units
b2d.joint.set_motor_speed(joint: Opaque<"b2Joint">, speed: number): voidN
- Since Defold 1.13.0
Set motor speed.
Parameters
joint:Opaque<"b2Joint">— prismatic, revolute, or wheel jointspeed:number— motor speed
b2d.joint.set_mouse_target(joint: Opaque<"b2Joint">, target: Vector3): voidN
- Since Defold 1.13.0
Set the target for a mouse joint.
Parameters
joint:Opaque<"b2Joint">— mouse jointtarget:Vector3— world target
b2d.joint.set_ratio(joint: Opaque<"b2Joint">, ratio: number): voidN
- Since Defold 1.13.0
Set gear joint ratio.
Parameters
joint:Opaque<"b2Joint">— gear jointratio:number— gear ratio
b2d.joint.set_reference_angle(joint: Opaque<"b2Joint">, angle: number): voidN
- Since Defold 1.13.0
Set weld joint reference angle.
Parameters
joint:Opaque<"b2Joint">— weld jointangle:number— reference angle in radians
b2d.joint.set_spring_damping_ratio(joint: Opaque<"b2Joint">, ratio: number): voidN
- Since Defold 1.13.0
Alias for b2d.joint.set_damping_ratio.
Parameters
joint:Opaque<"b2Joint">— distance, mouse, weld, or wheel jointratio:number— damping ratio
b2d.joint.set_spring_hertz(joint: Opaque<"b2Joint">, hertz: number): voidN
- Since Defold 1.13.0
Set spring frequency.
Parameters
joint:Opaque<"b2Joint">— distance, mouse, prismatic, revolute, or wheel jointhertz:number— frequency in hertz
b2d.joint.wake_bodies(joint: Opaque<"b2Joint">): voidN
- Since Defold 1.13.0
Wake the bodies connected to a joint.
Parameters
joint:Opaque<"b2Joint">— joint
Constants
b2d.joint.JOINT_TYPE_DISTANCE: number & { readonly __brand: "b2d.joint.JOINT_TYPE_DISTANCE" }N
- Since Defold 1.13.0
Distance joint type.
b2d.joint.JOINT_TYPE_FILTER: number & { readonly __brand: "b2d.joint.JOINT_TYPE_FILTER" }N
- Since Defold 1.13.0
Filter joint type.
b2d.joint.JOINT_TYPE_FRICTION: number & { readonly __brand: "b2d.joint.JOINT_TYPE_FRICTION" }N
- Since Defold 1.13.0
Friction joint type.
b2d.joint.JOINT_TYPE_GEAR: number & { readonly __brand: "b2d.joint.JOINT_TYPE_GEAR" }N
- Since Defold 1.13.0
Gear joint type.
b2d.joint.JOINT_TYPE_MOTOR: number & { readonly __brand: "b2d.joint.JOINT_TYPE_MOTOR" }N
- Since Defold 1.13.0
Motor joint type.
b2d.joint.JOINT_TYPE_MOUSE: number & { readonly __brand: "b2d.joint.JOINT_TYPE_MOUSE" }N
- Since Defold 1.13.0
Mouse joint type.
b2d.joint.JOINT_TYPE_PRISMATIC: number & { readonly __brand: "b2d.joint.JOINT_TYPE_PRISMATIC" }N
- Since Defold 1.13.0
Prismatic joint type.
b2d.joint.JOINT_TYPE_PULLEY: number & { readonly __brand: "b2d.joint.JOINT_TYPE_PULLEY" }N
- Since Defold 1.13.0
Pulley joint type.
b2d.joint.JOINT_TYPE_REVOLUTE: number & { readonly __brand: "b2d.joint.JOINT_TYPE_REVOLUTE" }N
- Since Defold 1.13.0
Revolute joint type.
b2d.joint.JOINT_TYPE_ROPE: number & { readonly __brand: "b2d.joint.JOINT_TYPE_ROPE" }N
- Since Defold 1.13.0
Rope joint type.
b2d.joint.JOINT_TYPE_UNKNOWN: number & { readonly __brand: "b2d.joint.JOINT_TYPE_UNKNOWN" }N
- Since Defold 1.13.0
Unknown joint type.
b2d.joint.JOINT_TYPE_WELD: number & { readonly __brand: "b2d.joint.JOINT_TYPE_WELD" }N
- Since Defold 1.13.0
Weld joint type.
b2d.joint.JOINT_TYPE_WHEEL: number & { readonly __brand: "b2d.joint.JOINT_TYPE_WHEEL" }N
- Since Defold 1.13.0
Wheel joint type.
b2d.joint.LIMIT_STATE_AT_LOWER: number & { readonly __brand: "b2d.joint.LIMIT_STATE_AT_LOWER" }N
- Since Defold 1.13.0
At lower limit state.
b2d.joint.LIMIT_STATE_AT_UPPER: number & { readonly __brand: "b2d.joint.LIMIT_STATE_AT_UPPER" }N
- Since Defold 1.13.0
At upper limit state.
b2d.joint.LIMIT_STATE_EQUAL: number & { readonly __brand: "b2d.joint.LIMIT_STATE_EQUAL" }N
- Since Defold 1.13.0
Equal limits state.
b2d.joint.LIMIT_STATE_INACTIVE: number & { readonly __brand: "b2d.joint.LIMIT_STATE_INACTIVE" }N
- Since Defold 1.13.0
Inactive limit state.