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)
|
lock (CollisionLock)
|
||||||
{
|
{
|
||||||
if (collidersCount > 0)
|
if (collidersCount > 0)
|
||||||
|
{
|
||||||
|
lock (PhysObjects)
|
||||||
{
|
{
|
||||||
for (int ii = 0; ii < collidersCount; ii++)
|
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
|
// 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.
|
// and remember that there was a change so it will be passed to the simulator.
|
||||||
lock (UpdateLock)
|
lock (UpdateLock)
|
||||||
{
|
{
|
||||||
if (updatedEntityCount > 0)
|
if (updatedEntityCount > 0)
|
||||||
|
{
|
||||||
|
lock (PhysObjects)
|
||||||
{
|
{
|
||||||
for (int ii = 0; ii < updatedEntityCount; ii++)
|
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.
|
// Some actors want to know when the simulation step is complete.
|
||||||
TriggerPostStepEvent(timeStep);
|
TriggerPostStepEvent(timeStep);
|
||||||
|
|
Loading…
Reference in New Issue