the assert info is this:
System\Error\hkError.cpp(33): [0x2C66F2D8] Error: Reference count error on object 06FE69F0 with ref count of 0 in removeReference.
* Are you calling delete instead of removeReference?
* Have you called removeReference too many times?
* In a multithreaded environment, what is the hkReferencedObject lock mode you use (see setLockMode())?
* Is this a valid object?
* Do you have more than 32768 references? (unlikely)
this is my remove code:
mys3_void MYSAPI mys3_instance_physic_havok_body::mys3RemovePhysicBodys(const mys3_uint* objs_hash,mys3_uint count)
{
m_pWorld->markForWrite();
for (mys3_uint i = 0;i < count;++i)
{
stdext::hash_map<mys3_uint,mys3_physic_body>::iterator it = m_PhysicBodyMap.find(objs_hash[i]);
if(it != m_PhysicBodyMap.end())
{
if (i == (count - 1))
{
DebugBreak();
}
if(it->second.pRigidBody->getWorld())
{
it->second.pRigidBody->getWorld()->removeEntity(it->second.pRigidBody);//while (i == count - 1),it will show me a assert
}
}
stdext::hash_map<hkpShape*,hkpShape*>::iterator itShape = m_PhysicShapeMap.find(it->second.pShape);
if(itShape != m_PhysicShapeMap.end())
{
it->second.pShape->removeReference();
m_PhysicShapeMap.erase(itShape);
}
m_PhysicBodyMap.erase(it);
}
}
m_pWorld->unmarkForWrite();
}
how can i solve this assert?



