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.cs52
1 files changed, 34 insertions, 18 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index bc839e0..b63168a 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -38,6 +38,9 @@
38 * switch between 'VEHICLE' parameter use and general dynamics 38 * switch between 'VEHICLE' parameter use and general dynamics
39 * settings use. 39 * settings use.
40 */ 40 */
41
42//#define SPAM
43
41using System; 44using System;
42using System.Collections.Generic; 45using System.Collections.Generic;
43using System.Reflection; 46using System.Reflection;
@@ -746,7 +749,6 @@ namespace OpenSim.Region.Physics.OdePlugin
746 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); 749 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
747 } 750 }
748 751
749
750 d.BodyDestroy(Body); 752 d.BodyDestroy(Body);
751 lock (childrenPrim) 753 lock (childrenPrim)
752 { 754 {
@@ -775,7 +777,6 @@ namespace OpenSim.Region.Physics.OdePlugin
775 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); 777 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
776 } 778 }
777 779
778
779 Body = IntPtr.Zero; 780 Body = IntPtr.Zero;
780 } 781 }
781 } 782 }
@@ -858,7 +859,7 @@ namespace OpenSim.Region.Physics.OdePlugin
858 859
859 public void ProcessTaints(float timestep) 860 public void ProcessTaints(float timestep)
860 { 861 {
861//Console.WriteLine("ProcessTaints for " + Name); 862Console.WriteLine("ProcessTaints for " + Name);
862 if (m_taintadd) 863 if (m_taintadd)
863 { 864 {
864 changeadd(timestep); 865 changeadd(timestep);
@@ -867,7 +868,7 @@ namespace OpenSim.Region.Physics.OdePlugin
867 if (prim_geom != IntPtr.Zero) 868 if (prim_geom != IntPtr.Zero)
868 { 869 {
869 if (!_position.ApproxEquals(m_taintposition, 0f)) 870 if (!_position.ApproxEquals(m_taintposition, 0f))
870 changemove(timestep); 871 changemove(timestep);
871 872
872 if (m_taintrot != _orientation) 873 if (m_taintrot != _orientation)
873 { 874 {
@@ -885,19 +886,15 @@ namespace OpenSim.Region.Physics.OdePlugin
885 rotate(timestep); 886 rotate(timestep);
886 } 887 }
887 } 888 }
888 //
889 889
890 if (m_taintPhysics != m_isphysical && !(m_taintparent != _parent)) 890 if (m_taintPhysics != m_isphysical && !(m_taintparent != _parent))
891 changePhysicsStatus(timestep); 891 changePhysicsStatus(timestep);
892 //
893 892
894 if (!_size.ApproxEquals(m_taintsize,0f)) 893 if (!_size.ApproxEquals(m_taintsize, 0f))
895 changesize(timestep); 894 changesize(timestep);
896 //
897 895
898 if (m_taintshape) 896 if (m_taintshape)
899 changeshape(timestep); 897 changeshape(timestep);
900 //
901 898
902 if (m_taintforce) 899 if (m_taintforce)
903 changeAddForce(timestep); 900 changeAddForce(timestep);
@@ -925,7 +922,6 @@ namespace OpenSim.Region.Physics.OdePlugin
925 922
926 if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f)) 923 if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f))
927 changeAngularLock(timestep); 924 changeAngularLock(timestep);
928
929 } 925 }
930 else 926 else
931 { 927 {
@@ -1424,10 +1420,11 @@ namespace OpenSim.Region.Physics.OdePlugin
1424 } 1420 }
1425 } 1421 }
1426 1422
1427
1428 lock (_parent_scene.OdeLock) 1423 lock (_parent_scene.OdeLock)
1429 { 1424 {
1430//Console.WriteLine("changeadd 1"); 1425#if SPAM
1426Console.WriteLine("changeadd 1");
1427#endif
1431 CreateGeom(m_targetSpace, _mesh); 1428 CreateGeom(m_targetSpace, _mesh);
1432 1429
1433 if (prim_geom != IntPtr.Zero) 1430 if (prim_geom != IntPtr.Zero)
@@ -1890,6 +1887,10 @@ Console.WriteLine(" JointCreateFixed");
1890 1887
1891 public void changesize(float timestamp) 1888 public void changesize(float timestamp)
1892 { 1889 {
1890#if SPAM
1891 m_log.DebugFormat("[ODE PRIM]: Called changesize");
1892#endif
1893
1893 string oldname = _parent_scene.geom_name_map[prim_geom]; 1894 string oldname = _parent_scene.geom_name_map[prim_geom];
1894 1895
1895 if (_size.X <= 0) _size.X = 0.01f; 1896 if (_size.X <= 0) _size.X = 0.01f;
@@ -1899,8 +1900,9 @@ Console.WriteLine(" JointCreateFixed");
1899 // Cleanup of old prim geometry 1900 // Cleanup of old prim geometry
1900 if (_mesh != null) 1901 if (_mesh != null)
1901 { 1902 {
1902 // Cleanup meshing here 1903 // TODO: Cleanup meshing here
1903 } 1904 }
1905
1904 //kill body to rebuild 1906 //kill body to rebuild
1905 if (IsPhysical && Body != IntPtr.Zero) 1907 if (IsPhysical && Body != IntPtr.Zero)
1906 { 1908 {
@@ -1917,11 +1919,13 @@ Console.WriteLine(" JointCreateFixed");
1917 disableBody(); 1919 disableBody();
1918 } 1920 }
1919 } 1921 }
1922
1920 if (d.SpaceQuery(m_targetSpace, prim_geom)) 1923 if (d.SpaceQuery(m_targetSpace, prim_geom))
1921 { 1924 {
1922 _parent_scene.waitForSpaceUnlock(m_targetSpace); 1925 _parent_scene.waitForSpaceUnlock(m_targetSpace);
1923 d.SpaceRemove(m_targetSpace, prim_geom); 1926 d.SpaceRemove(m_targetSpace, prim_geom);
1924 } 1927 }
1928
1925 d.GeomDestroy(prim_geom); 1929 d.GeomDestroy(prim_geom);
1926 prim_geom = IntPtr.Zero; 1930 prim_geom = IntPtr.Zero;
1927 // we don't need to do space calculation because the client sends a position update also. 1931 // we don't need to do space calculation because the client sends a position update also.
@@ -1941,13 +1945,19 @@ Console.WriteLine(" JointCreateFixed");
1941 mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); 1945 mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
1942 1946
1943 //IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); 1947 //IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
1944//Console.WriteLine("changesize 1"); 1948#if SPAM
1949Console.WriteLine("changesize 1");
1950#endif
1945 CreateGeom(m_targetSpace, mesh); 1951 CreateGeom(m_targetSpace, mesh);
1946 } 1952 }
1947 else 1953 else
1948 { 1954 {
1949 _mesh = null; 1955 _mesh = null;
1950//Console.WriteLine("changesize 2"); 1956
1957#if SPAM
1958Console.WriteLine("changesize 2");
1959#endif
1960
1951 CreateGeom(m_targetSpace, _mesh); 1961 CreateGeom(m_targetSpace, _mesh);
1952 } 1962 }
1953 1963
@@ -2030,6 +2040,7 @@ Console.WriteLine(" JointCreateFixed");
2030 prim_geom = IntPtr.Zero; 2040 prim_geom = IntPtr.Zero;
2031 m_log.ErrorFormat("[PHYSICS]: PrimGeom dead for {0}", Name); 2041 m_log.ErrorFormat("[PHYSICS]: PrimGeom dead for {0}", Name);
2032 } 2042 }
2043
2033 prim_geom = IntPtr.Zero; 2044 prim_geom = IntPtr.Zero;
2034 // we don't need to do space calculation because the client sends a position update also. 2045 // we don't need to do space calculation because the client sends a position update also.
2035 if (_size.X <= 0) _size.X = 0.01f; 2046 if (_size.X <= 0) _size.X = 0.01f;
@@ -2039,7 +2050,7 @@ Console.WriteLine(" JointCreateFixed");
2039 2050
2040 if (_parent_scene.needsMeshing(_pbs)) 2051 if (_parent_scene.needsMeshing(_pbs))
2041 { 2052 {
2042 // Don't need to re-enable body.. it's done in SetMesh 2053 // Don't need to re-enable body.. it's done in CreateMesh
2043 float meshlod = _parent_scene.meshSculptLOD; 2054 float meshlod = _parent_scene.meshSculptLOD;
2044 2055
2045 if (IsPhysical) 2056 if (IsPhysical)
@@ -2047,13 +2058,18 @@ Console.WriteLine(" JointCreateFixed");
2047 2058
2048 IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); 2059 IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
2049 // createmesh returns null when it doesn't mesh. 2060 // createmesh returns null when it doesn't mesh.
2050//Console.WriteLine("changeshape needed meshing"); 2061#if SPAM
2062Console.WriteLine("changeshape needed meshing");
2063#endif
2051 CreateGeom(m_targetSpace, mesh); 2064 CreateGeom(m_targetSpace, mesh);
2052 } 2065 }
2053 else 2066 else
2054 { 2067 {
2055 _mesh = null; 2068 _mesh = null;
2056//Console.WriteLine("changeshape not need meshing"); 2069
2070#if SPAM
2071Console.WriteLine("changeshape not need meshing");
2072#endif
2057 CreateGeom(m_targetSpace, null); 2073 CreateGeom(m_targetSpace, null);
2058 } 2074 }
2059 2075