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
parent
d2877b9cd4
commit
fab0389cb1
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue