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 | |
FBlob () | |
void | addToWorld (FWorld world) |
void | removeFromWorld () |
void | addVertexBody (FBody b) |
void | vertex (float x, float y) |
float | getVertexX (int i) |
float | getVertexY (int i) |
void | setAsCircle (float x, float y, float size, int vertexCount) |
void | setAsCircle (float x, float y, float size) |
void | setAsCircle (float size) |
void | setAsCircle (float size, int vertexCount) |
float | getVertexSize () |
void | setVertexSize (float size) |
ArrayList | getVertexBodies () |
void | setFrequency (float frequency) |
void | setDamping (float damping) |
void | addForce (float fx, float fy) |
void | addTorque (float t) |
void | setDensity (float d) |
void | setFriction (float d) |
void | setRestitution (float d) |
void | setBullet (boolean d) |
void | setNoStroke () |
void | setNoFill () |
void | setFillColor (int col) |
void | setStrokeColor (int col) |
void | setStrokeWeight (float col) |
void | setDrawable (boolean val) |
void | attachImage (PImage img) |
void | dettachImage () |
Public Member Functions inherited from FBody | |
Body | getBox2dBody () |
int | getGroupIndex () |
void | addToWorld (FWorld world) |
void | setState (FBody b) |
void | setStateFromWorld () |
void | recreateInWorld () |
void | removeFromWorld () |
void | setGroupIndex (int index) |
void | setFilterBits (int mask) |
void | setCategoryBits (int mask) |
int | getCategoryBits () |
int | getFilterBits () |
void | setParent (FBody b) |
FBody | getParent () |
void | setGrabbable (boolean value) |
void | setForce (float fx, float fy) |
float | getForceX () |
float | getForceY () |
void | addTorque (float torque) |
void | addForce (float fx, float fy) |
void | addImpulse (float fx, float fy) |
void | addForce (float fx, float fy, float px, float py) |
void | addImpulse (float fx, float fy, float px, float py) |
void | resetForces () |
float | getVelocityX () |
float | getVelocityY () |
void | setVelocity (float vx, float vy) |
void | adjustVelocity (float dvx, float dvy) |
float | getX () |
float | getY () |
void | setPosition (float x, float y) |
void | adjustPosition (float dx, float dy) |
float | getRotation () |
float | getHapticStiffness () |
float | getHapticDamping () |
void | setRotation (float w) |
void | adjustRotation (float dw) |
boolean | isResting () |
boolean | isSleeping () |
void | wakeUp () |
float | getAngularVelocity () |
void | setAngularVelocity (float w) |
void | adjustAngularVelocity (float dw) |
void | setAngularDamping (float damping) |
void | setDamping (float damping) |
void | setName (String name) |
String | getName () |
void | setDensity (float density) |
float | getDensity () |
void | setSensor (boolean value) |
boolean | isSensor () |
void | setHaptic (boolean value) |
void | setHaptic (boolean value, float stiffness, float damping) |
boolean | isHaptic () |
void | setHapticStiffness (float stiffness) |
void | setHapticDamping (float damping) |
void | setStaticBody (boolean value) |
void | setStatic (boolean value) |
float | getMass () |
boolean | isStatic () |
void | setBullet (boolean value) |
void | setRestitution (float restitution) |
void | setFriction (float friction) |
void | setRotatable (boolean rotatable) |
void | setAllowSleeping (boolean allowSleep) |
ArrayList | getTouching () |
ArrayList | getContacts () |
ArrayList | getJoints () |
boolean | isConnected (FBody other) |
boolean | isTouchingBody (FBody b) |
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 Attributes | |
ArrayList | m_vertices |
ArrayList | m_vertexBodies |
float | m_damping = 0.0f |
float | m_frequency = 0.0f |
float | m_vertexSize = .15f |
Vec2 | m_force = new Vec2() |
float | m_torque = 0.0f |
float | m_density = 1.0f |
float | m_restitution = 0.5f |
float | m_friction = 0.5f |
boolean | m_bullet = false |
FConstantVolumeJoint | m_joint |
Protected Attributes inherited from FBody | |
float | m_density = 1.0f |
float | m_restitution = 0.1f |
float | m_friction = 0.1f |
boolean | m_bullet = false |
boolean | m_sensor = false |
boolean | m_static = false |
float | m_linearDamping = 0.5f |
float | m_gravityScale = 1.0f |
float | m_angularDamping = 0.5f |
boolean | m_rotatable = true |
boolean | m_allowSleep = true |
boolean | m_isSleeping = false |
int | m_groupIndex = 0 |
int | m_filterBits = 0xffff |
int | m_categoryBits = 0x0001 |
Vec2 | m_linearVelocity = new Vec2(0.0f, 0.0f) |
float | m_angularVelocity = 0.0f |
Vec2 | m_force = new Vec2(0.0f, 0.0f) |
float | m_torque = 0.0f |
Vec2 | m_position = new Vec2(0.0f, 0.0f) |
float | m_angle = 0.0f |
String | m_name |
Body | m_body |
FWorld | m_world |
FBody | m_parent |
boolean | m_grabbable = true |
boolean | h_isHaptic = true |
float | h_damping = 0.0f |
float | h_stiffness =0.0f |
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 |
Additional Inherited Members | |
Protected Member Functions inherited from FBody | |
void | processBody (Body bd, ShapeDef sd) |
ShapeDef | getShapeDef () |
ShapeDef | getTransformedShapeDef () |
ShapeDef | getProcessedShapeDef () |
ArrayList | getShapeDefs () |
ArrayList | getBodies () |
ShapeDef | processShapeDef (ShapeDef sd) |
void | preDraw (PGraphics applet) |
void | postDraw (PGraphics applet) |
void | preDrawDebug (PGraphics applet) |
void | postDrawDebug (PGraphics applet) |
AABB | getAABB () |
AABB | getBB () |
void | applyMatrix (PGraphics applet) |
void | setPosition (Vec2 position) |
void | updateMass () |
Vec2 | getLocalWorldPoint (Vec2 p) |
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) |
Represents a blob body that can be added to a world. Blobs are soft bodies that are composed of vertices and tries to maintain constant the volume the vertices enclose. Blobs can be created by adding vertices using the vertex method in a similar way to FPoly:
myBlob.vertex(40, 10);myBlob.vertex(50, 20);myBlob.vertex(60, 30);myBlob.vertex(60, 40);myBlob.vertex(50, 50);myBlob.vertex(40, 60);myBlob.vertex(30, 70);myBlob.vertex(20, 60);myBlob.vertex(10, 50);myBlob.vertex(10, 40);myBlob.vertex(20, 30);myBlob.vertex(30, 20);myBlob.vertex(40, 10);world.add(myBlob);
or it may be initialized using the method setAsCircle to set the initial shape as a circle:
Bodies
FBlob.FBlob | ( | ) |
Constructs a blob body that can be added to a world. It creates an empty blob, before adding the blob to the world use vertex or setAsCircle to define the initial shape of the blob.
void FBlob.addVertexBody | ( | FBody | b | ) |
Adds a vertex body to the initial shape of the blob. This method must be called before adding the body to the world.
b | b the body to be added |
ArrayList FBlob.getVertexBodies | ( | ) |
Returns vertices of the blob.
float FBlob.getVertexSize | ( | ) |
Returns the size of the circular vertices of the blob. This method must be called before the body is added to the world.
float FBlob.getVertexX | ( | int | i | ) |
Gets the x coordinate of the ith vertex of the initial shape of the blob.
i | index of the vertex to retrieve |
float FBlob.getVertexY | ( | int | i | ) |
Gets the y coordinate of the ith vertex of the initial shape of the blob.
i | index of the vertex to retrieve |
void FBlob.setAsCircle | ( | float | x, |
float | y, | ||
float | size, | ||
int | vertexCount | ||
) |
Sets the initial shape of the blob to a circle. This method removes all the previous vertices tha may have been added by the use of the vertex. This method must be called before adding the body to the world.
x | x coordinate of the position of the circle |
y | y coordinate of the position of the circle |
size | size of the circle |
vertexCount | number of vertices of the circle |
void FBlob.setAsCircle | ( | float | x, |
float | y, | ||
float | size | ||
) |
Sets the initial shape of the blob to a circle. This method removes all the previous vertices tha may have been added by the use of the vertex. This method must be called before adding the body to the world.
x | x coordinate of the position of the circle |
y | y coordinate of the position of the circle |
size | size of the circle |
void FBlob.setAsCircle | ( | float | size | ) |
Sets the initial shape of the blob to a circle. This method removes all the previous vertices tha may have been added by the use of the vertex. This method must be called before adding the body to the world.
size | size of the circle |
void FBlob.setAsCircle | ( | float | size, |
int | vertexCount | ||
) |
Sets the initial shape of the blob to a circle. This method removes all the previous vertices tha may have been added by the use of the vertex. This method must be called before adding the body to the world.
size | size of the circle |
vertexCount | number of vertices of the circle |
void FBlob.setDamping | ( | float | damping | ) |
Sets the damping of the springs used to maintain the volume defined by the vertices constant.
damping | the damping of the springs of the constant volume joint |
void FBlob.setFrequency | ( | float | frequency | ) |
Sets the frequency of the springs used to maintain the volume defined by the vertices constant.
frequency | the frequency of the springs of the constant volume joint |
void FBlob.setVertexSize | ( | float | size | ) |
Sets the size of the circular vertices of the blob. This method must be called before the body is added to the world.
size | size of the circular vertices of the blob |
void FBlob.vertex | ( | float | x, |
float | y | ||
) |
Adds a vertex to the initial shape of the blob. This method must be called before adding the body to the world.
x | x coordinate of the vertex to be added |
y | y coordinate of the vertex to be added |