public class FPoly extends FBody
vertex method in a similar way to FPoly:
FPoly myPoly = new 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(myPoly);
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
m_closed |
protected org.jbox2d.util.nonconvex.Polygon |
m_polygon |
protected ArrayList |
m_vertices |
m_allowSleep, m_angle, m_angularDamping, m_angularVelocity, m_body, m_bullet, m_categoryBits, m_density, m_filterBits, m_force, m_friction, m_grabbable, m_groupIndex, m_isSleeping, m_linearDamping, m_linearVelocity, m_name, m_parent, m_position, m_restitution, m_rotatable, m_sensor, m_shape, m_static, m_torque, m_worldm_drawable, m_fill, m_fillColor, m_image, m_imageAlpha, m_mask, m_stroke, m_strokeColor, m_strokeWeight| Constructor and Description |
|---|
FPoly()
Constructs a polygonal body that can be added to a world.
|
| Modifier and Type | Method and Description |
|---|---|
void |
draw(def.processing.core.PGraphics applet)
This method is called when calling
world.draw(). |
void |
drawDebug(def.processing.core.PGraphics applet)
This method is called when calling
world.drawDebug(). |
protected org.jbox2d.collision.shapes.ShapeDef |
getShapeDef() |
protected org.jbox2d.collision.shapes.ShapeDef |
getTransformedShapeDef() |
protected void |
processBody(org.jbox2d.dynamics.Body bd,
org.jbox2d.collision.shapes.ShapeDef sd) |
void |
vertex(float x,
float y)
Adds vertices to the shape of the poly.
|
addForce, addForce, addImpulse, addImpulse, addTorque, addToWorld, adjustAngularVelocity, adjustPosition, adjustRotation, adjustVelocity, applyMatrix, getAABB, getAngularVelocity, getBB, getBodies, getBox2dBody, getCategoryBits, getContacts, getDensity, getFilterBits, getForceX, getForceY, getGroupIndex, getJoints, getLocalWorldPoint, getMass, getName, getParent, getProcessedShapeDef, getRotation, getShapeDefs, getTouching, getVelocityX, getVelocityY, getX, getY, isConnected, isResting, isSensor, isSleeping, isStatic, isTouchingBody, postDraw, postDrawDebug, preDraw, preDrawDebug, processShapeDef, recreateInWorld, removeFromWorld, resetForces, setAllowSleeping, setAngularDamping, setAngularVelocity, setBullet, setCategoryBits, setDamping, setDensity, setFilterBits, setForce, setFriction, setGrabbable, setGroupIndex, setName, setParent, setPosition, setPosition, setRestitution, setRotatable, setRotation, setSensor, setState, setStateFromWorld, setStatic, setStaticBody, setVelocity, updateMass, wakeUpappletFill, appletFillStroke, appletStroke, attachImage, dettachImage, drawImage, getFillColor, getImageAlpha, isDrawable, setDrawable, setFill, setFill, setFill, setFill, setFillColor, setImageAlpha, setNoFill, setNoStroke, setStroke, setStroke, setStroke, setStroke, setStrokeColor, setStrokeWeight, updateStyleprotected org.jbox2d.util.nonconvex.Polygon m_polygon
protected boolean m_closed
protected ArrayList m_vertices
public FPoly()
vertex to define the shape of the polygon.public void vertex(float x,
float y)
x - x coordinate of the vertex to be addedy - y coordinate of the vertex to be addedprotected void processBody(org.jbox2d.dynamics.Body bd,
org.jbox2d.collision.shapes.ShapeDef sd)
processBody in class FBodyprotected org.jbox2d.collision.shapes.ShapeDef getShapeDef()
getShapeDef in class FBodyprotected org.jbox2d.collision.shapes.ShapeDef getTransformedShapeDef()
getTransformedShapeDef in class FBodypublic void draw(def.processing.core.PGraphics applet)
FDrawableworld.draw().
This method may be overriden to allow custom drawing of the object.public void drawDebug(def.processing.core.PGraphics applet)
FDrawableworld.drawDebug().
This method may be overriden to allow custom debug drawing of the object.