aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
diff options
context:
space:
mode:
authorUbitUmarov2017-04-25 17:59:53 +0100
committerUbitUmarov2017-04-25 17:59:53 +0100
commita680d8b8d700f78beb1a9eea98b52d59118efe2e (patch)
treedd084e74fb61400c704a14dcfa8689670acb9ec2 /OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
parentMerge branch 'master' into httptests (diff)
parentmove mesh pbs creation code out of mesh upload code into to PrimitiveBaseShap... (diff)
downloadopensim-SC-a680d8b8d700f78beb1a9eea98b52d59118efe2e.zip
opensim-SC-a680d8b8d700f78beb1a9eea98b52d59118efe2e.tar.gz
opensim-SC-a680d8b8d700f78beb1a9eea98b52d59118efe2e.tar.bz2
opensim-SC-a680d8b8d700f78beb1a9eea98b52d59118efe2e.tar.xz
fix merge
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs79
1 files changed, 55 insertions, 24 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
index bed66cc..86d41ea 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
@@ -155,6 +155,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
155 VehicleRotationParam, 155 VehicleRotationParam,
156 VehicleFlags, 156 VehicleFlags,
157 SetVehicle, 157 SetVehicle,
158 SetInertia,
158 159
159 Null //keep this last used do dim the methods array. does nothing but pulsing the prim 160 Null //keep this last used do dim the methods array. does nothing but pulsing the prim
160 } 161 }
@@ -185,7 +186,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
185 186
186 float frictionMovementMult = 0.8f; 187 float frictionMovementMult = 0.8f;
187 188
188 float TerrainBounce = 0.1f; 189 float TerrainBounce = 0.001f;
189 float TerrainFriction = 0.3f; 190 float TerrainFriction = 0.3f;
190 191
191 public float AvatarFriction = 0;// 0.9f * 0.5f; 192 public float AvatarFriction = 0;// 0.9f * 0.5f;
@@ -502,7 +503,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
502 503
503 d.WorldSetGravity(world, gravityx, gravityy, gravityz); 504 d.WorldSetGravity(world, gravityx, gravityy, gravityz);
504 505
505 d.WorldSetLinearDamping(world, 0.002f); 506 d.WorldSetLinearDamping(world, 0.001f);
506 d.WorldSetAngularDamping(world, 0.002f); 507 d.WorldSetAngularDamping(world, 0.002f);
507 d.WorldSetAngularDampingThreshold(world, 0f); 508 d.WorldSetAngularDampingThreshold(world, 0f);
508 d.WorldSetLinearDampingThreshold(world, 0f); 509 d.WorldSetLinearDampingThreshold(world, 0f);
@@ -528,6 +529,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
528 SharedTmpcontact.surface.mode = comumContactFlags; 529 SharedTmpcontact.surface.mode = comumContactFlags;
529 SharedTmpcontact.surface.mu = 0; 530 SharedTmpcontact.surface.mu = 0;
530 SharedTmpcontact.surface.bounce = 0; 531 SharedTmpcontact.surface.bounce = 0;
532 SharedTmpcontact.surface.bounce_vel = 1.5f;
531 SharedTmpcontact.surface.soft_cfm = comumContactCFM; 533 SharedTmpcontact.surface.soft_cfm = comumContactCFM;
532 SharedTmpcontact.surface.soft_erp = comumContactERP; 534 SharedTmpcontact.surface.soft_erp = comumContactERP;
533 SharedTmpcontact.surface.slip1 = comumContactSLIP; 535 SharedTmpcontact.surface.slip1 = comumContactSLIP;
@@ -726,8 +728,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
726 if (g1 == g2) 728 if (g1 == g2)
727 return; // Can't collide with yourself 729 return; // Can't collide with yourself
728 730
729 if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) 731// if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact))
730 return; 732// return;
731 /* 733 /*
732 // debug 734 // debug
733 PhysicsActor dp2; 735 PhysicsActor dp2;
@@ -1082,9 +1084,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1082 case ActorTypes.Prim: 1084 case ActorTypes.Prim:
1083 if (p2events) 1085 if (p2events)
1084 { 1086 {
1085 AddCollisionEventReporting(p2); 1087 //AddCollisionEventReporting(p2);
1086 p2.AddCollisionEvent(p1.ParentActor.LocalID, contact); 1088 p2.AddCollisionEvent(p1.ParentActor.LocalID, contact);
1087 } 1089 }
1090 else if(p1.IsVolumeDtc)
1091 p2.AddVDTCCollisionEvent(p1.ParentActor.LocalID, contact);
1092
1088 obj2LocalID = p2.ParentActor.LocalID; 1093 obj2LocalID = p2.ParentActor.LocalID;
1089 break; 1094 break;
1090 1095
@@ -1098,9 +1103,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1098 { 1103 {
1099 contact.SurfaceNormal = -contact.SurfaceNormal; 1104 contact.SurfaceNormal = -contact.SurfaceNormal;
1100 contact.RelativeSpeed = -contact.RelativeSpeed; 1105 contact.RelativeSpeed = -contact.RelativeSpeed;
1101 AddCollisionEventReporting(p1); 1106 //AddCollisionEventReporting(p1);
1102 p1.AddCollisionEvent(obj2LocalID, contact); 1107 p1.AddCollisionEvent(obj2LocalID, contact);
1103 } 1108 }
1109 else if(p2.IsVolumeDtc)
1110 {
1111 contact.SurfaceNormal = -contact.SurfaceNormal;
1112 contact.RelativeSpeed = -contact.RelativeSpeed;
1113 //AddCollisionEventReporting(p1);
1114 p1.AddVDTCCollisionEvent(obj2LocalID, contact);
1115 }
1104 break; 1116 break;
1105 } 1117 }
1106 case ActorTypes.Ground: 1118 case ActorTypes.Ground:
@@ -1109,7 +1121,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1109 { 1121 {
1110 if (p2events && !p2.IsVolumeDtc) 1122 if (p2events && !p2.IsVolumeDtc)
1111 { 1123 {
1112 AddCollisionEventReporting(p2); 1124 //AddCollisionEventReporting(p2);
1113 p2.AddCollisionEvent(0, contact); 1125 p2.AddCollisionEvent(0, contact);
1114 } 1126 }
1115 break; 1127 break;
@@ -1161,8 +1173,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1161 { 1173 {
1162 aprim.CollisionScore = 0; 1174 aprim.CollisionScore = 0;
1163 aprim.IsColliding = false; 1175 aprim.IsColliding = false;
1176 if(!aprim.m_outbounds && d.BodyIsEnabled(aprim.Body))
1177 aprim.clearSleeperCollisions();
1164 } 1178 }
1165 } 1179 }
1180
1166 lock (_activegroups) 1181 lock (_activegroups)
1167 { 1182 {
1168 try 1183 try
@@ -1657,11 +1672,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1657 1672
1658// d.WorldSetQuickStepNumIterations(world, curphysiteractions); 1673// d.WorldSetQuickStepNumIterations(world, curphysiteractions);
1659 1674
1660 int loopstartMS = Util.EnvironmentTickCount(); 1675 double loopstartMS = Util.GetTimeStampMS();
1661 int looptimeMS = 0; 1676 double looptimeMS = 0;
1662 int changestimeMS = 0; 1677 double changestimeMS = 0;
1663 int maxChangestime = (int)(reqTimeStep * 500f); // half the time 1678 double maxChangestime = (int)(reqTimeStep * 500f); // half the time
1664 int maxLoopTime = (int)(reqTimeStep * 1200f); // 1.2 the time 1679 double maxLoopTime = (int)(reqTimeStep * 1200f); // 1.2 the time
1680
1681// double collisionTime = 0;
1682// double qstepTIme = 0;
1683// double tmpTime = 0;
1665 1684
1666 d.AllocateODEDataForThread(~0U); 1685 d.AllocateODEDataForThread(~0U);
1667 1686
@@ -1684,7 +1703,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1684 item.actor.Name, item.what.ToString()); 1703 item.actor.Name, item.what.ToString());
1685 } 1704 }
1686 } 1705 }
1687 changestimeMS = Util.EnvironmentTickCountSubtract(loopstartMS); 1706 changestimeMS = Util.GetTimeStampMS() - loopstartMS;
1688 if (changestimeMS > maxChangestime) 1707 if (changestimeMS > maxChangestime)
1689 break; 1708 break;
1690 } 1709 }
@@ -1729,9 +1748,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1729 1748
1730 m_rayCastManager.ProcessQueuedRequests(); 1749 m_rayCastManager.ProcessQueuedRequests();
1731 1750
1751// tmpTime = Util.GetTimeStampMS();
1732 collision_optimized(); 1752 collision_optimized();
1733 List<OdePrim> sleepers = new List<OdePrim>(); 1753// collisionTime += Util.GetTimeStampMS() - tmpTime;
1754
1755 lock(_collisionEventPrimRemove)
1756 {
1757 foreach (PhysicsActor obj in _collisionEventPrimRemove)
1758 _collisionEventPrim.Remove(obj);
1734 1759
1760 _collisionEventPrimRemove.Clear();
1761 }
1762
1763 List<OdePrim> sleepers = new List<OdePrim>();
1735 foreach (PhysicsActor obj in _collisionEventPrim) 1764 foreach (PhysicsActor obj in _collisionEventPrim)
1736 { 1765 {
1737 if (obj == null) 1766 if (obj == null)
@@ -1761,18 +1790,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1761 foreach(OdePrim prm in sleepers) 1790 foreach(OdePrim prm in sleepers)
1762 prm.SleeperAddCollisionEvents(); 1791 prm.SleeperAddCollisionEvents();
1763 sleepers.Clear(); 1792 sleepers.Clear();
1764 1793
1765 lock(_collisionEventPrimRemove)
1766 {
1767 foreach (PhysicsActor obj in _collisionEventPrimRemove)
1768 _collisionEventPrim.Remove(obj);
1769
1770 _collisionEventPrimRemove.Clear();
1771 }
1772
1773 // do a ode simulation step 1794 // do a ode simulation step
1795// tmpTime = Util.GetTimeStampMS();
1774 d.WorldQuickStep(world, ODE_STEPSIZE); 1796 d.WorldQuickStep(world, ODE_STEPSIZE);
1775 d.JointGroupEmpty(contactgroup); 1797 d.JointGroupEmpty(contactgroup);
1798// qstepTIme += Util.GetTimeStampMS() - tmpTime;
1776 1799
1777 // update managed ideia of physical data and do updates to core 1800 // update managed ideia of physical data and do updates to core
1778 /* 1801 /*
@@ -1813,7 +1836,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1813 step_time -= ODE_STEPSIZE; 1836 step_time -= ODE_STEPSIZE;
1814 nodeframes++; 1837 nodeframes++;
1815 1838
1816 looptimeMS = Util.EnvironmentTickCountSubtract(loopstartMS); 1839 looptimeMS = Util.GetTimeStampMS() - loopstartMS;
1817 if (looptimeMS > maxLoopTime) 1840 if (looptimeMS > maxLoopTime)
1818 break; 1841 break;
1819 } 1842 }
@@ -1882,6 +1905,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1882 int nbodies = d.NTotalBodies; 1905 int nbodies = d.NTotalBodies;
1883 int ngeoms = d.NTotalGeoms; 1906 int ngeoms = d.NTotalGeoms;
1884*/ 1907*/
1908/*
1909 looptimeMS /= nodeframes;
1910 if(looptimeMS > 0.080)
1911 {
1912 collisionTime /= nodeframes;
1913 qstepTIme /= nodeframes;
1914 }
1915*/
1885 // Finished with all sim stepping. If requested, dump world state to file for debugging. 1916 // Finished with all sim stepping. If requested, dump world state to file for debugging.
1886 // TODO: This call to the export function is already inside lock (OdeLock) - but is an extra lock needed? 1917 // TODO: This call to the export function is already inside lock (OdeLock) - but is an extra lock needed?
1887 // TODO: This overwrites all dump files in-place. Should this be a growing logfile, or separate snapshots? 1918 // TODO: This overwrites all dump files in-place. Should this be a growing logfile, or separate snapshots?