aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs172
1 files changed, 100 insertions, 72 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 87357a3..009db41 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -837,12 +837,13 @@ namespace OpenSim.Region.Physics.OdePlugin
837 // we don't want prim or avatar to explode 837 // we don't want prim or avatar to explode
838 838
839 #region InterPenetration Handling - Unintended physics explosions 839 #region InterPenetration Handling - Unintended physics explosions
840# region disabled code1
840 841
841 if (contacts[i].depth >= 0.08f) 842 if (contacts[i].depth >= 0.08f)
842 { 843 {
843 //This is disabled at the moment only because it needs more tweaking 844 //This is disabled at the moment only because it needs more tweaking
844 //It will eventually be uncommented 845 //It will eventually be uncommented
845 846 /*
846 if (contacts[i].depth >= 1.00f) 847 if (contacts[i].depth >= 1.00f)
847 { 848 {
848 //m_log.Debug("[PHYSICS]: " + contacts[i].depth.ToString()); 849 //m_log.Debug("[PHYSICS]: " + contacts[i].depth.ToString());
@@ -854,7 +855,7 @@ namespace OpenSim.Region.Physics.OdePlugin
854 (p1.PhysicsActorType == (int) ActorTypes.Agent && 855 (p1.PhysicsActorType == (int) ActorTypes.Agent &&
855 p2.PhysicsActorType == (int) ActorTypes.Prim)) 856 p2.PhysicsActorType == (int) ActorTypes.Prim))
856 { 857 {
857 # region disabled code1 858
858 //contacts[i].depth = contacts[i].depth * 4.15f; 859 //contacts[i].depth = contacts[i].depth * 4.15f;
859 /* 860 /*
860 if (p2.PhysicsActorType == (int) ActorTypes.Agent) 861 if (p2.PhysicsActorType == (int) ActorTypes.Agent)
@@ -887,11 +888,13 @@ namespace OpenSim.Region.Physics.OdePlugin
887 888
888 //contacts[i].depth = 0.0000000f; 889 //contacts[i].depth = 0.0000000f;
889 } 890 }
890 */ 891
891 #endregion 892
893
892 } 894 }
893 895*/
894 // If you interpenetrate a prim with another prim 896 // If you interpenetrate a prim with another prim
897 /*
895 if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim) 898 if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim)
896 { 899 {
897 #region disabledcode2 900 #region disabledcode2
@@ -936,7 +939,8 @@ namespace OpenSim.Region.Physics.OdePlugin
936 //} 939 //}
937 #endregion 940 #endregion
938 } 941 }
939 942 */
943#endregion
940 if (contacts[i].depth >= 1.00f) 944 if (contacts[i].depth >= 1.00f)
941 { 945 {
942 //m_log.Info("[P]: " + contacts[i].depth.ToString()); 946 //m_log.Info("[P]: " + contacts[i].depth.ToString());
@@ -947,37 +951,37 @@ namespace OpenSim.Region.Physics.OdePlugin
947 { 951 {
948 if (p2.PhysicsActorType == (int) ActorTypes.Agent) 952 if (p2.PhysicsActorType == (int) ActorTypes.Agent)
949 { 953 {
950 OdeCharacter character = (OdeCharacter) p2; 954 if (p2 is OdeCharacter)
951 955 {
952 //p2.CollidingObj = true; 956 OdeCharacter character = (OdeCharacter) p2;
953 contacts[i].depth = 0.00000003f; 957
954 p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 0.5f); 958 //p2.CollidingObj = true;
955 contacts[i].pos = 959 contacts[i].depth = 0.00000003f;
956 new d.Vector3(contacts[i].pos.X + (p1.Size.X/2), 960 p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 0.5f);
957 contacts[i].pos.Y + (p1.Size.Y/2), 961 contacts[i].pos =
958 contacts[i].pos.Z + (p1.Size.Z/2)); 962 new d.Vector3(contacts[i].pos.X + (p1.Size.X/2),
959 character.SetPidStatus(true); 963 contacts[i].pos.Y + (p1.Size.Y/2),
960 } 964 contacts[i].pos.Z + (p1.Size.Z/2));
961 else 965 character.SetPidStatus(true);
962 { 966 }
963 } 967 }
968
964 969
965 if (p1.PhysicsActorType == (int) ActorTypes.Agent) 970 if (p1.PhysicsActorType == (int) ActorTypes.Agent)
966 { 971 {
967 OdeCharacter character = (OdeCharacter)p1; 972 if (p1 is OdeCharacter)
968 973 {
969 //p2.CollidingObj = true; 974 OdeCharacter character = (OdeCharacter) p1;
970 contacts[i].depth = 0.00000003f; 975
971 p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 0.5f); 976 //p2.CollidingObj = true;
972 contacts[i].pos = 977 contacts[i].depth = 0.00000003f;
973 new d.Vector3(contacts[i].pos.X + (p1.Size.X/2), 978 p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 0.5f);
974 contacts[i].pos.Y + (p1.Size.Y/2), 979 contacts[i].pos =
975 contacts[i].pos.Z + (p1.Size.Z/2)); 980 new d.Vector3(contacts[i].pos.X + (p1.Size.X/2),
976 character.SetPidStatus(true); 981 contacts[i].pos.Y + (p1.Size.Y/2),
977 } 982 contacts[i].pos.Z + (p1.Size.Z/2));
978 else 983 character.SetPidStatus(true);
979 { 984 }
980 //contacts[i].depth = 0.0000000f;
981 } 985 }
982 } 986 }
983 } 987 }
@@ -1045,12 +1049,16 @@ namespace OpenSim.Region.Physics.OdePlugin
1045 // prim prim contact 1049 // prim prim contact
1046 // int pj294950 = 0; 1050 // int pj294950 = 0;
1047 int movintYN = 0; 1051 int movintYN = 0;
1052 int material = (int) Material.Wood;
1048 // prim terrain contact 1053 // prim terrain contact
1049 if (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f) 1054 if (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f)
1050 { 1055 {
1051 movintYN = 1; 1056 movintYN = 1;
1052 } 1057 }
1053 int material = ((OdePrim)p2).m_material; 1058
1059 if (p2 is OdePrim)
1060 material = ((OdePrim)p2).m_material;
1061
1054 //m_log.DebugFormat("Material: {0}", material); 1062 //m_log.DebugFormat("Material: {0}", material);
1055 m_materialContacts[material, movintYN].geom = contacts[i]; 1063 m_materialContacts[material, movintYN].geom = contacts[i];
1056 _perloopContact.Add(contacts[i]); 1064 _perloopContact.Add(contacts[i]);
@@ -1072,7 +1080,11 @@ namespace OpenSim.Region.Physics.OdePlugin
1072 { 1080 {
1073 movintYN = 1; 1081 movintYN = 1;
1074 } 1082 }
1075 int material = ((OdePrim)p2).m_material; 1083
1084 int material = (int)Material.Wood;
1085
1086 if (p2 is OdePrim)
1087 material = ((OdePrim)p2).m_material;
1076 //m_log.DebugFormat("Material: {0}", material); 1088 //m_log.DebugFormat("Material: {0}", material);
1077 m_materialContacts[material, movintYN].geom = contacts[i]; 1089 m_materialContacts[material, movintYN].geom = contacts[i];
1078 _perloopContact.Add(contacts[i]); 1090 _perloopContact.Add(contacts[i]);
@@ -1151,7 +1163,10 @@ namespace OpenSim.Region.Physics.OdePlugin
1151 else if (p2.PhysicsActorType == (int)ActorTypes.Prim) 1163 else if (p2.PhysicsActorType == (int)ActorTypes.Prim)
1152 { 1164 {
1153 //p1.PhysicsActorType 1165 //p1.PhysicsActorType
1154 int material = ((OdePrim)p2).m_material; 1166 int material = (int)Material.Wood;
1167
1168 if (p2 is OdePrim)
1169 material = ((OdePrim)p2).m_material;
1155 1170
1156 //m_log.DebugFormat("Material: {0}", material); 1171 //m_log.DebugFormat("Material: {0}", material);
1157 m_materialContacts[material, 0].geom = contacts[i]; 1172 m_materialContacts[material, 0].geom = contacts[i];
@@ -1289,9 +1304,12 @@ namespace OpenSim.Region.Physics.OdePlugin
1289 //returncollisions = true; 1304 //returncollisions = true;
1290 break; 1305 break;
1291 case ActorTypes.Prim: 1306 case ActorTypes.Prim:
1292 cp1 = (OdePrim)p1; 1307 if (p1 is OdePrim)
1293 obj2LocalID = cp1.m_localID; 1308 {
1294 cp1.AddCollisionEvent(cc2.m_localID, collisiondepth); 1309 cp1 = (OdePrim) p1;
1310 obj2LocalID = cp1.m_localID;
1311 cp1.AddCollisionEvent(cc2.m_localID, collisiondepth);
1312 }
1295 //ctype = (int)CollisionCategories.Geom; 1313 //ctype = (int)CollisionCategories.Geom;
1296 1314
1297 //if (cp1.CollidingObj) 1315 //if (cp1.CollidingObj)
@@ -1313,48 +1331,58 @@ namespace OpenSim.Region.Physics.OdePlugin
1313 cc2.AddCollisionEvent(obj2LocalID, collisiondepth); 1331 cc2.AddCollisionEvent(obj2LocalID, collisiondepth);
1314 break; 1332 break;
1315 case ActorTypes.Prim: 1333 case ActorTypes.Prim:
1316 cp2 = (OdePrim)p2;
1317 1334
1318 // obj1LocalID = cp2.m_localID; 1335 if (p2 is OdePrim)
1319 switch ((ActorTypes)p1.PhysicsActorType)
1320 { 1336 {
1321 case ActorTypes.Agent: 1337 cp2 = (OdePrim) p2;
1322 cc1 = (OdeCharacter)p1;
1323 obj2LocalID = cc1.m_localID;
1324 cc1.AddCollisionEvent(cp2.m_localID, collisiondepth);
1325 //ctype = (int)CollisionCategories.Character;
1326 1338
1327 //if (cc1.CollidingObj) 1339 // obj1LocalID = cp2.m_localID;
1328 //cStartStop = (int)StatusIndicators.Generic; 1340 switch ((ActorTypes) p1.PhysicsActorType)
1329 //else 1341 {
1330 //cStartStop = (int)StatusIndicators.Start; 1342 case ActorTypes.Agent:
1331 //returncollisions = true; 1343 if (p1 is OdeCharacter)
1344 {
1345 cc1 = (OdeCharacter) p1;
1346 obj2LocalID = cc1.m_localID;
1347 cc1.AddCollisionEvent(cp2.m_localID, collisiondepth);
1348 //ctype = (int)CollisionCategories.Character;
1349
1350 //if (cc1.CollidingObj)
1351 //cStartStop = (int)StatusIndicators.Generic;
1352 //else
1353 //cStartStop = (int)StatusIndicators.Start;
1354 //returncollisions = true;
1355 }
1356 break;
1357 case ActorTypes.Prim:
1332 1358
1333 break; 1359 if (p1 is OdePrim)
1334 case ActorTypes.Prim: 1360 {
1335 cp1 = (OdePrim)p1; 1361 cp1 = (OdePrim) p1;
1336 obj2LocalID = cp1.m_localID; 1362 obj2LocalID = cp1.m_localID;
1337 cp1.AddCollisionEvent(cp2.m_localID, collisiondepth); 1363 cp1.AddCollisionEvent(cp2.m_localID, collisiondepth);
1338 //ctype = (int)CollisionCategories.Geom; 1364 //ctype = (int)CollisionCategories.Geom;
1339 1365
1340 //if (cp1.CollidingObj) 1366 //if (cp1.CollidingObj)
1341 //cStartStop = (int)StatusIndicators.Generic; 1367 //cStartStop = (int)StatusIndicators.Generic;
1342 //else 1368 //else
1343 //cStartStop = (int)StatusIndicators.Start; 1369 //cStartStop = (int)StatusIndicators.Start;
1344 1370
1345 //returncollisions = true; 1371 //returncollisions = true;
1346 break; 1372 }
1373 break;
1347 1374
1348 case ActorTypes.Ground: 1375 case ActorTypes.Ground:
1349 case ActorTypes.Unknown: 1376 case ActorTypes.Unknown:
1350 obj2LocalID = 0; 1377 obj2LocalID = 0;
1351 //ctype = (int)CollisionCategories.Land; 1378 //ctype = (int)CollisionCategories.Land;
1352 1379
1353 //returncollisions = true; 1380 //returncollisions = true;
1354 break; 1381 break;
1355 } 1382 }
1356 1383
1357 cp2.AddCollisionEvent(obj2LocalID, collisiondepth); 1384 cp2.AddCollisionEvent(obj2LocalID, collisiondepth);
1385 }
1358 break; 1386 break;
1359 } 1387 }
1360 //if (returncollisions) 1388 //if (returncollisions)