public class FRevoluteJoint extends FJoint
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(processing.core.PGraphics applet)
This method is called when calling
world.draw() . |
void |
drawDebug(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.
|
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.
|
addToWorld, getBody1, getBody2, getBox2dJoint, getReactionForceX, getReactionForceY, getReactionTorque, removeFromWorld, setCollideConnected
attachImage, dettachImage, draw, drawDebug, getFillColor, getImageAlpha, isDrawable, setDrawable, setFill, setFill, setFill, setFill, setFillColor, setImageAlpha, setNoFill, setNoStroke, setStroke, setStroke, setStroke, setStroke, setStrokeColor, setStrokeWeight
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' centerpublic 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(processing.core.PGraphics applet)
FDrawable
world.draw()
.
This method may be overriden to allow custom drawing of the object.public void drawDebug(processing.core.PGraphics applet)
FDrawable
world.drawDebug()
.
This method may be overriden to allow custom debug drawing of the object.processing library fisica by Ricard Marxer. (c) 2009-2014