aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs20
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs29
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs4
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs4
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs127
7 files changed, 108 insertions, 81 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 54acbc4..c261943 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -129,6 +129,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
129 successfulAssetRestores++; 129 successfulAssetRestores++;
130 else 130 else
131 failedAssetRestores++; 131 failedAssetRestores++;
132
133 if ((successfulAssetRestores + failedAssetRestores) % 250 == 0)
134 m_log.Debug("[ARCHIVER]: Loaded " + successfulAssetRestores + " assets and failed to load " + failedAssetRestores + " assets...");
132 } 135 }
133 else if (!m_merge && filePath.StartsWith(ArchiveConstants.TERRAINS_PATH)) 136 else if (!m_merge && filePath.StartsWith(ArchiveConstants.TERRAINS_PATH))
134 { 137 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index cf1c394..3d41666 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1817,7 +1817,7 @@ if (m_shape != null) {
1817 } 1817 }
1818 1818
1819 CollisionEventUpdate a = (CollisionEventUpdate)e; 1819 CollisionEventUpdate a = (CollisionEventUpdate)e;
1820 Dictionary<uint, float> collissionswith = a.m_objCollisionList; 1820 Dictionary<uint, ContactPoint> collissionswith = a.m_objCollisionList;
1821 List<uint> thisHitColliders = new List<uint>(); 1821 List<uint> thisHitColliders = new List<uint>();
1822 List<uint> endedColliders = new List<uint>(); 1822 List<uint> endedColliders = new List<uint>();
1823 List<uint> startedColliders = new List<uint>(); 1823 List<uint> startedColliders = new List<uint>();
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 1ea4585..91044be 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2367,9 +2367,11 @@ namespace OpenSim.Region.Framework.Scenes
2367 2367
2368 if (m_isChildAgent == false) 2368 if (m_isChildAgent == false)
2369 { 2369 {
2370 Vector3 velocity = m_physicsActor.Velocity;
2371
2370 // Throw away duplicate or insignificant updates 2372 // Throw away duplicate or insignificant updates
2371 if (!m_bodyRot.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || 2373 if (!m_bodyRot.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) ||
2372 !m_velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || 2374 !velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) ||
2373 !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || 2375 !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) ||
2374 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) 2376 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
2375 { 2377 {
@@ -2378,7 +2380,7 @@ namespace OpenSim.Region.Framework.Scenes
2378 // Update the "last" values 2380 // Update the "last" values
2379 m_lastPosition = m_pos; 2381 m_lastPosition = m_pos;
2380 m_lastRotation = m_bodyRot; 2382 m_lastRotation = m_bodyRot;
2381 m_lastVelocity = m_velocity; 2383 m_lastVelocity = velocity;
2382 m_lastTerseSent = Environment.TickCount; 2384 m_lastTerseSent = Environment.TickCount;
2383 } 2385 }
2384 2386
@@ -2411,7 +2413,7 @@ namespace OpenSim.Region.Framework.Scenes
2411 //m_log.DebugFormat("[SCENEPRESENCE]: TerseUpdate: Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity); 2413 //m_log.DebugFormat("[SCENEPRESENCE]: TerseUpdate: Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity);
2412 2414
2413 remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, 2415 remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId,
2414 pos, m_velocity, Vector3.Zero, m_bodyRot, Vector4.UnitW, m_uuid, null, GetUpdatePriority(remoteClient))); 2416 pos, m_physicsActor.Velocity, Vector3.Zero, m_bodyRot, Vector4.UnitW, m_uuid, null, GetUpdatePriority(remoteClient)));
2415 2417
2416 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2418 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
2417 m_scene.StatsReporter.AddAgentUpdates(1); 2419 m_scene.StatsReporter.AddAgentUpdates(1);
@@ -3355,15 +3357,17 @@ namespace OpenSim.Region.Framework.Scenes
3355 // as of this comment the interval is set in AddToPhysicalScene 3357 // as of this comment the interval is set in AddToPhysicalScene
3356 UpdateMovementAnimations(); 3358 UpdateMovementAnimations();
3357 3359
3360 CollisionEventUpdate collisionData = (CollisionEventUpdate)e;
3361 Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList;
3362
3358 if (m_invulnerable) 3363 if (m_invulnerable)
3359 return; 3364 return;
3360 CollisionEventUpdate collisionData = (CollisionEventUpdate)e; 3365
3361 Dictionary<uint, float> coldata = collisionData.m_objCollisionList;
3362 float starthealth = Health; 3366 float starthealth = Health;
3363 uint killerObj = 0; 3367 uint killerObj = 0;
3364 foreach (uint localid in coldata.Keys) 3368 foreach (uint localid in coldata.Keys)
3365 { 3369 {
3366 if (coldata[localid] <= 0.10f || m_invulnerable) 3370 if (coldata[localid].PenetrationDepth <= 0.10f || m_invulnerable)
3367 continue; 3371 continue;
3368 //if (localid == 0) 3372 //if (localid == 0)
3369 //continue; 3373 //continue;
@@ -3373,9 +3377,9 @@ namespace OpenSim.Region.Framework.Scenes
3373 if (part != null && part.ParentGroup.Damage != -1.0f) 3377 if (part != null && part.ParentGroup.Damage != -1.0f)
3374 Health -= part.ParentGroup.Damage; 3378 Health -= part.ParentGroup.Damage;
3375 else 3379 else
3376 Health -= coldata[localid] * 5; 3380 Health -= coldata[localid].PenetrationDepth * 5.0f;
3377 3381
3378 if (Health <= 0) 3382 if (Health <= 0.0f)
3379 { 3383 {
3380 if (localid != 0) 3384 if (localid != 0)
3381 killerObj = localid; 3385 killerObj = localid;
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index 6bfdff2..f58129d 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -52,6 +52,20 @@ namespace OpenSim.Region.Physics.Manager
52 , Absolute 52 , Absolute
53 } 53 }
54 54
55 public struct ContactPoint
56 {
57 public Vector3 Position;
58 public Vector3 SurfaceNormal;
59 public float PenetrationDepth;
60
61 public ContactPoint(Vector3 position, Vector3 surfaceNormal, float penetrationDepth)
62 {
63 Position = position;
64 SurfaceNormal = surfaceNormal;
65 PenetrationDepth = penetrationDepth;
66 }
67 }
68
55 public class CollisionEventUpdate : EventArgs 69 public class CollisionEventUpdate : EventArgs
56 { 70 {
57 // Raising the event on the object, so don't need to provide location.. further up the tree knows that info. 71 // Raising the event on the object, so don't need to provide location.. further up the tree knows that info.
@@ -59,9 +73,9 @@ namespace OpenSim.Region.Physics.Manager
59 public int m_colliderType; 73 public int m_colliderType;
60 public int m_GenericStartEnd; 74 public int m_GenericStartEnd;
61 //public uint m_LocalID; 75 //public uint m_LocalID;
62 public Dictionary<uint,float> m_objCollisionList = new Dictionary<uint,float>(); 76 public Dictionary<uint, ContactPoint> m_objCollisionList = new Dictionary<uint, ContactPoint>();
63 77
64 public CollisionEventUpdate(uint localID, int colliderType, int GenericStartEnd, Dictionary<uint, float> objCollisionList) 78 public CollisionEventUpdate(uint localID, int colliderType, int GenericStartEnd, Dictionary<uint, ContactPoint> objCollisionList)
65 { 79 {
66 m_colliderType = colliderType; 80 m_colliderType = colliderType;
67 m_GenericStartEnd = GenericStartEnd; 81 m_GenericStartEnd = GenericStartEnd;
@@ -72,8 +86,7 @@ namespace OpenSim.Region.Physics.Manager
72 { 86 {
73 m_colliderType = (int) ActorTypes.Unknown; 87 m_colliderType = (int) ActorTypes.Unknown;
74 m_GenericStartEnd = 1; 88 m_GenericStartEnd = 1;
75 // m_objCollisionList = null; 89 m_objCollisionList = new Dictionary<uint, ContactPoint>();
76 m_objCollisionList = new Dictionary<uint, float>();
77 } 90 }
78 91
79 public int collidertype 92 public int collidertype
@@ -88,16 +101,16 @@ namespace OpenSim.Region.Physics.Manager
88 set { m_GenericStartEnd = value; } 101 set { m_GenericStartEnd = value; }
89 } 102 }
90 103
91 public void addCollider(uint localID, float depth) 104 public void addCollider(uint localID, ContactPoint contact)
92 { 105 {
93 if (!m_objCollisionList.ContainsKey(localID)) 106 if (!m_objCollisionList.ContainsKey(localID))
94 { 107 {
95 m_objCollisionList.Add(localID, depth); 108 m_objCollisionList.Add(localID, contact);
96 } 109 }
97 else 110 else
98 { 111 {
99 if (m_objCollisionList[localID] < depth) 112 if (m_objCollisionList[localID].PenetrationDepth < contact.PenetrationDepth)
100 m_objCollisionList[localID] = depth; 113 m_objCollisionList[localID] = contact;
101 } 114 }
102 } 115 }
103 } 116 }
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index c86bc62..1bc4a25 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -1209,11 +1209,11 @@ namespace OpenSim.Region.Physics.OdePlugin
1209 m_requestedUpdateFrequency = 0; 1209 m_requestedUpdateFrequency = 0;
1210 m_eventsubscription = 0; 1210 m_eventsubscription = 0;
1211 } 1211 }
1212 public void AddCollisionEvent(uint CollidedWith, float depth) 1212 public void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
1213 { 1213 {
1214 if (m_eventsubscription > 0) 1214 if (m_eventsubscription > 0)
1215 { 1215 {
1216 CollisionEventsThisFrame.addCollider(CollidedWith, depth); 1216 CollisionEventsThisFrame.addCollider(CollidedWith, contact);
1217 } 1217 }
1218 } 1218 }
1219 1219
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 5ff9d32..f4b502a 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -2958,11 +2958,11 @@ Console.WriteLine(" JointCreateFixed");
2958 m_eventsubscription = 0; 2958 m_eventsubscription = 0;
2959 } 2959 }
2960 2960
2961 public void AddCollisionEvent(uint CollidedWith, float depth) 2961 public void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
2962 { 2962 {
2963 if (CollisionEventsThisFrame == null) 2963 if (CollisionEventsThisFrame == null)
2964 CollisionEventsThisFrame = new CollisionEventUpdate(); 2964 CollisionEventsThisFrame = new CollisionEventUpdate();
2965 CollisionEventsThisFrame.addCollider(CollidedWith,depth); 2965 CollisionEventsThisFrame.addCollider(CollidedWith, contact);
2966 } 2966 }
2967 2967
2968 public void SendCollisions() 2968 public void SendCollisions()
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 7caaa14..a8e006b 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -807,7 +807,7 @@ namespace OpenSim.Region.Physics.OdePlugin
807 p2 = PANull; 807 p2 = PANull;
808 } 808 }
809 809
810 float max_collision_depth = 0f; 810 ContactPoint maxDepthContact = new ContactPoint();
811 if (p1.CollisionScore + count >= float.MaxValue) 811 if (p1.CollisionScore + count >= float.MaxValue)
812 p1.CollisionScore = 0; 812 p1.CollisionScore = 0;
813 p1.CollisionScore += count; 813 p1.CollisionScore += count;
@@ -818,9 +818,17 @@ namespace OpenSim.Region.Physics.OdePlugin
818 818
819 for (int i = 0; i < count; i++) 819 for (int i = 0; i < count; i++)
820 { 820 {
821 d.ContactGeom curContact = contacts[i];
821 822
823 if (curContact.depth > maxDepthContact.PenetrationDepth)
824 {
825 maxDepthContact = new ContactPoint(
826 new Vector3(curContact.pos.X, curContact.pos.Y, curContact.pos.Z),
827 new Vector3(curContact.normal.X, curContact.normal.Y, curContact.normal.Z),
828 curContact.depth
829 );
830 }
822 831
823 max_collision_depth = (contacts[i].depth > max_collision_depth) ? contacts[i].depth : max_collision_depth;
824 //m_log.Warn("[CCOUNT]: " + count); 832 //m_log.Warn("[CCOUNT]: " + count);
825 IntPtr joint; 833 IntPtr joint;
826 // If we're colliding with terrain, use 'TerrainContact' instead of contact. 834 // If we're colliding with terrain, use 'TerrainContact' instead of contact.
@@ -853,14 +861,14 @@ namespace OpenSim.Region.Physics.OdePlugin
853 #region InterPenetration Handling - Unintended physics explosions 861 #region InterPenetration Handling - Unintended physics explosions
854# region disabled code1 862# region disabled code1
855 863
856 if (contacts[i].depth >= 0.08f) 864 if (curContact.depth >= 0.08f)
857 { 865 {
858 //This is disabled at the moment only because it needs more tweaking 866 //This is disabled at the moment only because it needs more tweaking
859 //It will eventually be uncommented 867 //It will eventually be uncommented
860 /* 868 /*
861 if (contacts[i].depth >= 1.00f) 869 if (contact.depth >= 1.00f)
862 { 870 {
863 //m_log.Debug("[PHYSICS]: " + contacts[i].depth.ToString()); 871 //m_log.Debug("[PHYSICS]: " + contact.depth.ToString());
864 } 872 }
865 873
866 //If you interpenetrate a prim with an agent 874 //If you interpenetrate a prim with an agent
@@ -870,37 +878,37 @@ namespace OpenSim.Region.Physics.OdePlugin
870 p2.PhysicsActorType == (int) ActorTypes.Prim)) 878 p2.PhysicsActorType == (int) ActorTypes.Prim))
871 { 879 {
872 880
873 //contacts[i].depth = contacts[i].depth * 4.15f; 881 //contact.depth = contact.depth * 4.15f;
874 /* 882 /*
875 if (p2.PhysicsActorType == (int) ActorTypes.Agent) 883 if (p2.PhysicsActorType == (int) ActorTypes.Agent)
876 { 884 {
877 p2.CollidingObj = true; 885 p2.CollidingObj = true;
878 contacts[i].depth = 0.003f; 886 contact.depth = 0.003f;
879 p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f); 887 p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f);
880 OdeCharacter character = (OdeCharacter) p2; 888 OdeCharacter character = (OdeCharacter) p2;
881 character.SetPidStatus(true); 889 character.SetPidStatus(true);
882 contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p1.Size.X / 2), contacts[i].pos.Y + (p1.Size.Y / 2), contacts[i].pos.Z + (p1.Size.Z / 2)); 890 contact.pos = new d.Vector3(contact.pos.X + (p1.Size.X / 2), contact.pos.Y + (p1.Size.Y / 2), contact.pos.Z + (p1.Size.Z / 2));
883 891
884 } 892 }
885 else 893 else
886 { 894 {
887 895
888 //contacts[i].depth = 0.0000000f; 896 //contact.depth = 0.0000000f;
889 } 897 }
890 if (p1.PhysicsActorType == (int) ActorTypes.Agent) 898 if (p1.PhysicsActorType == (int) ActorTypes.Agent)
891 { 899 {
892 900
893 p1.CollidingObj = true; 901 p1.CollidingObj = true;
894 contacts[i].depth = 0.003f; 902 contact.depth = 0.003f;
895 p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f); 903 p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f);
896 contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p2.Size.X / 2), contacts[i].pos.Y + (p2.Size.Y / 2), contacts[i].pos.Z + (p2.Size.Z / 2)); 904 contact.pos = new d.Vector3(contact.pos.X + (p2.Size.X / 2), contact.pos.Y + (p2.Size.Y / 2), contact.pos.Z + (p2.Size.Z / 2));
897 OdeCharacter character = (OdeCharacter)p1; 905 OdeCharacter character = (OdeCharacter)p1;
898 character.SetPidStatus(true); 906 character.SetPidStatus(true);
899 } 907 }
900 else 908 else
901 { 909 {
902 910
903 //contacts[i].depth = 0.0000000f; 911 //contact.depth = 0.0000000f;
904 } 912 }
905 913
906 914
@@ -925,7 +933,7 @@ namespace OpenSim.Region.Physics.OdePlugin
925 //AddPhysicsActorTaint(p2); 933 //AddPhysicsActorTaint(p2);
926 //} 934 //}
927 935
928 //if (contacts[i].depth >= 0.25f) 936 //if (contact.depth >= 0.25f)
929 //{ 937 //{
930 // Don't collide, one or both prim will expld. 938 // Don't collide, one or both prim will expld.
931 939
@@ -943,21 +951,21 @@ namespace OpenSim.Region.Physics.OdePlugin
943 //AddPhysicsActorTaint(p2); 951 //AddPhysicsActorTaint(p2);
944 //} 952 //}
945 953
946 //contacts[i].depth = contacts[i].depth / 8f; 954 //contact.depth = contact.depth / 8f;
947 //contacts[i].normal = new d.Vector3(0, 0, 1); 955 //contact.normal = new d.Vector3(0, 0, 1);
948 //} 956 //}
949 //if (op1.m_disabled || op2.m_disabled) 957 //if (op1.m_disabled || op2.m_disabled)
950 //{ 958 //{
951 //Manually disabled objects stay disabled 959 //Manually disabled objects stay disabled
952 //contacts[i].depth = 0f; 960 //contact.depth = 0f;
953 //} 961 //}
954 #endregion 962 #endregion
955 } 963 }
956 */ 964 */
957#endregion 965#endregion
958 if (contacts[i].depth >= 1.00f) 966 if (curContact.depth >= 1.00f)
959 { 967 {
960 //m_log.Info("[P]: " + contacts[i].depth.ToString()); 968 //m_log.Info("[P]: " + contact.depth.ToString());
961 if ((p2.PhysicsActorType == (int) ActorTypes.Agent && 969 if ((p2.PhysicsActorType == (int) ActorTypes.Agent &&
962 p1.PhysicsActorType == (int) ActorTypes.Unknown) || 970 p1.PhysicsActorType == (int) ActorTypes.Unknown) ||
963 (p1.PhysicsActorType == (int) ActorTypes.Agent && 971 (p1.PhysicsActorType == (int) ActorTypes.Agent &&
@@ -970,12 +978,12 @@ namespace OpenSim.Region.Physics.OdePlugin
970 OdeCharacter character = (OdeCharacter) p2; 978 OdeCharacter character = (OdeCharacter) p2;
971 979
972 //p2.CollidingObj = true; 980 //p2.CollidingObj = true;
973 contacts[i].depth = 0.00000003f; 981 curContact.depth = 0.00000003f;
974 p2.Velocity = p2.Velocity + new Vector3(0f, 0f, 0.5f); 982 p2.Velocity = p2.Velocity + new Vector3(0f, 0f, 0.5f);
975 contacts[i].pos = 983 curContact.pos =
976 new d.Vector3(contacts[i].pos.X + (p1.Size.X/2), 984 new d.Vector3(curContact.pos.X + (p1.Size.X/2),
977 contacts[i].pos.Y + (p1.Size.Y/2), 985 curContact.pos.Y + (p1.Size.Y/2),
978 contacts[i].pos.Z + (p1.Size.Z/2)); 986 curContact.pos.Z + (p1.Size.Z/2));
979 character.SetPidStatus(true); 987 character.SetPidStatus(true);
980 } 988 }
981 } 989 }
@@ -988,12 +996,12 @@ namespace OpenSim.Region.Physics.OdePlugin
988 OdeCharacter character = (OdeCharacter) p1; 996 OdeCharacter character = (OdeCharacter) p1;
989 997
990 //p2.CollidingObj = true; 998 //p2.CollidingObj = true;
991 contacts[i].depth = 0.00000003f; 999 curContact.depth = 0.00000003f;
992 p1.Velocity = p1.Velocity + new Vector3(0f, 0f, 0.5f); 1000 p1.Velocity = p1.Velocity + new Vector3(0f, 0f, 0.5f);
993 contacts[i].pos = 1001 curContact.pos =
994 new d.Vector3(contacts[i].pos.X + (p1.Size.X/2), 1002 new d.Vector3(curContact.pos.X + (p1.Size.X/2),
995 contacts[i].pos.Y + (p1.Size.Y/2), 1003 curContact.pos.Y + (p1.Size.Y/2),
996 contacts[i].pos.Z + (p1.Size.Z/2)); 1004 curContact.pos.Z + (p1.Size.Z/2));
997 character.SetPidStatus(true); 1005 character.SetPidStatus(true);
998 } 1006 }
999 } 1007 }
@@ -1015,16 +1023,15 @@ namespace OpenSim.Region.Physics.OdePlugin
1015 if (!skipThisContact && (p2 is OdePrim) && (((OdePrim)p2).m_isVolumeDetect)) 1023 if (!skipThisContact && (p2 is OdePrim) && (((OdePrim)p2).m_isVolumeDetect))
1016 skipThisContact = true; // No collision on volume detect prims 1024 skipThisContact = true; // No collision on volume detect prims
1017 1025
1018 if (!skipThisContact && contacts[i].depth < 0f) 1026 if (!skipThisContact && curContact.depth < 0f)
1019 skipThisContact = true; 1027 skipThisContact = true;
1020 1028
1021 if (!skipThisContact && checkDupe(contacts[i], p2.PhysicsActorType)) 1029 if (!skipThisContact && checkDupe(curContact, p2.PhysicsActorType))
1022 skipThisContact = true; 1030 skipThisContact = true;
1023 1031
1024 const int maxContactsbeforedeath = 4000; 1032 const int maxContactsbeforedeath = 4000;
1025 joint = IntPtr.Zero; 1033 joint = IntPtr.Zero;
1026 1034
1027
1028 if (!skipThisContact) 1035 if (!skipThisContact)
1029 { 1036 {
1030 // If we're colliding against terrain 1037 // If we're colliding against terrain
@@ -1035,8 +1042,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1035 (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f)) 1042 (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f))
1036 { 1043 {
1037 // Use the movement terrain contact 1044 // Use the movement terrain contact
1038 AvatarMovementTerrainContact.geom = contacts[i]; 1045 AvatarMovementTerrainContact.geom = curContact;
1039 _perloopContact.Add(contacts[i]); 1046 _perloopContact.Add(curContact);
1040 if (m_global_contactcount < maxContactsbeforedeath) 1047 if (m_global_contactcount < maxContactsbeforedeath)
1041 { 1048 {
1042 joint = d.JointCreateContact(world, contactgroup, ref AvatarMovementTerrainContact); 1049 joint = d.JointCreateContact(world, contactgroup, ref AvatarMovementTerrainContact);
@@ -1048,8 +1055,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1048 if (p2.PhysicsActorType == (int)ActorTypes.Agent) 1055 if (p2.PhysicsActorType == (int)ActorTypes.Agent)
1049 { 1056 {
1050 // Use the non moving terrain contact 1057 // Use the non moving terrain contact
1051 TerrainContact.geom = contacts[i]; 1058 TerrainContact.geom = curContact;
1052 _perloopContact.Add(contacts[i]); 1059 _perloopContact.Add(curContact);
1053 if (m_global_contactcount < maxContactsbeforedeath) 1060 if (m_global_contactcount < maxContactsbeforedeath)
1054 { 1061 {
1055 joint = d.JointCreateContact(world, contactgroup, ref TerrainContact); 1062 joint = d.JointCreateContact(world, contactgroup, ref TerrainContact);
@@ -1074,8 +1081,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1074 material = ((OdePrim)p2).m_material; 1081 material = ((OdePrim)p2).m_material;
1075 1082
1076 //m_log.DebugFormat("Material: {0}", material); 1083 //m_log.DebugFormat("Material: {0}", material);
1077 m_materialContacts[material, movintYN].geom = contacts[i]; 1084 m_materialContacts[material, movintYN].geom = curContact;
1078 _perloopContact.Add(contacts[i]); 1085 _perloopContact.Add(curContact);
1079 1086
1080 if (m_global_contactcount < maxContactsbeforedeath) 1087 if (m_global_contactcount < maxContactsbeforedeath)
1081 { 1088 {
@@ -1100,8 +1107,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1100 if (p2 is OdePrim) 1107 if (p2 is OdePrim)
1101 material = ((OdePrim)p2).m_material; 1108 material = ((OdePrim)p2).m_material;
1102 //m_log.DebugFormat("Material: {0}", material); 1109 //m_log.DebugFormat("Material: {0}", material);
1103 m_materialContacts[material, movintYN].geom = contacts[i]; 1110 m_materialContacts[material, movintYN].geom = curContact;
1104 _perloopContact.Add(contacts[i]); 1111 _perloopContact.Add(curContact);
1105 1112
1106 if (m_global_contactcount < maxContactsbeforedeath) 1113 if (m_global_contactcount < maxContactsbeforedeath)
1107 { 1114 {
@@ -1129,20 +1136,20 @@ namespace OpenSim.Region.Physics.OdePlugin
1129 */ 1136 */
1130 //WaterContact.surface.soft_cfm = 0.0000f; 1137 //WaterContact.surface.soft_cfm = 0.0000f;
1131 //WaterContact.surface.soft_erp = 0.00000f; 1138 //WaterContact.surface.soft_erp = 0.00000f;
1132 if (contacts[i].depth > 0.1f) 1139 if (curContact.depth > 0.1f)
1133 { 1140 {
1134 contacts[i].depth *= 52; 1141 curContact.depth *= 52;
1135 //contacts[i].normal = new d.Vector3(0, 0, 1); 1142 //contact.normal = new d.Vector3(0, 0, 1);
1136 //contacts[i].pos = new d.Vector3(0, 0, contacts[i].pos.Z - 5f); 1143 //contact.pos = new d.Vector3(0, 0, contact.pos.Z - 5f);
1137 } 1144 }
1138 WaterContact.geom = contacts[i]; 1145 WaterContact.geom = curContact;
1139 _perloopContact.Add(contacts[i]); 1146 _perloopContact.Add(curContact);
1140 if (m_global_contactcount < maxContactsbeforedeath) 1147 if (m_global_contactcount < maxContactsbeforedeath)
1141 { 1148 {
1142 joint = d.JointCreateContact(world, contactgroup, ref WaterContact); 1149 joint = d.JointCreateContact(world, contactgroup, ref WaterContact);
1143 m_global_contactcount++; 1150 m_global_contactcount++;
1144 } 1151 }
1145 //m_log.Info("[PHYSICS]: Prim Water Contact" + contacts[i].depth); 1152 //m_log.Info("[PHYSICS]: Prim Water Contact" + contact.depth);
1146 } 1153 }
1147 else 1154 else
1148 { 1155 {
@@ -1153,8 +1160,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1153 if ((Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f)) 1160 if ((Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f))
1154 { 1161 {
1155 // Use the Movement prim contact 1162 // Use the Movement prim contact
1156 AvatarMovementprimContact.geom = contacts[i]; 1163 AvatarMovementprimContact.geom = curContact;
1157 _perloopContact.Add(contacts[i]); 1164 _perloopContact.Add(curContact);
1158 if (m_global_contactcount < maxContactsbeforedeath) 1165 if (m_global_contactcount < maxContactsbeforedeath)
1159 { 1166 {
1160 joint = d.JointCreateContact(world, contactgroup, ref AvatarMovementprimContact); 1167 joint = d.JointCreateContact(world, contactgroup, ref AvatarMovementprimContact);
@@ -1164,8 +1171,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1164 else 1171 else
1165 { 1172 {
1166 // Use the non movement contact 1173 // Use the non movement contact
1167 contact.geom = contacts[i]; 1174 contact.geom = curContact;
1168 _perloopContact.Add(contacts[i]); 1175 _perloopContact.Add(curContact);
1169 1176
1170 if (m_global_contactcount < maxContactsbeforedeath) 1177 if (m_global_contactcount < maxContactsbeforedeath)
1171 { 1178 {
@@ -1183,8 +1190,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1183 material = ((OdePrim)p2).m_material; 1190 material = ((OdePrim)p2).m_material;
1184 1191
1185 //m_log.DebugFormat("Material: {0}", material); 1192 //m_log.DebugFormat("Material: {0}", material);
1186 m_materialContacts[material, 0].geom = contacts[i]; 1193 m_materialContacts[material, 0].geom = curContact;
1187 _perloopContact.Add(contacts[i]); 1194 _perloopContact.Add(curContact);
1188 1195
1189 if (m_global_contactcount < maxContactsbeforedeath) 1196 if (m_global_contactcount < maxContactsbeforedeath)
1190 { 1197 {
@@ -1202,7 +1209,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1202 } 1209 }
1203 1210
1204 } 1211 }
1205 collision_accounting_events(p1, p2, max_collision_depth); 1212 collision_accounting_events(p1, p2, maxDepthContact);
1206 if (count > geomContactPointsStartthrottle) 1213 if (count > geomContactPointsStartthrottle)
1207 { 1214 {
1208 // If there are more then 3 contact points, it's likely 1215 // If there are more then 3 contact points, it's likely
@@ -1286,7 +1293,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1286 return result; 1293 return result;
1287 } 1294 }
1288 1295
1289 private void collision_accounting_events(PhysicsActor p1, PhysicsActor p2, float collisiondepth) 1296 private void collision_accounting_events(PhysicsActor p1, PhysicsActor p2, ContactPoint contact)
1290 { 1297 {
1291 // obj1LocalID = 0; 1298 // obj1LocalID = 0;
1292 //returncollisions = false; 1299 //returncollisions = false;
@@ -1307,7 +1314,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1307 case ActorTypes.Agent: 1314 case ActorTypes.Agent:
1308 cc1 = (OdeCharacter)p1; 1315 cc1 = (OdeCharacter)p1;
1309 obj2LocalID = cc1.m_localID; 1316 obj2LocalID = cc1.m_localID;
1310 cc1.AddCollisionEvent(cc2.m_localID, collisiondepth); 1317 cc1.AddCollisionEvent(cc2.m_localID, contact);
1311 //ctype = (int)CollisionCategories.Character; 1318 //ctype = (int)CollisionCategories.Character;
1312 1319
1313 //if (cc1.CollidingObj) 1320 //if (cc1.CollidingObj)
@@ -1322,7 +1329,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1322 { 1329 {
1323 cp1 = (OdePrim) p1; 1330 cp1 = (OdePrim) p1;
1324 obj2LocalID = cp1.m_localID; 1331 obj2LocalID = cp1.m_localID;
1325 cp1.AddCollisionEvent(cc2.m_localID, collisiondepth); 1332 cp1.AddCollisionEvent(cc2.m_localID, contact);
1326 } 1333 }
1327 //ctype = (int)CollisionCategories.Geom; 1334 //ctype = (int)CollisionCategories.Geom;
1328 1335
@@ -1342,7 +1349,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1342 break; 1349 break;
1343 } 1350 }
1344 1351
1345 cc2.AddCollisionEvent(obj2LocalID, collisiondepth); 1352 cc2.AddCollisionEvent(obj2LocalID, contact);
1346 break; 1353 break;
1347 case ActorTypes.Prim: 1354 case ActorTypes.Prim:
1348 1355
@@ -1358,7 +1365,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1358 { 1365 {
1359 cc1 = (OdeCharacter) p1; 1366 cc1 = (OdeCharacter) p1;
1360 obj2LocalID = cc1.m_localID; 1367 obj2LocalID = cc1.m_localID;
1361 cc1.AddCollisionEvent(cp2.m_localID, collisiondepth); 1368 cc1.AddCollisionEvent(cp2.m_localID, contact);
1362 //ctype = (int)CollisionCategories.Character; 1369 //ctype = (int)CollisionCategories.Character;
1363 1370
1364 //if (cc1.CollidingObj) 1371 //if (cc1.CollidingObj)
@@ -1374,7 +1381,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1374 { 1381 {
1375 cp1 = (OdePrim) p1; 1382 cp1 = (OdePrim) p1;
1376 obj2LocalID = cp1.m_localID; 1383 obj2LocalID = cp1.m_localID;
1377 cp1.AddCollisionEvent(cp2.m_localID, collisiondepth); 1384 cp1.AddCollisionEvent(cp2.m_localID, contact);
1378 //ctype = (int)CollisionCategories.Geom; 1385 //ctype = (int)CollisionCategories.Geom;
1379 1386
1380 //if (cp1.CollidingObj) 1387 //if (cp1.CollidingObj)
@@ -1395,7 +1402,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1395 break; 1402 break;
1396 } 1403 }
1397 1404
1398 cp2.AddCollisionEvent(obj2LocalID, collisiondepth); 1405 cp2.AddCollisionEvent(obj2LocalID, contact);
1399 } 1406 }
1400 break; 1407 break;
1401 } 1408 }