xiangaodielian / bullet

Automatically exported from code.google.com/p/bullet
Other
0 stars 0 forks source link

SpuGatheringCollisionDispatcher doesn't work with splitIslands #603

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.use the MultiThreadedDemo
2.comment line 380 in MultithreadedDemo.cpp 
(world->getSimulationIslandManager()->setSplitIslands(false);)
3.start the demo, and wait

What is the expected output? What do you see instead?
I guess the demo should work in multithread, but it crashes instead.

What version of the product are you using? On what operating system?
Bullet revision 2372 on a Windows7 64bits, using VC90

Please provide any additional information below.
After looking for a while, I just guess that split islands and multithreaded 
solvers are not meant to work together. Is it the case ?

In detail:
The error occurs because in a collision pair between a dynalic and a static 
object, the static object has a collisionObject->getCompanionId equal to (-2), 
and is used in btParallelConstraintSolver.cpp (line 1138) as an index in an 
array (which is obviously not valid).

Now the -2 companionId is set by the simulationIslandManager, line 119, when 
the collision object is static or kinematic (which is obviously often the 
case). This companionId should be set back to a correct value in the 
btParallelConstraintSolver::solveGroup method.
But due to split islands, fixed objects never goes trough this process because 
it's not in the island (splitIslands for fixed objects is never changed from 
the initialization value, which is -1)

Original issue reported on code.google.com by yann.pin...@golaem.com on 2 Mar 2012 at 1:48

GoogleCodeExporter commented 9 years ago
Split islands and multithreaded solvers are not meant to work together indeed.
That is why this is explicitly set in the demo. 

We'll look into fixing this for Bullet 3.x.

Original comment by erwin.coumans on 2 Mar 2012 at 6:27