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 | |
FRevoluteJoint (FBody body1, FBody body2, float x, float y) | |
FRevoluteJoint (FBody body1, FBody body2) | |
void | setLowerAngle (float a) |
void | setUpperAngle (float a) |
void | setEnableLimit (boolean value) |
void | setMotorSpeed (float a) |
void | setMaxMotorTorque (float a) |
void | setEnableMotor (boolean value) |
void | setAnchor (float x, float y) |
float | getAnchorX () |
float | getAnchorY () |
void | setReferenceAngle (float ang) |
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 () |
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_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_lowerAngle = 0.0f |
float | m_upperAngle = 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 revolute joint that restricts the movement of one body with respect to another to rotation around a given anchor. The rotation can be further limited given a lower and un upper angles. Additionally the user can enable a motor in order to apply a constant rotation force (torque) to the joint in order to reach the desired rotation speed.
Construct a revolute joint between two bodies given an anchor position.
body1 | first body of the joint |
body2 | second body of the joint |
x | horizontal coordinate of the anchor given in global coordinates, relative to the canvas' center |
y | vertical coordinate of the anchor given in global coordinates, relative to the canvas' center |
Construct a revolute joint between two bodies.
body1 | first body of the joint |
body2 | second body of the joint |
float FRevoluteJoint.getAnchorX | ( | ) |
Get the horizontal coordinate of the anchor of the joint around which the bodies can rotate. This position is given global coordinates, relative to the center of the canvas.
float FRevoluteJoint.getAnchorY | ( | ) |
Get the vertical coordinate of the anchor of the joint around which the bodies can rotate. This position is given global coordinates, relative to the center of the canvas.
void FRevoluteJoint.setAnchor | ( | float | x, |
float | y | ||
) |
Sets the position of the anchor of the joint around which the bodies rotate. 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 FRevoluteJoint.setEnableLimit | ( | boolean | value | ) |
Set limits to the allowed rotation of one body respect to the other. If set to
the limits imposed using setLowerAngle and setLowerAngle are enforced.
value | if true |
void FRevoluteJoint.setEnableMotor | ( | boolean | value | ) |
Set the state of the motor in order to generate a rotation force (torque) on the joint. If set to
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 |
void FRevoluteJoint.setLowerAngle | ( | float | a | ) |
Set the lowest angle allowed. This property only has effect if the
has been set to
using setEnableLimit(boolean).
a | lowest angle allowed in radians |
void FRevoluteJoint.setMaxMotorTorque | ( | float | a | ) |
Set the maximum torque that the joint's motor can apply in order to acheive the desired speed. This property only has effect if the
has been set to
using setEnableMotor(boolean).
a | the maximum torque of the joint's motor |
void FRevoluteJoint.setMotorSpeed | ( | float | a | ) |
Set the desired rotation speed of the joint. This property only has effect if the
has been set to
using setEnableMotor(boolean). The speed is given in radians per second.
a | the desired speed in radians per second |
void FRevoluteJoint.setUpperAngle | ( | float | a | ) |
Set the highest angle allowed. This property only has effect if the
has been set to
using setEnableLimit(boolean).
a | highest angle allowed in radians |
|
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 angle for the joint limit (radians).
|
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 angle for the joint limit (radians).