how to remove physics world

how to remove physics world

Hi, all

I have create a physics world , and then I want to remove it like this:

hkReferencedObject::lockAll();
if(m_pWorld)
{
//m_pWorld->markForWrite();
m_pWorld->removeReference();//break point here
m_pWorld = HK_NULL;
}
hkReferencedObject::unlockAll();

the code bring a break point. can anyone tell me how to remove a physics wolrd. 

thanks!

3 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.
imagem de havok_David

Hey 205dsm126dotcom,

Here are a couple of thoughts as to what is happening:

1) The "m_pWorld->markForWrite();" line in your code should not be commented out. Would the breakpoint happen there if you uncommented that line?
2) What is the reference count before you call "m_pWorld->removeReference();" ? Is it 0 or negative?
3) If you are using Multi-Threading you have to make sure that your m_pWorld be created and removed from the same thread.
4) What happens if you don't call hkReferencedObject::lockAll();/hkReferencedObject::unlockAll(); ?
5) What is your lock mode (ie.: what does "hkReferencedObject::getLockMode()" return? ) just before executing the breaking line?

Note: Look at the destroyWorld() function in Demo\Demos\DemoCommon\DemoFramework\hkDefaultPhysicsDemo.cpp. If you call that exact function in your code, does it still break?

Please let me know if any of the above helped in solving your issue. If not, is there a message with your break-point?

Cheers,
David.

David G. Developer Support Engineer Havok www.havok.com

here i have the same code and it works.
but here i have uncommented the markForWrite line.

didn't worked for you?

Faça login para deixar um comentário.