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:

m_pWorld->removeReference();//break point here
m_pWorld = HK_NULL;

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


3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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?


David G.
Developer Support Engineer

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

didn't worked for you?

Leave a Comment

Please sign in to add a comment. Not a member? Join today