|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfisica.FDrawable
fisica.FJoint
fisica.FDistanceJoint
public class FDistanceJoint
Represents a distance joint that tries to keep two bodies at a constant distance. This joint is similar to connecting both bodies by a spring.
Constructor Summary | |
---|---|
FDistanceJoint(FBody body1,
FBody body2)
Construct a distance joint between two bodies. |
Method Summary | |
---|---|
void |
calculateLength()
Sets the length of the joint to the current distance between the bodies. |
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 |
getAnchor1X()
Get the horizontal coordinate of the first anchor point on the first body. |
float |
getAnchor1Y()
Get the vertical coordinate of the first anchor point on the first body. |
float |
getAnchor2X()
Get the horizontal coordinate of the second anchor point on the second body. |
float |
getAnchor2Y()
Get the vertical coordinate of the second anchor point on the second body. |
void |
setAnchor1(float x,
float y)
Sets the position of the anchor of the first end of the joint on the first body. |
void |
setAnchor2(float x,
float y)
Sets the position of the anchor of the second end of the joint on the second body. |
void |
setDamping(float damping)
Sets the damping of the spring used to maintain the distance between the bodies constant. |
void |
setFrequency(float frequency)
Sets the frequency of the spring used to maintain the distance between the bodies constant. |
void |
setLength(float length)
Sets the target distance for the joint. |
Methods inherited from class fisica.FJoint |
---|
addToWorld, getBody1, getBody2, getBox2dJoint, getReactionForceX, getReactionForceY, getReactionTorque, removeFromWorld, setCollideConnected |
Methods inherited from class fisica.FDrawable |
---|
attachImage, dettachImage, draw, drawDebug, getFillColor, getImageAlpha, isDrawable, setDrawable, setFill, setFill, setFill, setFill, setFillColor, setImageAlpha, setNoFill, setNoStroke, setStroke, setStroke, setStroke, setStroke, setStrokeColor, setStrokeWeight |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FDistanceJoint(FBody body1, FBody body2)
body1
- first body of the jointbody2
- second body of the jointMethod Detail |
---|
public void setDamping(float damping)
damping
- the damping of the springpublic void setFrequency(float frequency)
frequency
- the frequency of the springpublic void calculateLength()
public void setLength(float length)
calculateLength
.
length
- the length of the jointpublic void setAnchor2(float x, float y)
x
- the horizontal coordinate of the second anchor relative to the center of the second bodyy
- the vertical coordinate of the second anchor relative to the center of the second bodypublic void setAnchor1(float x, float y)
x
- the horizontal coordinate of the first anchor relative to the center of the first bodyy
- the vertical coordinate of the first anchor relative to the center of the first bodypublic float getAnchor1X()
public float getAnchor1Y()
public float getAnchor2X()
public float getAnchor2Y()
public void draw(processing.core.PGraphics applet)
FDrawable
world.draw()
.
This method may be overriden to allow custom drawing of the object.
draw
in class FDrawable
applet
- the graphics onto which the object must be drawn.public void drawDebug(processing.core.PGraphics applet)
FDrawable
world.drawDebug()
.
This method may be overriden to allow custom debug drawing of the object.
drawDebug
in class FDrawable
applet
- the graphics onto which the object must be drawn.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |