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