public class FRevoluteJoint extends FJoint
| Modifier and Type | Field and Description |
|---|---|
protected org.jbox2d.common.Vec2 |
m_anchor |
protected FBody |
m_body1 |
protected FBody |
m_body2 |
protected boolean |
m_enableLimit
A flag to enable joint limits.
|
protected boolean |
m_enableMotor
A flag to enable the joint motor.
|
protected org.jbox2d.common.Vec2 |
m_localAnchor1
The local anchor point relative to body1's origin.
|
protected org.jbox2d.common.Vec2 |
m_localAnchor2
The local anchor point relative to body2's origin.
|
protected float |
m_lowerAngle
The lower angle for the joint limit (radians).
|
protected float |
m_maxMotorTorque
The maximum motor torque used to achieve the desired motor speed.
|
protected float |
m_motorSpeed
The desired motor speed.
|
protected float |
m_referenceAngle
The body2 angle minus body1 angle in the reference state (radians).
|
protected float |
m_upperAngle
The upper angle for the joint limit (radians).
|
m_collideConnected, m_joint, m_worldm_drawable, m_fill, m_fillColor, m_image, m_imageAlpha, m_mask, m_stroke, m_strokeColor, m_strokeWeight| Constructor and Description |
|---|
FRevoluteJoint(FBody body1,
FBody body2)
Construct a revolute joint between two bodies.
|
FRevoluteJoint(FBody body1,
FBody body2,
float x,
float y)
Construct a revolute joint between two bodies given an anchor position.
|
| Modifier and Type | Method and Description |
|---|---|
void |
draw(def.processing.core.PGraphics applet)
This method is called when calling
world.draw(). |
void |
drawDebug(def.processing.core.PGraphics applet)
This method is called when calling
world.drawDebug(). |
float |
getAnchorX()
Get the horizontal coordinate of the anchor of the joint around which the bodies can rotate.
|
float |
getAnchorY()
Get the vertical coordinate of the anchor of the joint around which the bodies can rotate.
|
protected org.jbox2d.dynamics.joints.JointDef |
getJointDef(FWorld world) |
void |
setAnchor(float x,
float y)
Sets the position of the anchor of the joint around which the bodies rotate.
|
void |
setEnableLimit(boolean value)
Set limits to the allowed rotation of one body respect to the other.
|
void |
setEnableMotor(boolean value)
Set the state of the motor in order to generate a rotation force (torque) on the joint.
|
void |
setLowerAngle(float a)
Set the lowest angle allowed.
|
void |
setMaxMotorTorque(float a)
Set the maximum torque that the joint's motor can apply in order to acheive the desired speed.
|
void |
setMotorSpeed(float a)
Set the desired rotation speed of the joint.
|
void |
setReferenceAngle(float ang) |
void |
setUpperAngle(float a)
Set the highest angle allowed.
|
protected void |
updateLocalAnchors() |
addToWorld, getBody1, getBody2, getBox2dJoint, getReactionForceX, getReactionForceY, getReactionTorque, postDraw, postDrawDebug, preDraw, preDrawDebug, processJoint, removeFromWorld, setCollideConnectedappletFill, appletFillStroke, appletStroke, attachImage, dettachImage, drawImage, getFillColor, getImageAlpha, isDrawable, setDrawable, setFill, setFill, setFill, setFill, setFillColor, setImageAlpha, setNoFill, setNoStroke, setStroke, setStroke, setStroke, setStroke, setStrokeColor, setStrokeWeight, updateStyleprotected FBody m_body1
protected FBody m_body2
protected org.jbox2d.common.Vec2 m_anchor
protected org.jbox2d.common.Vec2 m_localAnchor1
protected org.jbox2d.common.Vec2 m_localAnchor2
protected float m_referenceAngle
protected boolean m_enableLimit
protected float m_lowerAngle
protected float m_upperAngle
protected boolean m_enableMotor
protected float m_motorSpeed
protected float m_maxMotorTorque
public FRevoluteJoint(FBody body1, FBody body2, float x, float y)
body1 - first body of the jointbody2 - second body of the jointx - horizontal coordinate of the anchor given in global coordinates, relative to the canvas' centery - vertical coordinate of the anchor given in global coordinates, relative to the canvas' centerprotected void updateLocalAnchors()
protected org.jbox2d.dynamics.joints.JointDef getJointDef(FWorld world)
getJointDef in class FJointpublic void setLowerAngle(float a)
enableLimit has been set to true using setEnableLimit(boolean).a - lowest angle allowed in radianspublic void setUpperAngle(float a)
enableLimit has been set to true using setEnableLimit(boolean).a - highest angle allowed in radianspublic void setEnableLimit(boolean value)
true the limits imposed using setLowerAngle and setLowerAngle are enforced.value - if true the bodies will be able to rotate around the anchor only between certain limitspublic void setMotorSpeed(float a)
enableMotor has been set to true using setEnableMotor(boolean). The speed is given in radians per second.a - the desired speed in radians per secondpublic void setMaxMotorTorque(float a)
enableMotor has been set to true using setEnableMotor(boolean).a - the maximum torque of the joint's motorpublic void setEnableMotor(boolean value)
true the desired motor speed, set using setMotorSpeed, will try to be matched using a motor with a maximum rotation force (torque) set using setMaxMotorTorque.value - if true the joint will receive the rotation force (torque) of a motorpublic void setAnchor(float x,
float y)
x - the horizontal coordinate of the anchor in global coordinates, relative to the center of the canvasy - the vertical coordinate of the anchor in global coordinates, relative to the center of the canvaspublic float getAnchorX()
public float getAnchorY()
public void setReferenceAngle(float ang)
public void draw(def.processing.core.PGraphics applet)
FDrawableworld.draw().
This method may be overriden to allow custom drawing of the object.public void drawDebug(def.processing.core.PGraphics applet)
FDrawableworld.drawDebug().
This method may be overriden to allow custom debug drawing of the object.