BulletSim: add locking of PhysObjects while processing simulation

step updates and collisions. This is an attempt to fix a crash reported
by Justin when doing high velocity teleports.
bullet-2.82
Robert Adams 2014-05-26 20:29:45 -07:00
parent d2877b9cd4
commit fab0389cb1
1 changed files with 20 additions and 14 deletions

View File

@ -638,6 +638,8 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
lock (CollisionLock)
{
if (collidersCount > 0)
{
lock (PhysObjects)
{
for (int ii = 0; ii < collidersCount; ii++)
{
@ -651,12 +653,15 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
}
}
}
}
// If any of the objects had updated properties, tell the managed objects about the update
// and remember that there was a change so it will be passed to the simulator.
lock (UpdateLock)
{
if (updatedEntityCount > 0)
{
lock (PhysObjects)
{
for (int ii = 0; ii < updatedEntityCount; ii++)
{
@ -670,6 +675,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
}
}
}
}
// Some actors want to know when the simulation step is complete.
TriggerPostStepEvent(timeStep);