mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
Updated box2d from 2.2.1 to 2.3.0
--HG-- branch : box2d-2.3
This commit is contained in:
@@ -141,10 +141,25 @@ void b2Body::SetType(b2BodyType type)
|
||||
m_force.SetZero();
|
||||
m_torque = 0.0f;
|
||||
|
||||
// Since the body type changed, we need to flag contacts for filtering.
|
||||
// Delete the attached contacts.
|
||||
b2ContactEdge* ce = m_contactList;
|
||||
while (ce)
|
||||
{
|
||||
b2ContactEdge* ce0 = ce;
|
||||
ce = ce->next;
|
||||
m_world->m_contactManager.Destroy(ce0->contact);
|
||||
}
|
||||
m_contactList = NULL;
|
||||
|
||||
// Touch the proxies so that new contacts will be created (when appropriate)
|
||||
b2BroadPhase* broadPhase = &m_world->m_contactManager.m_broadPhase;
|
||||
for (b2Fixture* f = m_fixtureList; f; f = f->m_next)
|
||||
{
|
||||
f->Refilter();
|
||||
int32 proxyCount = f->m_proxyCount;
|
||||
for (int32 i = 0; i < proxyCount; ++i)
|
||||
{
|
||||
broadPhase->TouchProxy(f->m_proxies[i].proxyId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,8 +436,6 @@ void b2Body::SetTransform(const b2Vec2& position, float32 angle)
|
||||
{
|
||||
f->Synchronize(broadPhase, m_xf, m_xf);
|
||||
}
|
||||
|
||||
m_world->m_contactManager.FindNewContacts();
|
||||
}
|
||||
|
||||
void b2Body::SynchronizeFixtures()
|
||||
@@ -483,6 +496,28 @@ void b2Body::SetActive(bool flag)
|
||||
}
|
||||
}
|
||||
|
||||
void b2Body::SetFixedRotation(bool flag)
|
||||
{
|
||||
bool status = (m_flags & e_fixedRotationFlag) == e_fixedRotationFlag;
|
||||
if (status == flag)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
m_flags |= e_fixedRotationFlag;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_flags &= ~e_fixedRotationFlag;
|
||||
}
|
||||
|
||||
m_angularVelocity = 0.0f;
|
||||
|
||||
ResetMassData();
|
||||
}
|
||||
|
||||
void b2Body::Dump()
|
||||
{
|
||||
int32 bodyIndex = m_islandIndex;
|
||||
@@ -511,4 +546,4 @@ void b2Body::Dump()
|
||||
b2Log(" }\n");
|
||||
}
|
||||
b2Log("}\n");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user