#include <body.h>
Public Member Functions | |
| ~Body () | |
| MOI | getMOI () const |
| Return the Moment of Inertia. | |
| bool | isAwake () const |
| Queries whether a body is sleeping or not. | |
| void | setAwake (const bool awake) |
| Allows a body to be slept and woken. | |
| void | setCanSleep (const bool sleepable) |
| Sets whether a body is allowed to sleep or not. | |
| bool | contains (const Vector &p) const |
| Checks if a position is contained within the space the body occupies. | |
| bool | intersects (const AARect &rect) const |
| Checks if the body intersects a given Bounding Box. | |
| void | add (Shape *area) |
| Add a shape to the body. | |
| void | remove (Shape *area) |
| Remove a shape from the body. | |
| const shape_container & | getShapes () const |
| Gets all the shapes contained within this body. | |
| void | applyImpulse (const Vector &impulse, const Vector &point, bool wakeUp=true) |
| void | applyImpulse (const Vector &impulse, bool wakeUp=true) |
| void | applyBiasImpulse (const Vector &impulse, const Vector &point) |
| void | applyForces (float timestep, const Vector &acceleration, float frameRWABias) |
| void | move (float timestep) |
| void | moveBias (float timestep) |
| Vector | worldToLocal (const Vector &p) const |
| Vector | localToWorld (const Vector &p) const |
| Vector | worldToLocalDir (const Vector &v) const |
| Vector | localToWorldDir (const Vector &v) const |
| Vector | getVelocityAtPoint (const Vector &position) const |
| Vector | getBiasVelocityAtPoint (const Vector &p) const |
| void | setDensity (float density, bool updateMass=true) |
| void | setRestitution (float f) |
| void | setFriction (float f) |
Static Public Member Functions | |
| static Body * | create () |
| Creates a new body and returns a pointer to it. | |
| static Body * | create (Shape *shape) |
| Creates a body with a given shape and returns a pointer to it. | |
| static Body * | createStatic (Shape *shape) |
| Creates a body with a given shape, sets it to static, and returns a pointer to it. | |
Public Attributes | |
| void * | data |
| physics::Body< d >::~Body | ( | ) | [inline] |
This will delete all shapes owned by this body. If you want to keep references to a shape, you should remove it from the body before the destructor is called.
| static Body* physics::Body< d >::create | ( | Shape * | shape | ) | [inline, static] |
Creates a body with a given shape and returns a pointer to it.
| shape | A pointer to a shape to be included in the body |
| void physics::Body< d >::setAwake | ( | const bool | awake | ) | [inline] |
Allows a body to be slept and woken.
| awake | Boolean value. True sets body to be awake, false puts its to sleep |
| bool physics::Body< d >::contains | ( | const Vector & | p | ) | const [inline] |
Checks if a position is contained within the space the body occupies.
| Position | Vector in world co-ordinates |
| bool physics::Body< d >::intersects | ( | const AARect & | rect | ) | const [inline] |
| const shape_container& physics::Body< d >::getShapes | ( | ) | const [inline] |
Gets all the shapes contained within this body.
| void physics::Body< d >::applyImpulse | ( | const Vector & | impulse, | |
| const Vector & | point, | |||
| bool | wakeUp = true | |||
| ) | [inline] |
Applies an impulse to the body.
| impulse | The impulse to apply. | |
| point | Position in world coordinates to apply impulse at. | |
| wakeUp | If true (the default), will wake the body up if it is asleep. |
| void physics::Body< d >::applyImpulse | ( | const Vector & | impulse, | |
| bool | wakeUp = true | |||
| ) | [inline] |
Applies an impulse to the body at the centre of mass. This will not cause any change in rotation.
| impulse | The impulse to apply. | |
| wakeUp | If true (the default), will wake the body up if it is asleep. |
| void physics::Body< d >::applyBiasImpulse | ( | const Vector & | impulse, | |
| const Vector & | point | |||
| ) | [inline] |
Only CattoContactResolver should use this method.
| void physics::Body< d >::applyForces | ( | float | timestep, | |
| const Vector & | acceleration, | |||
| float | frameRWABias | |||
| ) | [inline] |
Only World should use this method.
| void physics::Body< d >::move | ( | float | timestep | ) | [inline] |
Only World should use this method.
| void physics::Body< d >::moveBias | ( | float | timestep | ) | [inline] |
Only World should use this method.
| d::Vector physics::Body< d >::worldToLocal | ( | const Vector & | p | ) | const [inline] |
Transform a position from world coordinates to local coordinates.
| d::Vector physics::Body< d >::localToWorld | ( | const Vector & | p | ) | const [inline] |
Transform a position from local coordinates to world coordinates.
| d::Vector physics::Body< d >::worldToLocalDir | ( | const Vector & | v | ) | const [inline] |
Transform a direction from world coordinates to local coordinates.
| d::Vector physics::Body< d >::localToWorldDir | ( | const Vector & | v | ) | const [inline] |
Transform a direction from local coordinates to world coordinates.
| d::Vector Body::getVelocityAtPoint | ( | const Vector & | position | ) | const [inline] |
Find the combined linear and angular velocity of a point on the body
| position | Point on the body in world coordinates |
| d::Vector Body::getBiasVelocityAtPoint | ( | const Vector & | p | ) | const [inline] |
Only CattoContactResolver should use this method.
| void physics::Body< d >::setDensity | ( | float | density, | |
| bool | updateMass = true | |||
| ) | [inline] |
This is a convenience method to set the density of every shape currently attached. It will not affect shapes that are added later.
| density | New density for all attached shapes. | |
| updateMass | If true, recalculate this body's mass and moment of inertia. |
| void physics::Body< d >::setRestitution | ( | float | f | ) | [inline] |
This is a convenience method to set the coefficient of restitution of every shape currently attached. It will not affect shapes that are added later.
| void physics::Body< d >::setFriction | ( | float | f | ) | [inline] |
This is a convenience method to set the coefficient of friction of every shape currently attached. It will not affect shapes that are added later.
| void* physics::Body< d >::data |
Used for any data the application using the library wants to attach.
1.5.6