blaze.dynamics.joints.revoluteJoint
- class
RevoluteJointDef
: blaze.dynamics.joints.joint.JointDef;
- 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.
- this(Body body1, Body body2, bVec2 anchor);
- Initialize the bodies, anchors, and reference angle using the world
anchor.
- bVec2
localAnchor1
;
- The local anchor point relative to body1's origin.
- bVec2
localAnchor2
;
- The local anchor point relative to body2's origin.
- float
referenceAngle
;
- The body2 angle minus body1 angle in the reference state (radians).
- bool
enableLimit
;
- A flag to enable joint limits.
- float
lowerAngle
;
- The lower angle for the joint limit (radians).
- float
upperAngle
;
- The upper angle for the joint limit (radians).
- bool
enableMotor
;
- A flag to enable the joint motor.
- float
motorSpeed
;
- The desired motor speed. Usually in radians per second.
- float
maxMotorTorque
;
- The maximum motor torque used to achieve the desired motor speed.
Usually in N-m.
- class
RevoluteJoint
: blaze.dynamics.joints.joint.Joint;
- A revolute joint constrains to bodies to share a common point while they
are free to rotate about the point. The relative rotation about the shared
point is the joint angle. You can limit the relative rotation with
a joint limit that specifies a lower and upper angle. You can use a motor
to drive the relative rotation about the shared point. A maximum motor torque
is provided so that infinite forces are not generated.
- float
jointAngle
();
- Get the current joint angle in radians.
- float
jointSpeed
();
- Get the current joint angle speed in radians per second.
- bool
isLimitEnabled
();
- Is the joint limit enabled?
- void
enableLimit
(bool flag);
- Enable/disable the joint limit.
- float
lowerLimit
();
- Get the lower joint limit in radians.
- float
upperLimit
();
- Get the upper joint limit in radians.
- void
limits
(float lower, float upper);
- Set the joint
limits
in radians.
- bool
isMotorEnabled
();
- Is the joint motor enabled?
- void
enableMotor
(bool flag);
- Enable/disable the joint motor.
- void
motorSpeed
(float speed);
- Set the motor speed in radians per second.
- float
motorSpeed
();
- Get the motor speed in radians per second.
- void
maxMotorTorque
(float torque);
- Set the maximum motor torque, usually in N-m.
- float
motorTorque
();
- Get the current motor torque, usually in N-m.
|