aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorubit2012-05-21 13:37:34 +0200
committerubit2012-05-21 13:37:34 +0200
commit4bbd5fa800f9c112be5f9aa7019343312af549f7 (patch)
treea208de009fde1bf3ef6264bde29e562bb8847a53
parentMerge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork (diff)
parent try to let avas climb higher steps. Will only work in some cases, may have b... (diff)
downloadopensim-SC_OLD-4bbd5fa800f9c112be5f9aa7019343312af549f7.zip
opensim-SC_OLD-4bbd5fa800f9c112be5f9aa7019343312af549f7.tar.gz
opensim-SC_OLD-4bbd5fa800f9c112be5f9aa7019343312af549f7.tar.bz2
opensim-SC_OLD-4bbd5fa800f9c112be5f9aa7019343312af549f7.tar.xz
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs13
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs7
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs9
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs124
4 files changed, 111 insertions, 42 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 5fddaed..2852c4b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1604,7 +1604,10 @@ namespace OpenSim.Region.Framework.Scenes
1604 } 1604 }
1605 } 1605 }
1606 else if (PhysActor == null) 1606 else if (PhysActor == null)
1607 {
1607 ApplyPhysics((uint)Flags, VolumeDetectActive, false); 1608 ApplyPhysics((uint)Flags, VolumeDetectActive, false);
1609 UpdatePhysicsSubscribedEvents();
1610 }
1608 else 1611 else
1609 { 1612 {
1610 PhysActor.PhysicsShapeType = m_physicsShapeType; 1613 PhysActor.PhysicsShapeType = m_physicsShapeType;
@@ -4664,7 +4667,15 @@ namespace OpenSim.Region.Framework.Scenes
4664 /// </remarks> 4667 /// </remarks>
4665 public void RemoveFromPhysics() 4668 public void RemoveFromPhysics()
4666 { 4669 {
4667 ParentGroup.Scene.PhysicsScene.RemovePrim(PhysActor); 4670 PhysicsActor pa = PhysActor;
4671 if (pa != null)
4672 {
4673 pa.OnCollisionUpdate -= PhysicsCollision;
4674 pa.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate;
4675 pa.OnOutOfBounds -= PhysicsOutOfBounds;
4676
4677 ParentGroup.Scene.PhysicsScene.RemovePrim(pa);
4678 }
4668 PhysActor = null; 4679 PhysActor = null;
4669 } 4680 }
4670 4681
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..459cd27 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)
@@ -2563,10 +2562,10 @@ namespace OpenSim.Region.Physics.OdePlugin
2563 { 2562 {
2564 d.Quaternion qtmp; 2563 d.Quaternion qtmp;
2565 d.GeomCopyQuaternion(prim_geom, out qtmp); 2564 d.GeomCopyQuaternion(prim_geom, out qtmp);
2566 _orientation.W = qtmp.W;
2567 _orientation.X = qtmp.X; 2565 _orientation.X = qtmp.X;
2568 _orientation.Y = qtmp.Y; 2566 _orientation.Y = qtmp.Y;
2569 _orientation.Z = qtmp.Z; 2567 _orientation.Z = qtmp.Z;
2568 _orientation.W = qtmp.W;
2570 2569
2571 d.Vector3 lpos = d.GeomGetPosition(prim_geom); 2570 d.Vector3 lpos = d.GeomGetPosition(prim_geom);
2572 _position.X = lpos.X; 2571 _position.X = lpos.X;
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
index 0f341b9..d5968fc 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);
@@ -1004,16 +1006,82 @@ namespace OpenSim.Region.Physics.OdePlugin
1004 else 1006 else
1005 1007
1006 { 1008 {
1007 if (dop1foot && (p1.Position.Z - curContact.pos.Z) > (p1.Size.Z - avCapRadius) * 0.5f)
1008 p1.IsColliding = true;
1009 if (dop2foot && (p2.Position.Z - curContact.pos.Z) > (p2.Size.Z - avCapRadius) * 0.5f)
1010 p2.IsColliding = true;
1011 1009
1012 if (AvanormOverride && curContact.depth > 0.3f) 1010 if (AvanormOverride)
1013 { 1011 {
1014 curContact.normal.X = normoverride.X; 1012 if (curContact.depth > 0.3f)
1015 curContact.normal.Y = normoverride.Y; 1013 {
1016 curContact.normal.Z = normoverride.Z; 1014 if (dop1foot && (p1.Position.Z - curContact.pos.Z) > (p1.Size.Z - avCapRadius) * 0.5f)
1015 p1.IsColliding = true;
1016 if (dop2foot && (p2.Position.Z - curContact.pos.Z) > (p2.Size.Z - avCapRadius) * 0.5f)
1017 p2.IsColliding = true;
1018 curContact.normal.X = normoverride.X;
1019 curContact.normal.Y = normoverride.Y;
1020 curContact.normal.Z = normoverride.Z;
1021 }
1022
1023 else
1024 {
1025 if (dop1foot)
1026 {
1027 float sz = p1.Size.Z;
1028 Vector3 vtmp = p1.Position;
1029 float ppos = curContact.pos.Z - vtmp.Z + (sz - avCapRadius) * 0.5f;
1030 if (ppos > 0f)
1031 {
1032 if (!p1.Flying)
1033 {
1034 d.AABB aabb;
1035 d.GeomGetAABB(g2, out aabb);
1036 float tmp = vtmp.Z - sz * .25f;
1037
1038 if (aabb.MaxZ < tmp)
1039 {
1040 vtmp.X = curContact.pos.X - vtmp.X;
1041 vtmp.Y = curContact.pos.Y - vtmp.Y;
1042 vtmp.Z = -0.2f;
1043 vtmp.Normalize();
1044 curContact.normal.X = vtmp.X;
1045 curContact.normal.Y = vtmp.Y;
1046 curContact.normal.Z = vtmp.Z;
1047 }
1048 }
1049 }
1050 else
1051 p1.IsColliding = true;
1052
1053 }
1054
1055 if (dop2foot)
1056 {
1057 float sz = p2.Size.Z;
1058 Vector3 vtmp = p2.Position;
1059 float ppos = curContact.pos.Z - vtmp.Z + (sz - avCapRadius) * 0.5f;
1060 if (ppos > 0f)
1061 {
1062 if (!p2.Flying)
1063 {
1064 d.AABB aabb;
1065 d.GeomGetAABB(g1, out aabb);
1066 float tmp = vtmp.Z - sz * .25f;
1067
1068 if (aabb.MaxZ < tmp)
1069 {
1070 vtmp.X = curContact.pos.X - vtmp.X;
1071 vtmp.Y = curContact.pos.Y - vtmp.Y;
1072 vtmp.Z = -0.2f;
1073 vtmp.Normalize();
1074 curContact.normal.X = vtmp.X;
1075 curContact.normal.Y = vtmp.Y;
1076 curContact.normal.Z = vtmp.Z;
1077 }
1078 }
1079 }
1080 else
1081 p2.IsColliding = true;
1082
1083 }
1084 }
1017 } 1085 }
1018 1086
1019 Joint = CreateContacJoint(ref curContact, mu, bounce, cfm, erpscale, dscale); 1087 Joint = CreateContacJoint(ref curContact, mu, bounce, cfm, erpscale, dscale);
@@ -1827,7 +1895,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1827 { 1895 {
1828 int ttmpstart = Util.EnvironmentTickCount(); 1896 int ttmpstart = Util.EnvironmentTickCount();
1829 int ttmp; 1897 int ttmp;
1830 int ttmp2;
1831 1898
1832 while(ChangesQueue.Dequeue(out item)) 1899 while(ChangesQueue.Dequeue(out item))
1833 { 1900 {
@@ -1849,11 +1916,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1849 if (ttmp > 20) 1916 if (ttmp > 20)
1850 break; 1917 break;
1851 } 1918 }
1852
1853 ttmp2 = Util.EnvironmentTickCountSubtract(ttmpstart);
1854 if (ttmp2 > 50)
1855 ttmp2 = 0;
1856
1857 } 1919 }
1858 1920
1859 // Move characters 1921 // Move characters
@@ -1899,7 +1961,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1899 { 1961 {
1900 case ActorTypes.Agent: 1962 case ActorTypes.Agent:
1901 OdeCharacter cobj = (OdeCharacter)obj; 1963 OdeCharacter cobj = (OdeCharacter)obj;
1902 cobj.AddCollisionFrameTime((int)(ODE_STEPSIZE * 1000.0f)); 1964 cobj.AddCollisionFrameTime((int)(odetimestepMS));
1903 cobj.SendCollisions(); 1965 cobj.SendCollisions();
1904 break; 1966 break;
1905 1967
@@ -1907,7 +1969,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1907 OdePrim pobj = (OdePrim)obj; 1969 OdePrim pobj = (OdePrim)obj;
1908 if (pobj.Body == IntPtr.Zero || (d.BodyIsEnabled(pobj.Body) && !pobj.m_outbounds)) 1970 if (pobj.Body == IntPtr.Zero || (d.BodyIsEnabled(pobj.Body) && !pobj.m_outbounds))
1909 { 1971 {
1910 pobj.AddCollisionFrameTime((int)(ODE_STEPSIZE * 1000.0f)); 1972 pobj.AddCollisionFrameTime((int)(odetimestepMS));
1911 pobj.SendCollisions(); 1973 pobj.SendCollisions();
1912 } 1974 }
1913 break; 1975 break;
@@ -1924,21 +1986,21 @@ namespace OpenSim.Region.Physics.OdePlugin
1924 d.JointGroupEmpty(contactgroup); 1986 d.JointGroupEmpty(contactgroup);
1925 1987
1926 // update managed ideia of physical data and do updates to core 1988 // update managed ideia of physical data and do updates to core
1927 /* 1989 /*
1928 lock (_characters) 1990 lock (_characters)
1929 { 1991 {
1930 foreach (OdeCharacter actor in _characters) 1992 foreach (OdeCharacter actor in _characters)
1931 { 1993 {
1932 if (actor != null) 1994 if (actor != null)
1933 { 1995 {
1934 if (actor.bad) 1996 if (actor.bad)
1935 m_log.WarnFormat("[PHYSICS]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid); 1997 m_log.WarnFormat("[PHYSICS]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid);
1936 1998
1937 actor.UpdatePositionAndVelocity(); 1999 actor.UpdatePositionAndVelocity();
1938 } 2000 }
1939 } 2001 }
1940 } 2002 }
1941 */ 2003 */
1942 2004
1943 lock (_activegroups) 2005 lock (_activegroups)
1944 { 2006 {