aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2015-10-14 02:32:51 +0100
committerUbitUmarov2015-10-14 02:32:51 +0100
commit7deaad73687d0f561a1fa9e3abe257f1cbe2152f (patch)
treee96f8f1aa41817fb3ea4f3723ae799d622b68a64
parent reduce jitter due to viewer interpolators on objects that are really almost ... (diff)
downloadopensim-SC-7deaad73687d0f561a1fa9e3abe257f1cbe2152f.zip
opensim-SC-7deaad73687d0f561a1fa9e3abe257f1cbe2152f.tar.gz
opensim-SC-7deaad73687d0f561a1fa9e3abe257f1cbe2152f.tar.bz2
opensim-SC-7deaad73687d0f561a1fa9e3abe257f1cbe2152f.tar.xz
bug fix, and make Mesh-Mesh and Mesh-Terrain collisions a lot softer
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs142
1 files changed, 74 insertions, 68 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
index c0b73bc..2206505 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
@@ -633,17 +633,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde
633 #region Collision Detection 633 #region Collision Detection
634 634
635 // sets a global contact for a joint for contactgeom , and base contact description) 635 // sets a global contact for a joint for contactgeom , and base contact description)
636 636 private IntPtr CreateContacJoint(ref d.ContactGeom contactGeom,bool smooth)
637
638
639 private IntPtr CreateContacJoint(ref d.ContactGeom contactGeom)
640 { 637 {
641 if (m_global_contactcount >= maxContactsbeforedeath) 638 if (m_global_contactcount >= maxContactsbeforedeath)
642 return IntPtr.Zero; 639 return IntPtr.Zero;
643 640
644 m_global_contactcount++; 641 m_global_contactcount++;
645 642 if(smooth)
646 SharedTmpcontact.geom.depth = contactGeom.depth; 643 SharedTmpcontact.geom.depth = contactGeom.depth * 0.05f;
644 else
645 SharedTmpcontact.geom.depth = contactGeom.depth;
646 SharedTmpcontact.geom.pos = contactGeom.pos;
647 SharedTmpcontact.geom.pos = contactGeom.pos; 647 SharedTmpcontact.geom.pos = contactGeom.pos;
648 SharedTmpcontact.geom.normal = contactGeom.normal; 648 SharedTmpcontact.geom.normal = contactGeom.normal;
649 649
@@ -836,6 +836,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
836 bool dop1ava = false; 836 bool dop1ava = false;
837 bool dop2ava = false; 837 bool dop2ava = false;
838 bool ignore = false; 838 bool ignore = false;
839 bool smoothMesh = false;
839 840
840 switch (p1.PhysicsActorType) 841 switch (p1.PhysicsActorType)
841 { 842 {
@@ -879,6 +880,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
879 if (relVlenSQ > 0.01f) 880 if (relVlenSQ > 0.01f)
880 mu *= frictionMovementMult; 881 mu *= frictionMovementMult;
881 882
883 if(d.GeomGetClass(g2) == d.GeomClassID.TriMeshClass &&
884 d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass)
885 smoothMesh = true;
882 break; 886 break;
883 887
884 case (int)ActorTypes.Ground: 888 case (int)ActorTypes.Ground:
@@ -889,13 +893,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
889 if (Math.Abs(p1.Velocity.X) > 0.1f || Math.Abs(p1.Velocity.Y) > 0.1f) 893 if (Math.Abs(p1.Velocity.X) > 0.1f || Math.Abs(p1.Velocity.Y) > 0.1f)
890 mu *= frictionMovementMult; 894 mu *= frictionMovementMult;
891 p1.CollidingGround = true; 895 p1.CollidingGround = true;
892 /* 896
893 if (d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass) 897 if(d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass)
894 { 898 smoothMesh = true;
895 if (curContact.side1 > 0)
896 IgnoreNegSides = true;
897 }
898 */
899 break; 899 break;
900 900
901 case (int)ActorTypes.Water: 901 case (int)ActorTypes.Water:
@@ -919,6 +919,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
919 919
920 if (Math.Abs(p2.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y) > 0.1f) 920 if (Math.Abs(p2.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y) > 0.1f)
921 mu *= frictionMovementMult; 921 mu *= frictionMovementMult;
922
923 if(d.GeomGetClass(g2) == d.GeomClassID.TriMeshClass)
924 smoothMesh = true;
922 } 925 }
923 else 926 else
924 ignore = true; 927 ignore = true;
@@ -951,76 +954,77 @@ namespace OpenSim.Region.PhysicsModule.ubOde
951 bool useAltcontact = false; 954 bool useAltcontact = false;
952 bool noskip = true; 955 bool noskip = true;
953 956
957 if(dop1ava || dop2ava)
958 smoothMesh = false;
959
954 while (true) 960 while (true)
955 { 961 {
956// if (!(IgnoreNegSides && curContact.side1 < 0)) 962 noskip = true;
957 { 963 useAltcontact = false;
958 noskip = true;
959 useAltcontact = false;
960 964
961 if (dop1ava) 965 if (dop1ava)
966 {
967 if ((((OdeCharacter)p1).Collide(g1, g2, false, ref curContact, ref altContact , ref useAltcontact, ref FeetCollision)))
962 { 968 {
963 if ((((OdeCharacter)p1).Collide(g1, g2, false, ref curContact, ref altContact , ref useAltcontact, ref FeetCollision))) 969 if (p2.PhysicsActorType == (int)ActorTypes.Agent)
964 { 970 {
965 if (p2.PhysicsActorType == (int)ActorTypes.Agent) 971 p1.CollidingObj = true;
966 { 972 p2.CollidingObj = true;
967 p1.CollidingObj = true;
968 p2.CollidingObj = true;
969 }
970 else if (p2.Velocity.LengthSquared() > 0.0f)
971 p2.CollidingObj = true;
972 } 973 }
973 else 974 else if (p2.Velocity.LengthSquared() > 0.0f)
974 noskip = false; 975 p2.CollidingObj = true;
975 } 976 }
976 else if (dop2ava) 977 else
978 noskip = false;
979 }
980 else if (dop2ava)
981 {
982 if ((((OdeCharacter)p2).Collide(g2, g1, true, ref curContact, ref altContact , ref useAltcontact, ref FeetCollision)))
977 { 983 {
978 if ((((OdeCharacter)p2).Collide(g2, g1, true, ref curContact, ref altContact , ref useAltcontact, ref FeetCollision))) 984 if (p1.PhysicsActorType == (int)ActorTypes.Agent)
979 { 985 {
980 if (p1.PhysicsActorType == (int)ActorTypes.Agent) 986 p1.CollidingObj = true;
981 { 987 p2.CollidingObj = true;
982 p1.CollidingObj = true;
983 p2.CollidingObj = true;
984 }
985 else if (p2.Velocity.LengthSquared() > 0.0f)
986 p1.CollidingObj = true;
987 } 988 }
988 else 989 else if (p2.Velocity.LengthSquared() > 0.0f)
989 noskip = false; 990 p1.CollidingObj = true;
990 } 991 }
992 else
993 noskip = false;
994 }
991 995
992 if (noskip) 996 if (noskip)
993 { 997 {
994 if(useAltcontact) 998 if(useAltcontact)
995 Joint = CreateContacJoint(ref altContact); 999 Joint = CreateContacJoint(ref altContact,smoothMesh);
996 else 1000 else
997 Joint = CreateContacJoint(ref curContact); 1001 Joint = CreateContacJoint(ref curContact,smoothMesh);
998 1002
999 if (Joint == IntPtr.Zero) 1003 if (Joint == IntPtr.Zero)
1000 break; 1004 break;
1001 1005
1002 d.JointAttach(Joint, b1, b2); 1006 d.JointAttach(Joint, b1, b2);
1003 1007
1004 ncontacts++; 1008 ncontacts++;
1005 1009
1006 if (curContact.depth > maxDepthContact.PenetrationDepth) 1010 if (curContact.depth > maxDepthContact.PenetrationDepth)
1007 { 1011 {
1008 maxDepthContact.Position.X = curContact.pos.X; 1012 maxDepthContact.Position.X = curContact.pos.X;
1009 maxDepthContact.Position.Y = curContact.pos.Y; 1013 maxDepthContact.Position.Y = curContact.pos.Y;
1010 maxDepthContact.Position.Z = curContact.pos.Z; 1014 maxDepthContact.Position.Z = curContact.pos.Z;
1011 maxDepthContact.PenetrationDepth = curContact.depth; 1015 maxDepthContact.PenetrationDepth = curContact.depth;
1012 maxDepthContact.CharacterFeet = FeetCollision; 1016 maxDepthContact.CharacterFeet = FeetCollision;
1013 } 1017 }
1014 1018
1015 if (curContact.depth < minDepthContact.PenetrationDepth) 1019 if (curContact.depth < minDepthContact.PenetrationDepth)
1016 { 1020 {
1017 minDepthContact.PenetrationDepth = curContact.depth; 1021 minDepthContact.PenetrationDepth = curContact.depth;
1018 minDepthContact.SurfaceNormal.X = curContact.normal.X; 1022 minDepthContact.SurfaceNormal.X = curContact.normal.X;
1019 minDepthContact.SurfaceNormal.Y = curContact.normal.Y; 1023 minDepthContact.SurfaceNormal.Y = curContact.normal.Y;
1020 minDepthContact.SurfaceNormal.Z = curContact.normal.Z; 1024 minDepthContact.SurfaceNormal.Z = curContact.normal.Z;
1021 }
1022 } 1025 }
1023 } 1026 }
1027
1024 if (++i >= count) 1028 if (++i >= count)
1025 break; 1029 break;
1026 1030
@@ -1146,14 +1150,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1146 foreach (OdePrim aprim in _activeprims) 1150 foreach (OdePrim aprim in _activeprims)
1147 { 1151 {
1148 aprim.CollisionScore = 0; 1152 aprim.CollisionScore = 0;
1149 aprim.IsColliding = false; 1153 aprim.IsColliding = false;
1150 } 1154 }
1151 1155 }
1156 lock (_activeprims)
1157 {
1152 try 1158 try
1153 { 1159 {
1154 foreach (OdePrim aprim in _activeprims) 1160 foreach (OdePrim aprim in _activegroups)
1155 { 1161 {
1156 if(d.BodyIsEnabled(aprim.Body)) 1162 if(!aprim.m_outbounds && d.BodyIsEnabled(aprim.Body))
1157 { 1163 {
1158 d.SpaceCollide2(StaticSpace, aprim.collide_geom, IntPtr.Zero, nearCallback); 1164 d.SpaceCollide2(StaticSpace, aprim.collide_geom, IntPtr.Zero, nearCallback);
1159 d.SpaceCollide2(GroundSpace, aprim.collide_geom, IntPtr.Zero, nearCallback); 1165 d.SpaceCollide2(GroundSpace, aprim.collide_geom, IntPtr.Zero, nearCallback);