gale.physics.joint module
This file contains Joint, RevoluteJoint, and WheelJoint: constraints between two Bodies (a hinge, and a wheel-on-a-suspension-spring, respectively), wrapping one or more pymunk constraints without ever exposing pymunk itself. Created through World.create_revolute_joint/create_wheel_joint.
Author: Alejandro Mujica (aledrums@gmail.com)
- class gale.physics.joint.Joint(pm_constraints)[source]
Bases:
objectBase class for a constraint between two bodies. Created through World.create_revolute_joint/create_wheel_joint, never directly.
- Parameters:
pm_constraints (List[Any])
- class gale.physics.joint.RevoluteJoint(pivot, motor, limit, body_a, body_b)[source]
Bases:
JointA pin joint: constrains two bodies to rotate around a shared point, optionally motorized and/or limited to an angle range.
Usage example:
joint = world.create_revolute_joint(anchor_body, arm, (100, 50)) joint.enable_motor = True joint.motor_speed = 2.0 joint.max_motor_torque = 500
joint.enable_limit = True joint.lower_angle = -0.5 joint.upper_angle = 0.5
- Parameters:
pivot (Any)
motor (Any)
limit (Any)
body_a (Any)
body_b (Any)
- property angle: float
- property motor_speed: float
- property max_motor_torque: float
- property enable_motor: bool
- property enable_limit: bool
- property lower_angle: float
- property upper_angle: float
- class gale.physics.joint.WheelJoint(groove, spring, motor, mass, frequency, damping_ratio)[source]
Bases:
JointA wheel with suspension: constrains a body to slide along an axis relative to another (the suspension, via a groove joint plus a damped spring), plus an unconstrained rotation (the wheel spinning), optionally motorized.
Usage example:
- joint = world.create_wheel_joint(
chassis, wheel, wheel.position, frequencyHz=4, dampingRatio=0.7
) joint.enable_motor = True joint.motor_speed = -10 # drive forward joint.max_motor_torque = 800
- Parameters:
groove (Any)
spring (Any)
motor (Any)
mass (float)
frequency (float)
damping_ratio (float)
- property motor_speed: float
- property max_motor_torque: float
- property enable_motor: bool
- property frequency: float
- property damping_ratio: float