A rigid body. These are created via b2World::CreateBody. More...
#include <b2Body.h>
Private Types | |
enum | { e_islandFlag = 0x0001, e_awakeFlag = 0x0002, e_autoSleepFlag = 0x0004, e_bulletFlag = 0x0008, e_fixedRotationFlag = 0x0010, e_activeFlag = 0x0020, e_toiFlag = 0x0040 } |
Private Member Functions | |
void | Advance (float32 t) |
b2Body (const b2BodyDef *bd, b2World *world) | |
bool | ShouldCollide (const b2Body *other) const |
void | SynchronizeFixtures () |
void | SynchronizeTransform () |
~b2Body () | |
Friends | |
class | b2Contact |
class | b2ContactManager |
class | b2ContactSolver |
class | b2DistanceJoint |
class | b2FrictionJoint |
class | b2GearJoint |
class | b2Island |
class | b2MotorJoint |
class | b2MouseJoint |
class | b2PrismaticJoint |
class | b2PulleyJoint |
class | b2RevoluteJoint |
class | b2RopeJoint |
class | b2WeldJoint |
class | b2WheelJoint |
class | b2World |
A rigid body. These are created via b2World::CreateBody.
|
private |
Definition at line 25 of file b2Body.cpp.
|
private |
Definition at line 108 of file b2Body.cpp.
Apply a force at a world point. If the force is not applied at the center of mass, it will generate a torque and affect the angular velocity. This wakes up the body.
force | the world force vector, usually in Newtons (N). |
point | the world position of the point of application. |
wake | also wake up the body |
Apply an impulse at a point. This immediately modifies the velocity. It also modifies the angular velocity if the point of application is not at the center of mass. This wakes up the body.
impulse | the world impulse vector, usually in N-seconds or kg-m/s. |
point | the world position of the point of application. |
wake | also wake up the body |
b2Fixture * b2Body::CreateFixture | ( | const b2FixtureDef * | def | ) |
Creates a fixture and attach it to this body. Use this function if you need to set some fixture parameters, like friction. Otherwise you can create the fixture directly from a shape. If the density is non-zero, this function automatically updates the mass of the body. Contacts are not created until the next time step.
def | the fixture definition. |
Definition at line 166 of file b2Body.cpp.
Creates a fixture from a shape and attach it to this body. This is a convenience function. Use b2FixtureDef if you need to set parameters like friction, restitution, user data, or filtering. If the density is non-zero, this function automatically updates the mass of the body.
shape | the shape to be cloned. |
density | the shape density (set to zero for static bodies). |
Definition at line 205 of file b2Body.cpp.
Destroy a fixture. This removes the fixture from the broad-phase and destroys all contacts associated with this fixture. This will automatically adjust the mass of the body if the body is dynamic and the fixture has positive density. All fixtures attached to a body are implicitly destroyed when the body is destroyed.
fixture | the fixture to be removed. |
Definition at line 214 of file b2Body.cpp.
void b2Body::Dump | ( | ) |
Dump this body to a log file.
Definition at line 521 of file b2Body.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
Get the list of all contacts attached to this body.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void b2Body::ResetMassData | ( | ) |
This resets the mass properties to the sum of the mass properties of the fixtures. This normally does not need to be called unless you called SetMassData to override the mass and you later want to reset the mass.
Definition at line 281 of file b2Body.cpp.
void b2Body::SetActive | ( | bool | flag | ) |
Set the active state of the body. An inactive body is not simulated and cannot be collided with or woken up. If you pass a flag of true, all fixtures will be added to the broad-phase. If you pass a flag of false, all fixtures will be removed from the broad-phase and all contacts will be destroyed. Fixtures and joints are otherwise unaffected. You may continue to create/destroy fixtures and joints on inactive bodies. Fixtures on an inactive body are implicitly inactive and will not participate in collisions, ray-casts, or queries. Joints connected to an inactive body are implicitly inactive. An inactive body is still owned by a b2World object and remains in the body list.
Definition at line 454 of file b2Body.cpp.
|
inline |
|
inline |
void b2Body::SetFixedRotation | ( | bool | flag | ) |
Set this body to have fixed rotation. This causes the mass to be reset.
Definition at line 499 of file b2Body.cpp.
void b2Body::SetMassData | ( | const b2MassData * | data | ) |
Set the mass properties to override the mass properties of the fixtures. Note that this changes the center of mass position. Note that creating or destroying fixtures can also alter the mass. This function has no effect if the body isn't dynamic.
massData | the mass properties. |
Definition at line 353 of file b2Body.cpp.
|
inline |
Set the position of the body's origin and rotation. Manipulating a body's transform may cause non-physical behavior. Note: contacts are updated on the next call to b2World::Step.
position | the world position of the body's local origin. |
angle | the world rotation in radians. |
Definition at line 417 of file b2Body.cpp.
void b2Body::SetType | ( | b2BodyType | type | ) |
Set the type of this body. This may alter the mass and velocity.
Definition at line 113 of file b2Body.cpp.
Definition at line 394 of file b2Body.cpp.
|
private |
Definition at line 441 of file b2Body.cpp.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
private |
|
private |
|
private |
|
private |