aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs7
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs7
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs42
3 files changed, 24 insertions, 32 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
index ca294b8..1084b0e 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
@@ -784,8 +784,6 @@ namespace OpenSim.Region.Physics.OdePlugin
784 784
785 // the Amotor still lets avatar rotation to drift during colisions 785 // the Amotor still lets avatar rotation to drift during colisions
786 // so force it back to identity 786 // so force it back to identity
787
788
789 787
790 d.Quaternion qtmp; 788 d.Quaternion qtmp;
791 qtmp.W = 1; 789 qtmp.W = 1;
@@ -1177,9 +1175,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1177 internal void AddCollisionFrameTime(int t) 1175 internal void AddCollisionFrameTime(int t)
1178 { 1176 {
1179 // protect it from overflow crashing 1177 // protect it from overflow crashing
1180 if (m_cureventsubscription + t >= int.MaxValue) 1178 if (m_cureventsubscription < 50000)
1181 m_cureventsubscription = 0; 1179 m_cureventsubscription += t;
1182 m_cureventsubscription += t;
1183 } 1180 }
1184 1181
1185 public override bool SubscribedEvents() 1182 public override bool SubscribedEvents()
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
index b2af180..62fd279 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
@@ -987,11 +987,10 @@ namespace OpenSim.Region.Physics.OdePlugin
987 987
988 internal void AddCollisionFrameTime(int t) 988 internal void AddCollisionFrameTime(int t)
989 { 989 {
990 // protect it from overflow crashing 990 if (m_cureventsubscription < 50000)
991 if (m_cureventsubscription + t >= int.MaxValue) 991 m_cureventsubscription += t;
992 m_cureventsubscription = 0;
993 m_cureventsubscription += t;
994 } 992 }
993
995 public override bool SubscribedEvents() 994 public override bool SubscribedEvents()
996 { 995 {
997 if (m_eventsubscription > 0) 996 if (m_eventsubscription > 0)
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
index 0f341b9..bfcfd21 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
@@ -190,6 +190,7 @@ namespace OpenSim.Region.Physics.OdePlugin
190 190
191 public float ODE_STEPSIZE = 0.020f; 191 public float ODE_STEPSIZE = 0.020f;
192 public float HalfOdeStep = 0.01f; 192 public float HalfOdeStep = 0.01f;
193 public int odetimestepMS = 20; // rounded
193 private float metersInSpace = 25.6f; 194 private float metersInSpace = 25.6f;
194 private float m_timeDilation = 1.0f; 195 private float m_timeDilation = 1.0f;
195 196
@@ -490,6 +491,7 @@ namespace OpenSim.Region.Physics.OdePlugin
490 } 491 }
491 492
492 HalfOdeStep = ODE_STEPSIZE * 0.5f; 493 HalfOdeStep = ODE_STEPSIZE * 0.5f;
494 odetimestepMS = (int)(1000.0f * ODE_STEPSIZE +0.5f);
493 495
494 ContactgeomsArray = Marshal.AllocHGlobal(contactsPerCollision * d.ContactGeom.unmanagedSizeOf); 496 ContactgeomsArray = Marshal.AllocHGlobal(contactsPerCollision * d.ContactGeom.unmanagedSizeOf);
495 GlobalContactsArray = GlobalContactsArray = Marshal.AllocHGlobal(maxContactsbeforedeath * d.Contact.unmanagedSizeOf); 497 GlobalContactsArray = GlobalContactsArray = Marshal.AllocHGlobal(maxContactsbeforedeath * d.Contact.unmanagedSizeOf);
@@ -1827,7 +1829,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1827 { 1829 {
1828 int ttmpstart = Util.EnvironmentTickCount(); 1830 int ttmpstart = Util.EnvironmentTickCount();
1829 int ttmp; 1831 int ttmp;
1830 int ttmp2;
1831 1832
1832 while(ChangesQueue.Dequeue(out item)) 1833 while(ChangesQueue.Dequeue(out item))
1833 { 1834 {
@@ -1849,11 +1850,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1849 if (ttmp > 20) 1850 if (ttmp > 20)
1850 break; 1851 break;
1851 } 1852 }
1852
1853 ttmp2 = Util.EnvironmentTickCountSubtract(ttmpstart);
1854 if (ttmp2 > 50)
1855 ttmp2 = 0;
1856
1857 } 1853 }
1858 1854
1859 // Move characters 1855 // Move characters
@@ -1899,7 +1895,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1899 { 1895 {
1900 case ActorTypes.Agent: 1896 case ActorTypes.Agent:
1901 OdeCharacter cobj = (OdeCharacter)obj; 1897 OdeCharacter cobj = (OdeCharacter)obj;
1902 cobj.AddCollisionFrameTime((int)(ODE_STEPSIZE * 1000.0f)); 1898 cobj.AddCollisionFrameTime((int)(odetimestepMS));
1903 cobj.SendCollisions(); 1899 cobj.SendCollisions();
1904 break; 1900 break;
1905 1901
@@ -1907,7 +1903,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1907 OdePrim pobj = (OdePrim)obj; 1903 OdePrim pobj = (OdePrim)obj;
1908 if (pobj.Body == IntPtr.Zero || (d.BodyIsEnabled(pobj.Body) && !pobj.m_outbounds)) 1904 if (pobj.Body == IntPtr.Zero || (d.BodyIsEnabled(pobj.Body) && !pobj.m_outbounds))
1909 { 1905 {
1910 pobj.AddCollisionFrameTime((int)(ODE_STEPSIZE * 1000.0f)); 1906 pobj.AddCollisionFrameTime((int)(odetimestepMS));
1911 pobj.SendCollisions(); 1907 pobj.SendCollisions();
1912 } 1908 }
1913 break; 1909 break;
@@ -1924,21 +1920,21 @@ namespace OpenSim.Region.Physics.OdePlugin
1924 d.JointGroupEmpty(contactgroup); 1920 d.JointGroupEmpty(contactgroup);
1925 1921
1926 // update managed ideia of physical data and do updates to core 1922 // update managed ideia of physical data and do updates to core
1927 /* 1923 /*
1928 lock (_characters) 1924 lock (_characters)
1929 { 1925 {
1930 foreach (OdeCharacter actor in _characters) 1926 foreach (OdeCharacter actor in _characters)
1931 { 1927 {
1932 if (actor != null) 1928 if (actor != null)
1933 { 1929 {
1934 if (actor.bad) 1930 if (actor.bad)
1935 m_log.WarnFormat("[PHYSICS]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid); 1931 m_log.WarnFormat("[PHYSICS]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid);
1936 1932
1937 actor.UpdatePositionAndVelocity(); 1933 actor.UpdatePositionAndVelocity();
1938 } 1934 }
1939 } 1935 }
1940 } 1936 }
1941 */ 1937 */
1942 1938
1943 lock (_activegroups) 1939 lock (_activegroups)
1944 { 1940 {