CLASS v1.8.0

physics.DistanceJoint

pykraken.physics.DistanceJoint

A joint that constrains two bodies to maintain a fixed distance between their anchor points.

More about physics.DistanceJoint

Optionally supports a spring to soften the constraint, a motor to drive the distance, and limits to allow a range of distances.

Inherits Joint

Reference

PYTHON API
physics.DistanceJoint(/, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

body_a

property
body_a: physics.Body

The first body attached to the joint.

body_b

property
body_b: physics.Body

The second body attached to the joint.

collide_connected: bool

Whether the connected bodies should collide with each other.

current_length: float

The current length between the anchors.

is_valid

property
is_valid: bool

Indicates whether the joint is not destroyed.

length

property
length: float

The rest length of the joint.

limit_enabled: bool

Whether the length limits are enabled.

local_anchor_a: Vec2

The local anchor point relative to body A's origin.

local_anchor_b: Vec2

The local anchor point relative to body B's origin.

max_length

property
max_length: float

The maximum length limit.

max_motor_force: float

The maximum motor force.

min_length

property
min_length: float

The minimum length limit.

motor_enabled: bool

Whether the motor is enabled.

motor_force

property
motor_force: float

The current motor force.

motor_speed

property
motor_speed: float

The target motor speed.

spring_damping_ratio: float

The spring damping ratio.

spring_enabled: bool

Whether the spring is enabled.

spring_hz

property
spring_hz: float

The spring frequency in Hertz.

destroy

method
destroy(self) -> None

Destroy the joint manually.

set_length_range(self, min_length: float, max_length: float) -> None

Set the minimum and maximum length limits.

Args

  • min_length (float) — The minimum length.
  • max_length (float) — The maximum length.

Find your next step

Start typing to search the manual.