Delete world body contacts if world gets detached.
This commit is contained in:
parent
fe6c2a3b0e
commit
1876592d22
@ -204,11 +204,6 @@ inline b3Vec3 b3Cloth::GetGravity() const
|
|||||||
return m_gravity;
|
return m_gravity;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void b3Cloth::SetWorld(b3World* world)
|
|
||||||
{
|
|
||||||
m_world = world;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const b3World* b3Cloth::GetWorld() const
|
inline const b3World* b3Cloth::GetWorld() const
|
||||||
{
|
{
|
||||||
return m_world;
|
return m_world;
|
||||||
|
@ -293,6 +293,23 @@ b3Cloth::~b3Cloth()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void b3Cloth::SetWorld(b3World* world)
|
||||||
|
{
|
||||||
|
if (!world && m_world)
|
||||||
|
{
|
||||||
|
// Destroy body contacts
|
||||||
|
b3ParticleBodyContact* c = m_contactManager.m_particleBodyContactList.m_head;
|
||||||
|
while (c)
|
||||||
|
{
|
||||||
|
b3ParticleBodyContact* boom = c;
|
||||||
|
c = c->m_next;
|
||||||
|
m_contactManager.Destroy(boom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_world = world;
|
||||||
|
}
|
||||||
|
|
||||||
b3Particle* b3Cloth::CreateParticle(const b3ParticleDef& def)
|
b3Particle* b3Cloth::CreateParticle(const b3ParticleDef& def)
|
||||||
{
|
{
|
||||||
void* mem = m_particleBlocks.Allocate();
|
void* mem = m_particleBlocks.Allocate();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user