aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/ODEPrim.cs')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs63
1 files changed, 37 insertions, 26 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 61408f0..e90df48 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -1352,7 +1352,7 @@ Console.WriteLine("ZProcessTaints for " + Name);
1352 } 1352 }
1353 1353
1354 /// <summary> 1354 /// <summary>
1355 /// Create a geometry for the given mesh/shape in the given target space. 1355 /// Create a geometry for the given mesh in the given target space.
1356 /// </summary> 1356 /// </summary>
1357 /// <param name="m_targetSpace"></param> 1357 /// <param name="m_targetSpace"></param>
1358 /// <param name="mesh">If null, then a mesh is used that is based on the profile shape data.</param> 1358 /// <param name="mesh">If null, then a mesh is used that is based on the profile shape data.</param>
@@ -1436,6 +1436,36 @@ Console.WriteLine("CreateGeom:");
1436 } 1436 }
1437 } 1437 }
1438 1438
1439 /// <summary>
1440 /// Remove the existing geom from this prim.
1441 /// </summary>
1442 /// <param name="m_targetSpace"></param>
1443 /// <param name="mesh">If null, then a mesh is used that is based on the profile shape data.</param>
1444 /// <returns>true if the geom was successfully removed, false if it was already gone or the remove failed.</returns>
1445 public bool RemoveGeom()
1446 {
1447 if (prim_geom != IntPtr.Zero)
1448 {
1449 try
1450 {
1451 d.GeomDestroy(prim_geom);
1452 prim_geom = IntPtr.Zero;
1453 }
1454 catch (System.AccessViolationException)
1455 {
1456 prim_geom = IntPtr.Zero;
1457 m_log.ErrorFormat("[PHYSICS]: PrimGeom dead for {0}", Name);
1458 return false;
1459 }
1460
1461 return true;
1462 }
1463 else
1464 {
1465 return false;
1466 }
1467 }
1468
1439 public void changeadd(float timestep) 1469 public void changeadd(float timestep)
1440 { 1470 {
1441 int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position); 1471 int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position);
@@ -1880,19 +1910,8 @@ Console.WriteLine(" JointCreateFixed");
1880 { 1910 {
1881 if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim) 1911 if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim)
1882 { 1912 {
1883 if (prim_geom != IntPtr.Zero) 1913 RemoveGeom();
1884 { 1914
1885 try
1886 {
1887 d.GeomDestroy(prim_geom);
1888 prim_geom = IntPtr.Zero;
1889 }
1890 catch (System.AccessViolationException)
1891 {
1892 prim_geom = IntPtr.Zero;
1893 m_log.ErrorFormat("[PHYSICS]: PrimGeom dead for {0}", Name);
1894 }
1895 }
1896//Console.WriteLine("changePhysicsStatus for " + Name); 1915//Console.WriteLine("changePhysicsStatus for " + Name);
1897 changeadd(2f); 1916 changeadd(2f);
1898 } 1917 }
@@ -1953,8 +1972,8 @@ Console.WriteLine(" JointCreateFixed");
1953 d.SpaceRemove(m_targetSpace, prim_geom); 1972 d.SpaceRemove(m_targetSpace, prim_geom);
1954 } 1973 }
1955 1974
1956 d.GeomDestroy(prim_geom); 1975 RemoveGeom();
1957 prim_geom = IntPtr.Zero; 1976
1958 // we don't need to do space calculation because the client sends a position update also. 1977 // we don't need to do space calculation because the client sends a position update also.
1959 1978
1960 IMesh mesh = null; 1979 IMesh mesh = null;
@@ -2044,17 +2063,9 @@ Console.WriteLine(" JointCreateFixed");
2044 disableBody(); 2063 disableBody();
2045 } 2064 }
2046 } 2065 }
2047 try
2048 {
2049 d.GeomDestroy(prim_geom);
2050 }
2051 catch (System.AccessViolationException)
2052 {
2053 prim_geom = IntPtr.Zero;
2054 m_log.ErrorFormat("[PHYSICS]: PrimGeom dead for {0}", Name);
2055 }
2056 2066
2057 prim_geom = IntPtr.Zero; 2067 RemoveGeom();
2068
2058 // we don't need to do space calculation because the client sends a position update also. 2069 // we don't need to do space calculation because the client sends a position update also.
2059 if (_size.X <= 0) _size.X = 0.01f; 2070 if (_size.X <= 0) _size.X = 0.01f;
2060 if (_size.Y <= 0) _size.Y = 0.01f; 2071 if (_size.Y <= 0) _size.Y = 0.01f;