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
At a glance
21 membersConstructormethodbody_apropertybody_bpropertycollide_connectedpropertycurrent_lengthpropertyis_validpropertylengthpropertylimit_enabledpropertylocal_anchor_apropertylocal_anchor_bpropertymax_lengthpropertymax_motor_forcepropertymin_lengthpropertymotor_enabledpropertymotor_forcepropertymotor_speedpropertyspring_damping_ratiopropertyspring_enabledpropertyspring_hzpropertydestroymethodset_length_rangemethodReference
PYTHON APIConstructor
methodphysics.DistanceJoint(/, *args, **kwargs)Initialize self. See help(type(self)) for accurate signature.
body_a
propertybody_a: physics.BodyThe first body attached to the joint.
body_b
propertybody_b: physics.BodyThe second body attached to the joint.
collide_connected
propertycollide_connected: boolWhether the connected bodies should collide with each other.
current_length
propertycurrent_length: floatThe current length between the anchors.
is_valid
propertyis_valid: boolIndicates whether the joint is not destroyed.
length
propertylength: floatThe rest length of the joint.
limit_enabled
propertylimit_enabled: boolWhether the length limits are enabled.
local_anchor_a
propertylocal_anchor_a: Vec2The local anchor point relative to body A's origin.
local_anchor_b
propertylocal_anchor_b: Vec2The local anchor point relative to body B's origin.
max_length
propertymax_length: floatThe maximum length limit.
max_motor_force
propertymax_motor_force: floatThe maximum motor force.
min_length
propertymin_length: floatThe minimum length limit.
motor_enabled
propertymotor_enabled: boolWhether the motor is enabled.
motor_force
propertymotor_force: floatThe current motor force.
motor_speed
propertymotor_speed: floatThe target motor speed.
spring_damping_ratio
propertyspring_damping_ratio: floatThe spring damping ratio.
spring_enabled
propertyspring_enabled: boolWhether the spring is enabled.
spring_hz
propertyspring_hz: floatThe spring frequency in Hertz.
destroy
methoddestroy(self) -> NoneDestroy the joint manually.
set_length_range
methodset_length_range(self, min_length: float, max_length: float) -> NoneSet the minimum and maximum length limits.
Args
- min_length (
float) — The minimum length. - max_length (
float) — The maximum length.