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 | |
FPrismaticJoint (FBody body1, FBody body2) | |
void | setAxis (float x, float y) |
void | setAnchor (float x, float y) |
float | getAnchorX () |
float | getAnchorY () |
void | setLowerTranslation (float translation) |
void | setUpperTranslation (float translation) |
void | setEnableLimit (boolean value) |
void | draw (PGraphics applet) |
void | drawDebug (PGraphics applet) |
![]() | |
Joint | getBox2dJoint () |
void | addToWorld (FWorld world) |
void | removeFromWorld () |
FBody | getBody1 () |
FBody | getBody2 () |
void | setCollideConnected (boolean value) |
float | getReactionForceX () |
float | getReactionForceY () |
float | getReactionTorque () |
![]() | |
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 | |
void | updateLocalAnchors () |
void | updateLocalAxis () |
JointDef | getJointDef (FWorld world) |
![]() | |
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) |
![]() | |
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_body1 |
FBody | m_body2 |
Vec2 | m_anchor |
Vec2 | m_axis |
Vec2 | m_localAxis1 = new Vec2(0, 1) |
float | m_force |
float | m_torque |
float | m_motorForce |
float | m_limitForce |
float | m_limitPositionImpulse |
float | m_maxMotorForce |
Vec2 | m_localAnchor1 = new Vec2(0.0f, 0.0f) |
Vec2 | m_localAnchor2 = new Vec2(0.0f, 0.0f) |
float | m_referenceAngle = 0.0f |
boolean | m_enableLimit = false |
float | m_lowerTranslation = 0.0f |
float | m_upperTranslation = 0.0f |
boolean | m_enableMotor = false |
float | m_motorSpeed = 0.0f |
float | m_maxMotorTorque = 0.0f |
![]() | |
Joint | m_joint |
FWorld | m_world |
boolean | m_collideConnected = true |
![]() | |
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 prismatic joint that restricts the movement of one body with respect to another to a translation along a given axis. Often this joint is used with one of the bodies being static in order to only allow translation of the other body along a given axis. This translation can also be bounded given lower and upper translation limits.
Construct a prismatic joint between two bodies. The constructor automatically sets the anchor of the joint to the center of the second body.
body1 | first body of the joint |
body2 | second body of the joint |
float FPrismaticJoint.getAnchorX | ( | ) |
Get the horizontal coordinate of the anchor of the joint. This position is given global coordinates, relative to the center of the canvas.
float FPrismaticJoint.getAnchorY | ( | ) |
Get the vertical coordinate of the anchor of the joint. This position is given global coordinates, relative to the center of the canvas.
void FPrismaticJoint.setAnchor | ( | float | x, |
float | y | ||
) |
Sets the position of the anchor of the joint. This position is given global coordinates, relative to the center of the canvas.
x | the horizontal coordinate of the anchor in global coordinates, relative to the center of the canvas |
y | the vertical coordinate of the anchor in global coordinates, relative to the center of the canvas |
void FPrismaticJoint.setAxis | ( | float | x, |
float | y | ||
) |
Sets the axis of movement of the joint. This is only axis alog which the bodies can translate with relation to each other. The axis is given global coordinates, relative to the center of the canvas. This property must be set before adding the joint to the world.
x | the horizontal component of the axis in global coordinates, relative to the center of the canvas |
y | the vertical coordinate of the axis in global coordinates, relative to the center of the canvas |
void FPrismaticJoint.setEnableLimit | ( | boolean | value | ) |
Set limits to the allowed translation of one body respect to the other. If set to
the limits imposed using setLowerTranslation and setLowerTranslation are enforced.
value | if true |
void FPrismaticJoint.setLowerTranslation | ( | float | translation | ) |
Set the lowest translation allowed. This property only has effect if the
has been set to
using setEnableLimit(boolean).
translation | lowest translation position in simulation world units |
void FPrismaticJoint.setUpperTranslation | ( | float | translation | ) |
Set the highest translation allowed. This property only has effect if the
has been set to
using setEnableLimit(boolean).
translation | highest translation position in simulation world units |
|
protected |
A flag to enable joint limits.
|
protected |
A flag to enable the joint motor.
|
protected |
The local anchor point relative to body1's origin.
|
protected |
The local anchor point relative to body2's origin.
|
protected |
The lower translation for the joint limit (world coords).
|
protected |
The maximum motor torque used to achieve the desired motor speed. Usually in N-m.
|
protected |
The desired motor speed. Usually in radians per second.
|
protected |
The body2 angle minus body1 angle in the reference state (radians).
|
protected |
The upper translation for the joint limit (world coords).