Struct liquidfun::box2d::dynamics::joints::revolute_joint::RevoluteJointDef [] [src]

pub struct RevoluteJointDef {
    pub local_anchor_a: Vec2,
    pub local_anchor_b: Vec2,
    pub reference_angle: Float32,
    pub enable_limit: bool,
    pub lower_angle: Float32,
    pub upper_angle: Float32,
    pub enable_motor: bool,
    pub motor_speed: Float32,
    pub max_motor_torque: Float32,
}

Revolute joint definition. This requires defining an anchor point where the bodies are joined. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. You also need to specify the initial relative angle for joint limits. This helps when saving and loading a game. The local anchor points are measured from the body's origin rather than the center of mass because: 1. you might not know where the center of mass will be. 2. if you add/remove shapes from a body and recompute the mass, the joints will be broken.

Fields

local_anchor_a

Initialize the bodies, anchors, and reference angle using a world anchor point. The local anchor point relative to bodyA's origin.

local_anchor_b

The local anchor point relative to bodyB's origin.

reference_angle

The bodyB angle minus bodyA angle in the reference state (radians).

enable_limit

A flag to enable joint limits.

lower_angle

The lower angle for the joint limit (radians).

upper_angle

The upper angle for the joint limit (radians).

enable_motor

A flag to enable the joint motor.

motor_speed

The desired motor speed. Usually in radians per second.

max_motor_torque

The maximum motor torque used to achieve the desired motor speed. Usually in N-m.

Methods

impl RevoluteJointDef

fn new() -> (JointDef, RevoluteJointDef)

fn initialize(&mut self, joint: &mut JointDef, body_a: Body, body_b: Body, anchor: &Vec2)

Trait Implementations

Derived Implementations

impl Debug for RevoluteJointDef

fn fmt(&self, __arg_0: &mut Formatter) -> Result