hAPI Fisica
0.1
The hAPI Fisica physics engine expands Richard Marxer's fisica for Processing. The engine wraps the jbox2d physics engine for use with the Haply Development kit and the Hapkit.
|
Public Member Functions | |
FMouseJoint (FBody body, float x, float y) | |
void | setDamping (float damping) |
void | setFrequency (float frequency) |
void | setTarget (float x, float y) |
float | getTargetX () |
float | getTargetY () |
void | setGrabbedBodyAndTarget (FBody body, float x, float y) |
void | releaseGrabbedBody () |
FBody | getGrabbedBody () |
void | setAnchor (float x, float y) |
float | getAnchorX () |
float | getAnchorY () |
void | draw (PGraphics applet) |
void | drawDebug (PGraphics applet) |
Public Member Functions inherited from FJoint | |
Joint | getBox2dJoint () |
void | addToWorld (FWorld world) |
void | removeFromWorld () |
FBody | getBody1 () |
FBody | getBody2 () |
void | setCollideConnected (boolean value) |
float | getReactionForceX () |
float | getReactionForceY () |
float | getReactionTorque () |
Public Member Functions inherited from FDrawable | |
void | draw (PGraphics graphics) |
void | draw (PApplet applet) |
void | drawDebug (PGraphics graphics) |
void | drawDebug (PApplet applet) |
void | attachImage (PImage img) |
void | dettachImage () |
float | getImageAlpha () |
void | setImageAlpha (float alpha) |
void | setDrawable (boolean drawable) |
boolean | isDrawable () |
int | getFillColor () |
void | setFillColor (int col) |
void | setNoFill () |
void | setFill (float g) |
void | setFill (float g, float a) |
void | setFill (float r, float g, float b) |
void | setFill (float r, float g, float b, float a) |
void | setStrokeColor (int col) |
void | setNoStroke () |
void | setStroke (float g) |
void | setStroke (float g, float a) |
void | setStroke (float r, float g, float b) |
void | setStroke (float r, float g, float b, float a) |
void | setStrokeWeight (float weight) |
Protected Member Functions | |
JointDef | getJointDef (FWorld world) |
Protected Member Functions inherited from FJoint | |
void | processJoint (World world, JointDef jd) |
JointDef | getJointDef (FWorld world) |
void | preDraw (PGraphics applet) |
void | postDraw (PGraphics applet) |
void | preDrawDebug (PGraphics applet) |
void | postDrawDebug (PGraphics applet) |
Protected Member Functions inherited from FDrawable | |
void | updateStyle (FDrawable other) |
void | appletStroke (PGraphics applet, int argb) |
void | appletFill (PGraphics applet, int argb) |
void | appletFillStroke (PGraphics applet) |
void | drawImage (PGraphics applet) |
Protected Attributes | |
FBody | m_fbody |
Vec2 | m_anchor |
Vec2 | m_target |
float | m_damping = 0.9f |
float | m_frequency = 20.0f |
Protected Attributes inherited from FJoint | |
Joint | m_joint |
FWorld | m_world |
boolean | m_collideConnected = true |
Protected Attributes inherited from FDrawable | |
boolean | m_drawable = true |
boolean | m_fill = true |
int | m_fillColor = 0xFFFFFFFF |
boolean | m_stroke = true |
int | m_strokeColor = 0xFF000000 |
float | m_strokeWeight = 1.0f |
PImage | m_image = null |
float | m_imageAlpha = 255.0f |
PImage | m_mask = null |
Represents a mouse joint that tries to keep a body at a constant distance from the target. This joint is similar to connecting a spring from from the body to a target whose position can be changed programatically using setTarget.
FMouseJoint.FMouseJoint | ( | FBody | body, |
float | x, | ||
float | y | ||
) |
Construct a mouse joint between a body and a target. The constructor automatically sets the anchors of the joint to the center of the body.
body | the body to be grabbed by the joint |
x | horizontal coordinate of the initial target of the joint |
y | vertical coordinate of the initial target of the joint |
float FMouseJoint.getAnchorX | ( | ) |
Get the horizontal coordinate of the anchor point on the body. This position is given relative to the center of the body.
float FMouseJoint.getAnchorY | ( | ) |
Get the vertical coordinate of the anchor point on the body. This position is given relative to the center of the body.
FBody FMouseJoint.getGrabbedBody | ( | ) |
Returns the body grabbed by this joint.
float FMouseJoint.getTargetX | ( | ) |
Returns the horizontal target position of the joint.
float FMouseJoint.getTargetY | ( | ) |
Returns the vertical target position of the joint.
void FMouseJoint.releaseGrabbedBody | ( | ) |
Releases the body grabbed by this joint.
void FMouseJoint.setAnchor | ( | float | x, |
float | y | ||
) |
Sets the anchor position at which the joint grabs the body. The anchor point is the point used to apply forces in order to move the body.
x | the horizontal coordinate of the anchor relative to the center of the body |
y | the vertical coordinate of the anchor relative to the center of the body |
void FMouseJoint.setDamping | ( | float | damping | ) |
Sets the damping of the spring used to maintain the body and the target together. This property must be set before adding the joint to the world.
damping | the damping of the spring |
void FMouseJoint.setFrequency | ( | float | frequency | ) |
Sets the frequency of the spring used to maintain the body and the target together. This property must be set before adding the joint to the world.
frequency | the frequency of the spring |
void FMouseJoint.setGrabbedBodyAndTarget | ( | FBody | body, |
float | x, | ||
float | y | ||
) |
Sets the body grabbed by this joint and the target position.
body | the body to be grabbed by the joint |
x | horizontal coordinate of the target of the joint |
y | vertical coordinate of the target of the joint |
void FMouseJoint.setTarget | ( | float | x, |
float | y | ||
) |
Sets the target position of the joint. By setting this property everytime the mouse is used we are able to make the body of this joint follow mouse.
x | horizontal coordinate of the target of the joint |
y | vertical coordinate of the target of the joint |