159 for (
int32 i = 0; i < proxyCount; ++i)
178 fixture->
Create(allocator,
this, def);
228 while (*node != NULL)
230 if (*node == fixture)
253 if (fixture == fixtureA || fixture == fixtureB)
272 fixture->~b2Fixture();
305 if (
f->m_density == 0.0f)
311 f->GetMassData(&massData);
313 localCenter += massData.
mass * massData.
center;
405 if (jn->other == other)
407 if (jn->joint->m_collideConnected ==
false)
450 f->Synchronize(broadPhase, xf1,
m_xf);
471 f->CreateProxies(broadPhase,
m_xf);
484 f->DestroyProxies(broadPhase);
526 b2Log(
" b2BodyDef bd;\n");
float32 b2Dot(const b2Vec2 &a, const b2Vec2 &b)
Perform the dot product on two vectors.
const b2Vec2 b2Vec2_zero(0.0f, 0.0f)
Useful constant.
b2Vec2 b2Mul(const b2Mat22 &A, const b2Vec2 &v)
void SynchronizeFixtures()
float32 angularVelocity
The angular velocity of the body.
bool fixedRotation
Should this body be prevented from rotating? Useful for characters.
b2Fixture * CreateFixture(const b2FixtureDef *def)
void b2Log(const char *string,...)
Logging function.
void Create(b2BlockAllocator *allocator, b2Body *body, const b2FixtureDef *def)
b2ContactManager m_contactManager
void SetType(b2BodyType type)
Set the type of this body. This may alter the mass and velocity.
float32 I
The rotational inertia of the shape about the local origin.
b2ContactEdge * m_contactList
void Free(void *p, int32 size)
Free memory. This will use b2Free if the size is larger than b2_maxBlockSize.
b2Vec2 center
The position of the shape's centroid relative to the shape's origin.
void SetZero()
Set this vector to all zeros.
void SetTransform(const b2Vec2 &position, float32 angle)
b2Vec2 c
center world positions
void SetFixedRotation(bool flag)
bool IsValid() const
Does this vector contain finite coordinates?
b2Vec2 localCenter
local center of mass position
float32 b2Cross(const b2Vec2 &a, const b2Vec2 &b)
Perform the cross product on two vectors. In 2D this produces a scalar.
b2Body(const b2BodyDef *bd, b2World *world)
b2Vec2 linearVelocity
The linear velocity of the body's origin in world co-ordinates.
b2JointEdge * m_jointList
float32 angle
The world angle of the body in radians.
bool active
Does this body start out active?
A rigid body. These are created via b2World::CreateBody.
float32 mass
The mass of the shape, usually in kilograms.
void * Allocate(int32 size)
Allocate memory. This will use b2Alloc if the size is larger than b2_maxBlockSize.
void DestroyFixture(b2Fixture *fixture)
bool b2IsValid(float32 x)
This function is used to ensure that a floating point number is not a NaN or infinity.
float32 gravityScale
Scale the gravity applied to this body.
void Destroy(b2BlockAllocator *allocator)
void SetActive(bool flag)
bool awake
Is this body initially awake or sleeping?
float32 density
The density, usually in kg/m^2.
void SetMassData(const b2MassData *data)
bool IsActive() const
Get the active state of the body.
void Dump()
Dump this body to a log file.
void Set(float32 angle)
Set using an angle in radians.
void TouchProxy(int32 proxyId)
Call to trigger a re-processing of it's pairs on the next call to UpdatePairs.
void DestroyProxies(b2BroadPhase *broadPhase)
void CreateProxies(b2BroadPhase *broadPhase, const b2Transform &xf)
float32 m_angularVelocity
b2BlockAllocator m_blockAllocator
bool ShouldCollide(const b2Body *other) const
GLuint GLuint GLsizei GLenum type
This holds the mass data computed for a shape.
b2JointEdge * next
the next joint edge in the body's joint list
void * userData
Use this to store application specific body data.
b2Fixture * m_fixtureList
bool IsLocked() const
Is the world locked (in the middle of a time step).
GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble f