public abstract class FBody extends FDrawable
| Constructor and Description |
|---|
FBody() |
| Modifier and Type | Method and Description |
|---|---|
void |
addForce(float fx,
float fy)
Aply a force on the center of the body.
|
void |
addForce(float fx,
float fy,
float px,
float py)
Apply a force to a given point of the body.
|
void |
addImpulse(float fx,
float fy)
Apply an impulse on the center of the body.
|
void |
addImpulse(float fx,
float fy,
float px,
float py)
Apply an impulse to a given point of the body.
|
void |
addTorque(float torque)
Add a rotation force (a torque) to the body.
|
void |
addToWorld(FWorld world) |
void |
adjustAngularVelocity(float dw)
Adjust the rotation velocity of the body.
|
void |
adjustPosition(float dx,
float dy)
Adjust the position of the body.
|
void |
adjustRotation(float dw)
Adjust the rotation of the body.
|
void |
adjustVelocity(float dvx,
float dvy)
Adjust the velocity of the body.
|
float |
getAngularVelocity()
Returns the rotation velocity of the body.
|
org.jbox2d.dynamics.Body |
getBox2dBody()
WARNING: This method is internal only and may change someday.
|
int |
getCategoryBits() |
java.util.ArrayList |
getContacts()
Return a list of contacts currently involving the body.
|
float |
getDensity()
Get the density of the body.
|
int |
getFilterBits() |
float |
getForceX()
Get the x coordinate of the force applied to the center of the body.
|
float |
getForceY()
Get the y coordinate of the force applied to the center of the body.
|
int |
getGroupIndex()
Get the group to which this body belongs.
|
java.util.ArrayList |
getJoints()
Returns a list with all the joints with a connection to the body
|
float |
getMass()
Returns the mass of the body.
|
java.lang.String |
getName()
Get the name of the body.
|
FBody |
getParent() |
float |
getRotation()
Returns the rotation of the body.
|
java.util.ArrayList |
getTouching()
Return a list of bodies currently touching the body.
|
float |
getVelocityX()
Returns the horizontal velocity of the body.
|
float |
getVelocityY()
Returns the vertical velocity of the body.
|
float |
getX()
Returns the horizontal position of the body.
|
float |
getY()
Returns the vertical position of the body.
|
boolean |
isConnected(FBody other)
Returns true if the body is joint to the body passed as argument
|
boolean |
isResting()
Deprecated.
|
boolean |
isSensor()
Returns whether the body is a sensor.
|
boolean |
isSleeping()
Indicates whether the body is in a sleeping state.
|
boolean |
isStatic()
Returns whether the body is static.
|
boolean |
isTouchingBody(FBody b)
Return whether the body is currently touching the body passed as argument.
|
void |
recreateInWorld() |
void |
removeFromWorld() |
void |
resetForces()
Remove all the forces that are applied to the body.
|
void |
setAllowSleeping(boolean allowSleep)
Set whether the body can sleep.
|
void |
setAngularDamping(float damping)
Set the damping of the rotation movement of the body.
|
void |
setAngularVelocity(float w)
Set the rotation velocity of the body.
|
void |
setBullet(boolean value)
Set whether the body is a bullet.
|
void |
setCategoryBits(int mask) |
void |
setDamping(float damping)
Set the damping of the translation movement of the body.
|
void |
setDensity(float density)
Set the density of the body.
|
void |
setFilterBits(int mask) |
void |
setForce(float fx,
float fy)
Set the force applied to the center of the body.
|
void |
setFriction(float friction)
Set the friction of the body.
|
void |
setGrabbable(boolean value)
Control if this body can be grabbed by the mouse, when clicked on.
|
void |
setGroupIndex(int index)
Control the group to which this body belongs.
|
void |
setName(java.lang.String name)
Set the name of the body.
|
void |
setParent(FBody b) |
void |
setPosition(float x,
float y)
Set the position of the body.
|
void |
setRestitution(float restitution)
Set the restitution of the body.
|
void |
setRotatable(boolean rotatable)
Set whether the body can rotate.
|
void |
setRotation(float w)
Set the rotation of the body.
|
void |
setSensor(boolean value)
Set whether the body is a sensor.
|
void |
setState(FBody b) |
void |
setStateFromWorld() |
void |
setStatic(boolean value)
Set whether the body is static.
|
void |
setStaticBody(boolean value)
Set whether the body is static.
|
void |
setVelocity(float vx,
float vy)
Set the velocity of the body.
|
void |
wakeUp()
Wake up the body from a sleeping state.
|
attachImage, dettachImage, draw, draw, drawDebug, drawDebug, getFillColor, getImageAlpha, isDrawable, setDrawable, setFill, setFill, setFill, setFill, setFillColor, setImageAlpha, setNoFill, setNoStroke, setStroke, setStroke, setStroke, setStroke, setStrokeColor, setStrokeWeightpublic org.jbox2d.dynamics.Body getBox2dBody()
public int getGroupIndex()
public void addToWorld(FWorld world)
public void setState(FBody b)
public void setStateFromWorld()
public void recreateInWorld()
public void removeFromWorld()
public void setGroupIndex(int index)
index - the index of the grouppublic void setFilterBits(int mask)
public void setCategoryBits(int mask)
public int getCategoryBits()
public int getFilterBits()
public void setParent(FBody b)
public FBody getParent()
public void setGrabbable(boolean value)
value - if true and the world it belongs to is grabbable, then the body is grabbable by the mouseFWorld.setGrabbable(boolean)public void setForce(float fx,
float fy)
fx - the x coordinate of the forcefy - the y coordinate of the forceaddForce(float,float)public float getForceX()
addForce(float,float),
getForceY()public float getForceY()
addForce(float,float),
getForceX()public void addTorque(float torque)
torque - the value of the torqueaddForce(float,float),
addForce(float,float,float,float)public void addForce(float fx,
float fy)
fx - the x coordinate of the forcefy - the y coordinate of the forceaddTorque(float),
addForce(float,float,float,float)public void addImpulse(float fx,
float fy)
fx - the x coordinate of the forcefy - the y coordinate of the forceaddTorque(float),
addForce(float,float,float,float)public void addForce(float fx,
float fy,
float px,
float py)
fx - the x coordinate of the forcefy - the y coordinate of the forcepx - the x position relative to the body's center, where to apply the forcepy - the y position relative to the body's center, where to apply the forceaddTorque(float),
addImpulse(float,float,float,float)public void addImpulse(float fx,
float fy,
float px,
float py)
fx - the x coordinate of the forcefy - the y coordinate of the forcepx - the x position relative to the body's center, where to apply the forcepy - the y position relative to the body's center, where to apply the forceaddTorque(float),
addForce(float,float,float,float)public void resetForces()
public float getVelocityX()
public float getVelocityY()
public void setVelocity(float vx,
float vy)
vx - the horizontal velocity of the body in pixels per secondvy - the vertical velocity of the body in pixels per secondpublic void adjustVelocity(float dvx,
float dvy)
dvx - the horizontal velocity to be added to the body in pixels per seconddvy - the vertical velocity to be added to the body in pixels per secondpublic float getX()
getY(),
setPosition(float,float)public float getY()
getX(),
setPosition(float,float)public void setPosition(float x,
float y)
x - the horizontal position of the body in pixelsy - the vertical position of the body in pixelspublic void adjustPosition(float dx,
float dy)
dx - the horizontal position to be added to the body in pixelsdy - the vertical position to be added to the body in pixelspublic float getRotation()
setRotation(float)public void setRotation(float w)
w - the rotation of the body in radiansgetRotation()public void adjustRotation(float dw)
dw - the rotation to be added to the body in radiansgetRotation(),
setRotation(float)public boolean isResting()
public boolean isSleeping()
wakeUp(),
setAllowSleeping(boolean)public void wakeUp()
isSleeping(),
setAllowSleeping(boolean)public float getAngularVelocity()
setAngularVelocity(float),
adjustAngularVelocity(float)public void setAngularVelocity(float w)
w - the rotation velocity of the body in radians per secondpublic void adjustAngularVelocity(float dw)
dw - the rotation velocity to be added to the body in radians per secondgetAngularVelocity(),
setAngularVelocity(float)public void setAngularDamping(float damping)
damping - the damping of the rotation movement of the bodysetDamping(float)public void setDamping(float damping)
damping - the damping of the translation movement of the bodysetAngularDamping(float)public void setName(java.lang.String name)
name - the name of the bodypublic java.lang.String getName()
public void setDensity(float density)
density - the density of the bodypublic float getDensity()
public void setSensor(boolean value)
value - if true the body will be a sensor. It will not collide when enters contact with other bodiespublic boolean isSensor()
true the body is a sensor. It will not collide when enters contact with other bodiespublic void setStaticBody(boolean value)
setPosition or setRotation.value - if true the body will be staticpublic void setStatic(boolean value)
setPosition or setRotation.value - if true the body will be staticpublic float getMass()
public boolean isStatic()
setPosition or setRotation.true the body is staticpublic void setBullet(boolean value)
value - if true the body will be a bulletpublic void setRestitution(float restitution)
restitution - a positive value. A value of 0 means no bounce after a collision, and a value of 1 means bounce with it's full speed from a collisionpublic void setFriction(float friction)
friction - a positive value. A value of 0 means no friction and thus the body will not be slown down if no other forces are appliedpublic void setRotatable(boolean rotatable)
rotatable - if true the body will not rotatepublic void setAllowSleeping(boolean allowSleep)
allowSleep - if true the body will be able to sleeppublic java.util.ArrayList getTouching()
public java.util.ArrayList getContacts()
public java.util.ArrayList getJoints()
public boolean isConnected(FBody other)
other - the other bodytrue the body is connected to otherpublic boolean isTouchingBody(FBody b)
b - the body for which we want to know if there is contacttrue the body is touching bprocessing library fisica by Ricard Marxer. (c) 2009-2014