Using the parallel dispatcher (on windows using bullet 2.76), the gContactAddedCallback isn't called for all collisions with bodies flagged CF_CUSTOM_MATERIAL_CALLBACK. Only collisions between certain bodies is gContactAddedCallback called. However, if I use the regular non-parallel dispatcher then everything works great. Any suggestions?
Thanks
gContactAddedCallback doesn't work with parallel dispatcher
-
btomko
- Posts: 11
- Joined: Mon Aug 31, 2009 9:05 pm
-
btomko
- Posts: 11
- Joined: Mon Aug 31, 2009 9:05 pm
Re: gContactAddedCallback doesn't work with parallel dispatc
I worked around the problem a little bit. Since I have two separate chambers in which physics occur, I made two separate btdiscretedynamicsworlds in which to control each chamber, and I run them in parallel (one in the main thread and one in a new thread). So in the main thread, I can do:
dynamicsWorld1->stepSimulation(...);
dynamicsWorld1->updateAabbs();
wait for thread 2 to complete
and in the second thread I can do:
dynamicsWorld2->stepSimulation(...);
dynamicsWorld2->updateAabbs();
The second thread however created a problem. It caused a nice steady linear memory leak and cpu usage increase which I could watch in the windows task manager. If I eliminated the second thread and put its code in the main thread, the problem went away.
dynamicsWorld1->stepSimulation(...);
dynamicsWorld1->updateAabbs();
dynamicsWorld2->stepSimulation(...);
dynamicsWorld2->updateAabbs();
I did however fix the problem with the second thread. In the bullet physics library under LinearMath/btQuickprof.h I had to:
#define BT_NO_PROFILE 1
dynamicsWorld1->stepSimulation(...);
dynamicsWorld1->updateAabbs();
wait for thread 2 to complete
and in the second thread I can do:
dynamicsWorld2->stepSimulation(...);
dynamicsWorld2->updateAabbs();
The second thread however created a problem. It caused a nice steady linear memory leak and cpu usage increase which I could watch in the windows task manager. If I eliminated the second thread and put its code in the main thread, the problem went away.
dynamicsWorld1->stepSimulation(...);
dynamicsWorld1->updateAabbs();
dynamicsWorld2->stepSimulation(...);
dynamicsWorld2->updateAabbs();
I did however fix the problem with the second thread. In the bullet physics library under LinearMath/btQuickprof.h I had to:
#define BT_NO_PROFILE 1
-
btomko
- Posts: 11
- Joined: Mon Aug 31, 2009 9:05 pm
Re: gContactAddedCallback doesn't work with parallel dispatc
The problem still is not fixed with the parallel dispatcher and gContactAddedCallback as of the new bullet 2.77 compiled on windows. I will try the parallel solver later and see if that works better.
-
Erwin Coumans
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: gContactAddedCallback doesn't work with parallel dispatc
The gContactAddedCallback doesn't work for the parallel dispatcher, because that dispatcher was designed for SPUs, with no direct communication with CPU.
We'll revisit this mechanism for Bullet 3.x. If you need it sooner, it is best to modify the source code.
Thanks,
Erwin
We'll revisit this mechanism for Bullet 3.x. If you need it sooner, it is best to modify the source code.
Thanks,
Erwin