|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.phys2d.raw.Body
A single body within the physics model
| Field Summary | |
static float |
INFINITE_MASS
The maximum value indicating that body won't move |
| Constructor Summary | |
|
Body(DynamicShape shape,
float m)
Create a new un-named body |
protected |
Body(Shape shape,
float m)
Create a new un-named body |
|
Body(java.lang.String name,
DynamicShape shape,
float m)
Create a named body |
protected |
Body(java.lang.String name,
Shape shape,
float m)
Create a named body |
| Method Summary | |
void |
addBit(long bitmask)
Set one or more individual bits. |
boolean |
added()
Check the added to simulation flag |
void |
addExcludedBody(Body other)
Add a body that this body is not allowed to collide with, i.e. |
void |
addForce(Vector2f f)
Add a force to this body |
void |
adjustAngularVelocity(float delta)
Adjust the angular velocity of this body |
void |
adjustBiasedAngularVelocity(float delta)
Adjust the bias angular velocity of this body |
void |
adjustBiasedVelocity(Vector2f delta)
Adjust the bias velocity of this body |
void |
adjustPosition(ROVector2f delta,
float scale)
Adjust the position of this body. |
void |
adjustPosition(Vector2f delta)
Adjust the position of this body The previous position will be set to the position before this function was called. |
void |
adjustRotation(float delta)
Adjust the rotation of this body |
void |
adjustVelocity(Vector2f delta)
Adjust the velocity of this body |
boolean |
canRest()
Check if this body can come to a resting state |
void |
collided(Body other)
Notification that this body collided with another |
boolean |
disabled()
Check if this body is disabled |
void |
endFrame()
Notification that we've ended an update frame/iteration |
boolean |
equals(java.lang.Object other)
|
float |
getAngularVelocity()
Get the angular velocity of this body |
float |
getAngularVelocityDelta()
Get the change in angular velocity in the last update |
float |
getBiasedAngularVelocity()
Get the bias angular velocity of this body |
ROVector2f |
getBiasedVelocity()
Get the bias velocity of this body |
long |
getBitmask()
Get this shape's bitmask |
BodyList |
getConnected()
Get the list of bodies that this body is connected to. |
BodyList |
getConnected(boolean stopAtStatic)
Get the list of bodies that this body is connected to. |
float |
getDamping()
Get the friction of the 'air' on this body that slows down the object. |
float |
getEnergy()
Get the energy contained in this body |
BodyList |
getExcludedList()
Get the list of bodies that can not collide with this body |
ROVector2f |
getForce()
Get the force applied to this body |
float |
getFriction()
Get the friction on the surface of this body |
boolean |
getGravityEffected()
Check if this body is effected by gravity |
float |
getI()
Get the inertia of this body |
int |
getID()
Get the ID of this body |
float |
getLastAngularVelocity()
Get the angular velocity before the last update. |
ROVector2f |
getLastPosition()
Get the position of this body before it was moved |
ROVector2f |
getLastVelocity()
Get the velocity before the last update. |
float |
getMass()
Get the mass of this body |
ROVector2f |
getPosition()
Get the position of this body |
ROVector2f |
getPositionDelta()
Get the change in position in the last update |
float |
getRestitution()
Get the "restitution" of the body. |
float |
getRotation()
Get the rotation in radians of this body |
float |
getRotDamping()
Get the rotational damping, similar to normal damping. |
Shape |
getShape()
Get the shape representing this body |
float |
getTorque()
Get the torque applied to this body |
BodyList |
getTouching()
Get the list of bodies that this body is touching. |
java.lang.Object |
getUserData()
Retrieved the attached object which initially will be null. |
ROVector2f |
getVelocity()
Get the velocity of this body |
ROVector2f |
getVelocityDelta()
Get the change in velocity in the last update |
int |
hashCode()
|
boolean |
isMoveable()
Check if this body can move |
boolean |
isResting()
Check if this body has been detected as resting and hence is considered static. |
boolean |
isRotatable()
Check if this body can rotate. |
boolean |
isStatic()
Check if this body is static |
boolean |
isTouchingStatic(java.util.ArrayList path)
Check if this body is touching a static body directly or indirectly |
void |
move(float x,
float y)
Set the position of this body after it has moved this means the last position will contain the position before this function was called. |
void |
removeBit(long bitmask)
Remove one or more individual bits. |
void |
removeExcludedBody(Body other)
Remove a body from the excluded list of this body. |
void |
resetBias()
Reset the bias velocity (done every time step) |
void |
set(Shape shape,
float m)
Reconfigure the body |
void |
setAdded(boolean added)
Set the added to simulation flag |
void |
setBitmask(long bitmask)
Set the bismask for this shape. |
void |
setCanRest(boolean canRest)
Indicate whether this body can come to a resting state. |
void |
setDamping(float damping)
Set the friction of the 'air' on this body that slows down the object. |
void |
setEnabled(boolean enabled)
Indicates whether this body should be active, collide, move/rotate |
void |
setForce(float x,
float y)
Set the force being applied to this body |
void |
setFriction(float friction)
Set the friction on the surface of this body |
void |
setGravityEffected(boolean gravity)
Indicate whether this body should be effected by gravity |
void |
setIsResting(boolean isResting)
Force this body into resting or not resting mode. |
void |
setMaxVelocity(float maxX,
float maxY)
Set the maximum velocity this body can reach. |
void |
setMoveable(boolean moveable)
Indicate whether this body should be able to moe. |
void |
setPosition(float x,
float y)
Set the position of this body, this will also set the previous position to the same value. |
void |
setRestitution(float rest)
Set the "restitution" of the body. |
void |
setRotatable(boolean rotatable)
Indicate whether this body should be able to rotate. |
void |
setRotation(float rotation)
Set the rotation in radians of this body |
void |
setRotDamping(float damping)
Set the rotational damping, similar to normal damping. |
void |
setShape(Shape shape)
Reset the shape of this body |
void |
setTorque(float t)
Set the torque being applied to this body |
void |
setUserData(java.lang.Object o)
Attach an object to this Body. |
java.lang.String |
toString()
|
protected void |
validateVelocity()
Validate the velocity value thats just been applied. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final float INFINITE_MASS
| Constructor Detail |
public Body(DynamicShape shape,
float m)
shape - The shape describing this bodym - The mass of the body
protected Body(Shape shape,
float m)
shape - The shape describing this bodym - The mass of the body
public Body(java.lang.String name,
DynamicShape shape,
float m)
name - The name to assign to the bodyshape - The shape describing this bodym - The mass of the body
protected Body(java.lang.String name,
Shape shape,
float m)
name - The name to assign to the bodyshape - The shape describing this bodym - The mass of the body| Method Detail |
public boolean disabled()
public void setEnabled(boolean enabled)
enabled - True if this body should be activepublic int getID()
public void setUserData(java.lang.Object o)
o - The (new) userdata.public java.lang.Object getUserData()
public boolean isRotatable()
public boolean isMoveable()
public void setRotatable(boolean rotatable)
rotatable - True if this body is rotatablepublic void setMoveable(boolean moveable)
moveable - True if this body is rotatablepublic void setCanRest(boolean canRest)
canRest - True if the body can come to a resting statepublic boolean canRest()
public void collided(Body other)
other - The other body that this body collided withpublic void endFrame()
public boolean isTouchingStatic(java.util.ArrayList path)
path - The path of bodies we've used to get here
public BodyList getTouching()
public BodyList getConnected()
public BodyList getConnected(boolean stopAtStatic)
stopAtStatic - True if we should stop traversing and looking for elements one you find a static one
public boolean isStatic()
public boolean isResting()
public void setIsResting(boolean isResting)
isResting - True if this body should be seen as restingpublic void setGravityEffected(boolean gravity)
gravity - True if this body should be effected
by gravitypublic boolean getGravityEffected()
public void addExcludedBody(Body other)
other - The body to exclude from collisions with this bodypublic void removeExcludedBody(Body other)
other - The body to remove from the exclusion listpublic BodyList getExcludedList()
public float getMass()
public float getI()
public void setRestitution(float rest)
rest - The restitution of this bodypublic float getRestitution()
public void set(Shape shape,
float m)
shape - The shape describing this bodym - The mass of the bodypublic void setShape(Shape shape)
shape - The new shape of this bodypublic void setFriction(float friction)
friction - The friction on the surface of this bodypublic void setRotation(float rotation)
rotation - The new rotation of the bodypublic void setDamping(float damping)
damping - The friction damping factor which
represents the body's airodynamic properties.public float getDamping()
public void setRotDamping(float damping)
damping - The rotational damping which
represents the body's airodynamic properties
when rotating.setDamping(float)public float getRotDamping()
public Shape getShape()
public void setPosition(float x,
float y)
x - The x position of this bodyy - The y position of this body
public void move(float x,
float y)
x - The x position of this bodyy - The y position of this bodypublic ROVector2f getPosition()
public ROVector2f getLastPosition()
public ROVector2f getPositionDelta()
public ROVector2f getLastVelocity()
public ROVector2f getVelocityDelta()
public float getLastAngularVelocity()
public float getAngularVelocityDelta()
public float getRotation()
public void adjustPosition(ROVector2f delta,
float scale)
delta - The amount to change the position byscale - The amount to scale the delta bypublic void adjustPosition(Vector2f delta)
delta - The amount to change the position bypublic void adjustRotation(float delta)
delta - The amount to change the rotation by
public void setForce(float x,
float y)
x - The x component of the forcey - The y component of the forcepublic void setTorque(float t)
t - The torque being applied to this bodypublic ROVector2f getVelocity()
public float getAngularVelocity()
public void adjustVelocity(Vector2f delta)
delta - The amount to change the velocity bypublic void adjustAngularVelocity(float delta)
delta - The amount to change the velocity bypublic float getFriction()
public ROVector2f getForce()
public float getTorque()
public void addForce(Vector2f f)
f - The force to be appliedpublic java.lang.String toString()
Object.toString()public int hashCode()
Object.hashCode()public boolean equals(java.lang.Object other)
Object.equals(java.lang.Object)public ROVector2f getBiasedVelocity()
public float getBiasedAngularVelocity()
public void adjustBiasedVelocity(Vector2f delta)
delta - The amount to change the velocity bypublic void adjustBiasedAngularVelocity(float delta)
delta - The amount to change the velocity bypublic void resetBias()
public float getEnergy()
public long getBitmask()
public void setBitmask(long bitmask)
bitmask - The new bitmask for this shapepublic void addBit(long bitmask)
bitmask - A bitmask with the bits
that will be switched on.public void removeBit(long bitmask)
bitmask - A bitmask with the bits
that will be switched off.public boolean added()
public void setAdded(boolean added)
added - The added to simulation flag
public void setMaxVelocity(float maxX,
float maxY)
maxX - The maximum velocity on the X axismaxY - The maximum veloicty on the Y axisprotected void validateVelocity()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||