fix ubOde prims unlink that got broken fixing sleeping bodies collisions, core removes and adds a prim with same LocalID not giving time for physics to actuly delete, so when it did it LocalID was lost

LSLKeyTest
UbitUmarov 2016-08-19 21:28:40 +01:00
parent d386bfa1b6
commit 6ad0f3250b
2 changed files with 28 additions and 6 deletions

View File

@ -306,7 +306,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
public override uint LocalID
{
get { return m_localID; }
set { m_localID = value; }
set
{
uint oldid = m_localID;
m_localID = value;
_parent_scene.changePrimID(this, oldid);
}
}
public override PhysicsActor ParentActor
@ -1066,8 +1071,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
public OdePrim(String primName, ODEScene parent_scene, Vector3 pos, Vector3 size,
Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical,bool pisPhantom,byte _shapeType,uint plocalID)
{
_parent_scene = parent_scene;
Name = primName;
LocalID = plocalID;
m_localID = plocalID;
m_vehicle = null;
@ -1113,7 +1120,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
_pbs = pbs;
_parent_scene = parent_scene;
m_targetSpace = IntPtr.Zero;
if (pos.Z < 0)
@ -1159,6 +1165,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
m_OBBOffset = repData.OBBOffset;
UpdatePrimBodyData();
AddChange(changes.Add, null);
}
private void resetCollisionAccounting()
@ -2441,6 +2449,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
private void changeadd()
{
_parent_scene.addToPrims(this);
}
private void changeAngularLock(byte newLocks)

View File

@ -1328,8 +1328,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
newPrim = new OdePrim(name, this, position, size, rotation, pbs, isphysical, isPhantom, shapeType, localID);
lock (_prims)
_prims[newPrim.LocalID] = newPrim;
}
return newPrim;
}
@ -1350,7 +1348,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapeType, uint localid)
{
return AddPrim(primName, position, size, rotation, pbs, isPhysical,isPhantom, shapeType, localid);
}
@ -1396,6 +1393,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
public void addToPrims(OdePrim prim)
{
lock (_prims)
_prims[prim.LocalID] = prim;
}
public OdePrim getPrim(uint id)
{
lock (_prims)
@ -1413,6 +1416,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
return _prims.ContainsKey(prm.LocalID);
}
public void changePrimID(OdePrim prim,uint oldID)
{
lock (_prims)
{
if(_prims.ContainsKey(oldID))
_prims.Remove(oldID);
_prims[prim.LocalID] = prim;
}
}
public bool haveActor(PhysicsActor actor)
{
if (actor is OdePrim)