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
|
@ -639,15 +639,18 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
{
|
{
|
||||||
if (collidersCount > 0)
|
if (collidersCount > 0)
|
||||||
{
|
{
|
||||||
for (int ii = 0; ii < collidersCount; ii++)
|
lock (PhysObjects)
|
||||||
{
|
{
|
||||||
uint cA = m_collisionArray[ii].aID;
|
for (int ii = 0; ii < collidersCount; ii++)
|
||||||
uint cB = m_collisionArray[ii].bID;
|
{
|
||||||
Vector3 point = m_collisionArray[ii].point;
|
uint cA = m_collisionArray[ii].aID;
|
||||||
Vector3 normal = m_collisionArray[ii].normal;
|
uint cB = m_collisionArray[ii].bID;
|
||||||
float penetration = m_collisionArray[ii].penetration;
|
Vector3 point = m_collisionArray[ii].point;
|
||||||
SendCollision(cA, cB, point, normal, penetration);
|
Vector3 normal = m_collisionArray[ii].normal;
|
||||||
SendCollision(cB, cA, point, -normal, penetration);
|
float penetration = m_collisionArray[ii].penetration;
|
||||||
|
SendCollision(cA, cB, point, normal, penetration);
|
||||||
|
SendCollision(cB, cA, point, -normal, penetration);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -658,14 +661,17 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
{
|
{
|
||||||
if (updatedEntityCount > 0)
|
if (updatedEntityCount > 0)
|
||||||
{
|
{
|
||||||
for (int ii = 0; ii < updatedEntityCount; ii++)
|
lock (PhysObjects)
|
||||||
{
|
{
|
||||||
EntityProperties entprop = m_updateArray[ii];
|
for (int ii = 0; ii < updatedEntityCount; ii++)
|
||||||
BSPhysObject pobj;
|
|
||||||
if (PhysObjects.TryGetValue(entprop.ID, out pobj))
|
|
||||||
{
|
{
|
||||||
if (pobj.IsInitialized)
|
EntityProperties entprop = m_updateArray[ii];
|
||||||
pobj.UpdateProperties(entprop);
|
BSPhysObject pobj;
|
||||||
|
if (PhysObjects.TryGetValue(entprop.ID, out pobj))
|
||||||
|
{
|
||||||
|
if (pobj.IsInitialized)
|
||||||
|
pobj.UpdateProperties(entprop);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue