aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules
diff options
context:
space:
mode:
authorUbitUmarov2017-07-01 01:43:58 +0100
committerUbitUmarov2017-07-01 01:43:58 +0100
commitedc7575f9ec3cd61aeec4ae9c3d65dc1235eb6ec (patch)
tree2924ad184b1955fa212818863541d7fe76988441 /OpenSim/Region/PhysicsModules
parentdo calls to m_host.AddScriptLPS() on the right place on osslm this stat is of... (diff)
downloadopensim-SC_OLD-edc7575f9ec3cd61aeec4ae9c3d65dc1235eb6ec.zip
opensim-SC_OLD-edc7575f9ec3cd61aeec4ae9c3d65dc1235eb6ec.tar.gz
opensim-SC_OLD-edc7575f9ec3cd61aeec4ae9c3d65dc1235eb6ec.tar.bz2
opensim-SC_OLD-edc7575f9ec3cd61aeec4ae9c3d65dc1235eb6ec.tar.xz
a few changes to ubOde avatar collisions
Diffstat (limited to 'OpenSim/Region/PhysicsModules')
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs65
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs12
2 files changed, 39 insertions, 38 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
index de7e879..b0f3f52 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
@@ -103,7 +103,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
103 103
104 public float walkDivisor = 1.3f; 104 public float walkDivisor = 1.3f;
105 public float runDivisor = 0.8f; 105 public float runDivisor = 0.8f;
106 private bool flying = false; 106 private bool m_flying = false;
107 private bool m_iscolliding = false; 107 private bool m_iscolliding = false;
108 private bool m_iscollidingGround = false; 108 private bool m_iscollidingGround = false;
109 private bool m_iscollidingObj = false; 109 private bool m_iscollidingObj = false;
@@ -298,10 +298,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
298 298
299 public override bool Flying 299 public override bool Flying
300 { 300 {
301 get { return flying; } 301 get { return m_flying; }
302 set 302 set
303 { 303 {
304 flying = value; 304 m_flying = value;
305// m_log.DebugFormat("[PHYSICS]: Set OdeCharacter Flying to {0}", flying); 305// m_log.DebugFormat("[PHYSICS]: Set OdeCharacter Flying to {0}", flying);
306 } 306 }
307 } 307 }
@@ -900,10 +900,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
900 } 900 }
901 901
902 public bool Collide(IntPtr me, IntPtr other, bool reverse, ref d.ContactGeom contact, 902 public bool Collide(IntPtr me, IntPtr other, bool reverse, ref d.ContactGeom contact,
903 ref d.ContactGeom altContact , ref bool useAltcontact, ref bool feetcollision) 903 ref bool feetcollision)
904 { 904 {
905 feetcollision = false; 905 feetcollision = false;
906 useAltcontact = false;
907 906
908 if (me == capsule) 907 if (me == capsule)
909 { 908 {
@@ -943,12 +942,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
943 } 942 }
944 return true; 943 return true;
945 } 944 }
946/* 945
947 d.AABB aabb;
948 d.GeomGetAABB(other,out aabb);
949 float othertop = aabb.MaxZ - _position.Z;
950*/
951// if (offset.Z > 0 || othertop > -feetOff || contact.normal.Z > 0.35f)
952 if (offset.Z > 0 || contact.normal.Z > 0.35f) 946 if (offset.Z > 0 || contact.normal.Z > 0.35f)
953 { 947 {
954 if (offset.Z <= 0) 948 if (offset.Z <= 0)
@@ -965,27 +959,40 @@ namespace OpenSim.Region.PhysicsModule.ubOde
965 return true; 959 return true;
966 } 960 }
967 961
968 altContact = contact; 962 if(m_flying)
969 useAltcontact = true; 963 return true;
970 964
971 offset.Z -= 0.2f; 965 offset.Z -= 0.2f;
972 966
973 offset.Normalize(); 967 offset.Normalize();
974 968
975 if (contact.depth > 0.1f) 969 float tdp = contact.depth;
976 contact.depth = 0.1f; 970 float t = contact.normal.Z * contact.normal.Z;
971 t = Math.Abs(t);
972 if(t > 1e-6)
973 {
974 tdp /= t;
975 tdp *= offset.Z * offset.Z;
976 }
977 else
978 tdp *= 10;
979
980 if (tdp > 0.25f)
981 tdp = 0.25f;
982
983 contact.depth = tdp;
977 984
978 if (reverse) 985 if (reverse)
979 { 986 {
980 altContact.normal.X = offset.X; 987 contact.normal.X = offset.X;
981 altContact.normal.Y = offset.Y; 988 contact.normal.Y = offset.Y;
982 altContact.normal.Z = offset.Z; 989 contact.normal.Z = offset.Z;
983 } 990 }
984 else 991 else
985 { 992 {
986 altContact.normal.X = -offset.X; 993 contact.normal.X = -offset.X;
987 altContact.normal.Y = -offset.Y; 994 contact.normal.Y = -offset.Y;
988 altContact.normal.Z = -offset.Z; 995 contact.normal.Z = -offset.Z;
989 } 996 }
990 997
991 feetcollision = true; 998 feetcollision = true;
@@ -1098,7 +1105,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1098 1105
1099 float ftmp; 1106 float ftmp;
1100 1107
1101 if (flying) 1108 if (m_flying)
1102 { 1109 {
1103 ftmp = timeStep; 1110 ftmp = timeStep;
1104 posch.X += vel.X * ftmp; 1111 posch.X += vel.X * ftmp;
@@ -1122,7 +1129,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1122 1129
1123 vec.Z = depth * PID_P * 50; 1130 vec.Z = depth * PID_P * 50;
1124 1131
1125 if (!flying) 1132 if (!m_flying)
1126 { 1133 {
1127 vec.Z += -vel.Z * PID_D; 1134 vec.Z += -vel.Z * PID_D;
1128 if(n.Z < 0.4f) 1135 if(n.Z < 0.4f)
@@ -1259,7 +1266,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1259 1266
1260 // movement relative to surface if moving on it 1267 // movement relative to surface if moving on it
1261 // dont disturbe vertical movement, ie jumps 1268 // dont disturbe vertical movement, ie jumps
1262 if (m_iscolliding && !flying && ctz.Z == 0 && m_collideNormal.Z > 0.2f && m_collideNormal.Z < 0.94f) 1269 if (m_iscolliding && !m_flying && ctz.Z == 0 && m_collideNormal.Z > 0.2f && m_collideNormal.Z < 0.94f)
1263 { 1270 {
1264 float p = ctz.X * m_collideNormal.X + ctz.Y * m_collideNormal.Y; 1271 float p = ctz.X * m_collideNormal.X + ctz.Y * m_collideNormal.Y;
1265 ctz.X *= (float)Math.Sqrt(1 - m_collideNormal.X * m_collideNormal.X); 1272 ctz.X *= (float)Math.Sqrt(1 - m_collideNormal.X * m_collideNormal.X);
@@ -1276,7 +1283,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1276 { 1283 {
1277 1284
1278 // if velocity is zero, use position control; otherwise, velocity control 1285 // if velocity is zero, use position control; otherwise, velocity control
1279 if (tviszero && m_iscolliding && !flying) 1286 if (tviszero && m_iscolliding && !m_flying)
1280 { 1287 {
1281 // keep track of where we stopped. No more slippin' & slidin' 1288 // keep track of where we stopped. No more slippin' & slidin'
1282 if (!_zeroFlag) 1289 if (!_zeroFlag)
@@ -1313,7 +1320,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1313 1320
1314 if (m_iscolliding) 1321 if (m_iscolliding)
1315 { 1322 {
1316 if (!flying) 1323 if (!m_flying)
1317 { 1324 {
1318 // we are on a surface 1325 // we are on a surface
1319 if (ctz.Z > 0f) 1326 if (ctz.Z > 0f)
@@ -1361,7 +1368,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1361 } 1368 }
1362 else // ie not colliding 1369 else // ie not colliding
1363 { 1370 {
1364 if (flying || hoverPIDActive) //(!m_iscolliding && flying) 1371 if (m_flying || hoverPIDActive) //(!m_iscolliding && flying)
1365 { 1372 {
1366 // we're in mid air suspended 1373 // we're in mid air suspended
1367 vec.X += (ctz.X - vel.X) * (PID_D); 1374 vec.X += (ctz.X - vel.X) * (PID_D);
@@ -1397,13 +1404,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1397 breakfactor = m_mass; 1404 breakfactor = m_mass;
1398 vec.X -= breakfactor * vel.X; 1405 vec.X -= breakfactor * vel.X;
1399 vec.Y -= breakfactor * vel.Y; 1406 vec.Y -= breakfactor * vel.Y;
1400 if (flying) 1407 if (m_flying)
1401 vec.Z -= 0.5f * breakfactor * vel.Z; 1408 vec.Z -= 0.5f * breakfactor * vel.Z;
1402 else 1409 else
1403 vec.Z -= .16f* m_mass * vel.Z; 1410 vec.Z -= .16f* m_mass * vel.Z;
1404 } 1411 }
1405 1412
1406 if (flying || hoverPIDActive) 1413 if (m_flying || hoverPIDActive)
1407 { 1414 {
1408 vec.Z -= m_parent_scene.gravityz * m_mass; 1415 vec.Z -= m_parent_scene.gravityz * m_mass;
1409 1416
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
index 86d41ea..0837bfb 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
@@ -951,8 +951,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
951 SharedTmpcontact.surface.mu = mu; 951 SharedTmpcontact.surface.mu = mu;
952 SharedTmpcontact.surface.bounce = bounce; 952 SharedTmpcontact.surface.bounce = bounce;
953 953
954 d.ContactGeom altContact = new d.ContactGeom();
955 bool useAltcontact = false;
956 bool noskip = true; 954 bool noskip = true;
957 955
958 if(dop1ava || dop2ava) 956 if(dop1ava || dop2ava)
@@ -961,11 +959,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
961 while (true) 959 while (true)
962 { 960 {
963 noskip = true; 961 noskip = true;
964 useAltcontact = false;
965 962
966 if (dop1ava) 963 if (dop1ava)
967 { 964 {
968 if ((((OdeCharacter)p1).Collide(g1, g2, false, ref curContact, ref altContact , ref useAltcontact, ref FeetCollision))) 965 if ((((OdeCharacter)p1).Collide(g1, g2, false, ref curContact, ref FeetCollision)))
969 { 966 {
970 if (p2.PhysicsActorType == (int)ActorTypes.Agent) 967 if (p2.PhysicsActorType == (int)ActorTypes.Agent)
971 { 968 {
@@ -980,7 +977,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
980 } 977 }
981 else if (dop2ava) 978 else if (dop2ava)
982 { 979 {
983 if ((((OdeCharacter)p2).Collide(g2, g1, true, ref curContact, ref altContact , ref useAltcontact, ref FeetCollision))) 980 if ((((OdeCharacter)p2).Collide(g2, g1, true, ref curContact, ref FeetCollision)))
984 { 981 {
985 if (p1.PhysicsActorType == (int)ActorTypes.Agent) 982 if (p1.PhysicsActorType == (int)ActorTypes.Agent)
986 { 983 {
@@ -996,10 +993,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
996 993
997 if (noskip) 994 if (noskip)
998 { 995 {
999 if(useAltcontact) 996 Joint = CreateContacJoint(ref curContact,smoothMesh);
1000 Joint = CreateContacJoint(ref altContact,smoothMesh);
1001 else
1002 Joint = CreateContacJoint(ref curContact,smoothMesh);
1003 997
1004 if (Joint == IntPtr.Zero) 998 if (Joint == IntPtr.Zero)
1005 break; 999 break;