aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/ubOde
diff options
context:
space:
mode:
authorUbitUmarov2016-08-19 21:28:40 +0100
committerUbitUmarov2016-08-19 21:28:40 +0100
commit6ad0f3250b31c392560af70330269ab7db9664a6 (patch)
tree9e06ec6afa7932c4bb3b53d865c246176bb2609e /OpenSim/Region/PhysicsModules/ubOde
parent on sog unlink loose the reference to the deleted physics actor (diff)
downloadopensim-SC-6ad0f3250b31c392560af70330269ab7db9664a6.zip
opensim-SC-6ad0f3250b31c392560af70330269ab7db9664a6.tar.gz
opensim-SC-6ad0f3250b31c392560af70330269ab7db9664a6.tar.bz2
opensim-SC-6ad0f3250b31c392560af70330269ab7db9664a6.tar.xz
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
Diffstat (limited to 'OpenSim/Region/PhysicsModules/ubOde')
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs15
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs19
2 files changed, 28 insertions, 6 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
index 6f2cbbe..4adf87e 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
@@ -306,7 +306,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
306 public override uint LocalID 306 public override uint LocalID
307 { 307 {
308 get { return m_localID; } 308 get { return m_localID; }
309 set { m_localID = value; } 309 set
310 {
311 uint oldid = m_localID;
312 m_localID = value;
313 _parent_scene.changePrimID(this, oldid);
314 }
310 } 315 }
311 316
312 public override PhysicsActor ParentActor 317 public override PhysicsActor ParentActor
@@ -1066,8 +1071,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1066 public OdePrim(String primName, ODEScene parent_scene, Vector3 pos, Vector3 size, 1071 public OdePrim(String primName, ODEScene parent_scene, Vector3 pos, Vector3 size,
1067 Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical,bool pisPhantom,byte _shapeType,uint plocalID) 1072 Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical,bool pisPhantom,byte _shapeType,uint plocalID)
1068 { 1073 {
1074 _parent_scene = parent_scene;
1075
1069 Name = primName; 1076 Name = primName;
1070 LocalID = plocalID; 1077 m_localID = plocalID;
1071 1078
1072 m_vehicle = null; 1079 m_vehicle = null;
1073 1080
@@ -1113,7 +1120,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1113 1120
1114 _pbs = pbs; 1121 _pbs = pbs;
1115 1122
1116 _parent_scene = parent_scene;
1117 m_targetSpace = IntPtr.Zero; 1123 m_targetSpace = IntPtr.Zero;
1118 1124
1119 if (pos.Z < 0) 1125 if (pos.Z < 0)
@@ -1159,6 +1165,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1159 m_OBBOffset = repData.OBBOffset; 1165 m_OBBOffset = repData.OBBOffset;
1160 1166
1161 UpdatePrimBodyData(); 1167 UpdatePrimBodyData();
1168
1169 AddChange(changes.Add, null);
1162 } 1170 }
1163 1171
1164 private void resetCollisionAccounting() 1172 private void resetCollisionAccounting()
@@ -2441,6 +2449,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2441 2449
2442 private void changeadd() 2450 private void changeadd()
2443 { 2451 {
2452 _parent_scene.addToPrims(this);
2444 } 2453 }
2445 2454
2446 private void changeAngularLock(byte newLocks) 2455 private void changeAngularLock(byte newLocks)
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
index 6c5b405..623e6be 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
@@ -1328,8 +1328,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1328 { 1328 {
1329 1329
1330 newPrim = new OdePrim(name, this, position, size, rotation, pbs, isphysical, isPhantom, shapeType, localID); 1330 newPrim = new OdePrim(name, this, position, size, rotation, pbs, isphysical, isPhantom, shapeType, localID);
1331 lock (_prims)
1332 _prims[newPrim.LocalID] = newPrim;
1333 } 1331 }
1334 return newPrim; 1332 return newPrim;
1335 } 1333 }
@@ -1350,7 +1348,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1350 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, 1348 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
1351 Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapeType, uint localid) 1349 Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapeType, uint localid)
1352 { 1350 {
1353
1354 return AddPrim(primName, position, size, rotation, pbs, isPhysical,isPhantom, shapeType, localid); 1351 return AddPrim(primName, position, size, rotation, pbs, isPhysical,isPhantom, shapeType, localid);
1355 } 1352 }
1356 1353
@@ -1396,6 +1393,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1396 1393
1397 } 1394 }
1398 1395
1396 public void addToPrims(OdePrim prim)
1397 {
1398 lock (_prims)
1399 _prims[prim.LocalID] = prim;
1400 }
1401
1399 public OdePrim getPrim(uint id) 1402 public OdePrim getPrim(uint id)
1400 { 1403 {
1401 lock (_prims) 1404 lock (_prims)
@@ -1413,6 +1416,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1413 return _prims.ContainsKey(prm.LocalID); 1416 return _prims.ContainsKey(prm.LocalID);
1414 } 1417 }
1415 1418
1419 public void changePrimID(OdePrim prim,uint oldID)
1420 {
1421 lock (_prims)
1422 {
1423 if(_prims.ContainsKey(oldID))
1424 _prims.Remove(oldID);
1425 _prims[prim.LocalID] = prim;
1426 }
1427 }
1428
1416 public bool haveActor(PhysicsActor actor) 1429 public bool haveActor(PhysicsActor actor)
1417 { 1430 {
1418 if (actor is OdePrim) 1431 if (actor is OdePrim)