diff options
Diffstat (limited to 'OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs')
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index 410463c..bed66cc 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | |||
@@ -97,7 +97,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
97 | 97 | ||
98 | light = 7 // compatibility with old viewers | 98 | light = 7 // compatibility with old viewers |
99 | } | 99 | } |
100 | 100 | ||
101 | public enum changes : int | 101 | public enum changes : int |
102 | { | 102 | { |
103 | Add = 0, // arg null. finishs the prim creation. should be used internally only ( to remove later ?) | 103 | Add = 0, // arg null. finishs the prim creation. should be used internally only ( to remove later ?) |
@@ -182,7 +182,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
182 | const float comumContactERP = 0.75f; | 182 | const float comumContactERP = 0.75f; |
183 | const float comumContactCFM = 0.0001f; | 183 | const float comumContactCFM = 0.0001f; |
184 | const float comumContactSLIP = 0f; | 184 | const float comumContactSLIP = 0f; |
185 | 185 | ||
186 | float frictionMovementMult = 0.8f; | 186 | float frictionMovementMult = 0.8f; |
187 | 187 | ||
188 | float TerrainBounce = 0.1f; | 188 | float TerrainBounce = 0.1f; |
@@ -241,7 +241,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
241 | /// </summary> | 241 | /// </summary> |
242 | private List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>(); | 242 | private List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>(); |
243 | private List<PhysicsActor> _collisionEventPrimRemove = new List<PhysicsActor>(); | 243 | private List<PhysicsActor> _collisionEventPrimRemove = new List<PhysicsActor>(); |
244 | 244 | ||
245 | private HashSet<OdeCharacter> _badCharacter = new HashSet<OdeCharacter>(); | 245 | private HashSet<OdeCharacter> _badCharacter = new HashSet<OdeCharacter>(); |
246 | public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>(); | 246 | public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>(); |
247 | 247 | ||
@@ -262,7 +262,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
262 | private IntPtr TerrainGeom; | 262 | private IntPtr TerrainGeom; |
263 | private float[] TerrainHeightFieldHeight; | 263 | private float[] TerrainHeightFieldHeight; |
264 | private GCHandle TerrainHeightFieldHeightsHandler = new GCHandle(); | 264 | private GCHandle TerrainHeightFieldHeightsHandler = new GCHandle(); |
265 | 265 | ||
266 | private int m_physicsiterations = 15; | 266 | private int m_physicsiterations = 15; |
267 | private const float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag | 267 | private const float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag |
268 | // private PhysicsActor PANull = new NullPhysicsActor(); | 268 | // private PhysicsActor PANull = new NullPhysicsActor(); |
@@ -330,7 +330,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
330 | EngineType = pname; | 330 | EngineType = pname; |
331 | PhysicsSceneName = EngineType + "/" + pscene.RegionInfo.RegionName; | 331 | PhysicsSceneName = EngineType + "/" + pscene.RegionInfo.RegionName; |
332 | EngineName = pname + " " + pversion; | 332 | EngineName = pname + " " + pversion; |
333 | m_config = psourceconfig; | 333 | m_config = psourceconfig; |
334 | m_OSOdeLib = pOSOdeLib; | 334 | m_OSOdeLib = pOSOdeLib; |
335 | 335 | ||
336 | // m_OSOdeLib = false; //debug | 336 | // m_OSOdeLib = false; //debug |
@@ -343,7 +343,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
343 | 343 | ||
344 | base.Initialise(m_frameWorkScene.PhysicsRequestAsset, | 344 | base.Initialise(m_frameWorkScene.PhysicsRequestAsset, |
345 | (m_frameWorkScene.Heightmap != null ? m_frameWorkScene.Heightmap.GetFloatsSerialised() : new float[m_frameWorkScene.RegionInfo.RegionSizeX * m_frameWorkScene.RegionInfo.RegionSizeY]), | 345 | (m_frameWorkScene.Heightmap != null ? m_frameWorkScene.Heightmap.GetFloatsSerialised() : new float[m_frameWorkScene.RegionInfo.RegionSizeX * m_frameWorkScene.RegionInfo.RegionSizeY]), |
346 | (float)m_frameWorkScene.RegionInfo.RegionSettings.WaterHeight); | 346 | (float)m_frameWorkScene.RegionInfo.RegionSettings.WaterHeight); |
347 | } | 347 | } |
348 | 348 | ||
349 | public void RegionLoaded() | 349 | public void RegionLoaded() |
@@ -354,7 +354,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
354 | m_log.ErrorFormat("[ubOde] No mesher. module disabled"); | 354 | m_log.ErrorFormat("[ubOde] No mesher. module disabled"); |
355 | return; | 355 | return; |
356 | } | 356 | } |
357 | 357 | ||
358 | m_meshWorker = new ODEMeshWorker(this, m_log, mesher, physicsconfig); | 358 | m_meshWorker = new ODEMeshWorker(this, m_log, mesher, physicsconfig); |
359 | m_frameWorkScene.PhysicsEnabled = true; | 359 | m_frameWorkScene.PhysicsEnabled = true; |
360 | } | 360 | } |
@@ -394,7 +394,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
394 | } | 394 | } |
395 | catch | 395 | catch |
396 | { | 396 | { |
397 | // i must RtC#FM | 397 | // i must RtC#FM |
398 | // i did! | 398 | // i did! |
399 | } | 399 | } |
400 | 400 | ||
@@ -674,7 +674,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
674 | /// <param name="space">The space that contains the geoms. Remember, spaces are also geoms</param> | 674 | /// <param name="space">The space that contains the geoms. Remember, spaces are also geoms</param> |
675 | /// <param name="g1">a geometry or space</param> | 675 | /// <param name="g1">a geometry or space</param> |
676 | /// <param name="g2">another geometry or space</param> | 676 | /// <param name="g2">another geometry or space</param> |
677 | /// | 677 | /// |
678 | 678 | ||
679 | private void near(IntPtr space, IntPtr g1, IntPtr g2) | 679 | private void near(IntPtr space, IntPtr g1, IntPtr g2) |
680 | { | 680 | { |
@@ -784,7 +784,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
784 | if (count == 0) | 784 | if (count == 0) |
785 | return; | 785 | return; |
786 | 786 | ||
787 | // try get physical actors | 787 | // try get physical actors |
788 | PhysicsActor p1; | 788 | PhysicsActor p1; |
789 | PhysicsActor p2; | 789 | PhysicsActor p2; |
790 | 790 | ||
@@ -1135,10 +1135,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1135 | chr.IsColliding = false; | 1135 | chr.IsColliding = false; |
1136 | // chr.CollidingGround = false; not done here | 1136 | // chr.CollidingGround = false; not done here |
1137 | chr.CollidingObj = false; | 1137 | chr.CollidingObj = false; |
1138 | 1138 | ||
1139 | if(chr.Body == IntPtr.Zero || chr.collider == IntPtr.Zero ) | 1139 | if(chr.Body == IntPtr.Zero || chr.collider == IntPtr.Zero ) |
1140 | continue; | 1140 | continue; |
1141 | 1141 | ||
1142 | // do colisions with static space | 1142 | // do colisions with static space |
1143 | d.SpaceCollide2(chr.collider, StaticSpace, IntPtr.Zero, nearCallback); | 1143 | d.SpaceCollide2(chr.collider, StaticSpace, IntPtr.Zero, nearCallback); |
1144 | 1144 | ||
@@ -1160,7 +1160,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1160 | foreach (OdePrim aprim in _activeprims) | 1160 | foreach (OdePrim aprim in _activeprims) |
1161 | { | 1161 | { |
1162 | aprim.CollisionScore = 0; | 1162 | aprim.CollisionScore = 0; |
1163 | aprim.IsColliding = false; | 1163 | aprim.IsColliding = false; |
1164 | } | 1164 | } |
1165 | } | 1165 | } |
1166 | lock (_activegroups) | 1166 | lock (_activegroups) |
@@ -1170,7 +1170,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1170 | foreach (OdePrim aprim in _activegroups) | 1170 | foreach (OdePrim aprim in _activegroups) |
1171 | { | 1171 | { |
1172 | if(!aprim.m_outbounds && d.BodyIsEnabled(aprim.Body) && | 1172 | if(!aprim.m_outbounds && d.BodyIsEnabled(aprim.Body) && |
1173 | aprim.collide_geom != IntPtr.Zero) | 1173 | aprim.collide_geom != IntPtr.Zero) |
1174 | { | 1174 | { |
1175 | d.SpaceCollide2(StaticSpace, aprim.collide_geom, IntPtr.Zero, nearCallback); | 1175 | d.SpaceCollide2(StaticSpace, aprim.collide_geom, IntPtr.Zero, nearCallback); |
1176 | d.SpaceCollide2(GroundSpace, aprim.collide_geom, IntPtr.Zero, nearCallback); | 1176 | d.SpaceCollide2(GroundSpace, aprim.collide_geom, IntPtr.Zero, nearCallback); |
@@ -1251,7 +1251,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1251 | size, feetOffset, avDensity, avMovementDivisorWalk, avMovementDivisorRun); | 1251 | size, feetOffset, avDensity, avMovementDivisorWalk, avMovementDivisorRun); |
1252 | newAv.Flying = isFlying; | 1252 | newAv.Flying = isFlying; |
1253 | newAv.MinimumGroundFlightOffset = minimumGroundFlightOffset; | 1253 | newAv.MinimumGroundFlightOffset = minimumGroundFlightOffset; |
1254 | 1254 | ||
1255 | return newAv; | 1255 | return newAv; |
1256 | } | 1256 | } |
1257 | 1257 | ||
@@ -1301,7 +1301,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1301 | 1301 | ||
1302 | public void addActivePrim(OdePrim activatePrim) | 1302 | public void addActivePrim(OdePrim activatePrim) |
1303 | { | 1303 | { |
1304 | // adds active prim.. | 1304 | // adds active prim.. |
1305 | lock (_activeprims) | 1305 | lock (_activeprims) |
1306 | { | 1306 | { |
1307 | if (!_activeprims.Contains(activatePrim)) | 1307 | if (!_activeprims.Contains(activatePrim)) |
@@ -1324,7 +1324,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1324 | OdePrim newPrim; | 1324 | OdePrim newPrim; |
1325 | lock (OdeLock) | 1325 | lock (OdeLock) |
1326 | { | 1326 | { |
1327 | 1327 | ||
1328 | newPrim = new OdePrim(name, this, position, size, rotation, pbs, isphysical, isPhantom, shapeType, localID); | 1328 | newPrim = new OdePrim(name, this, position, size, rotation, pbs, isphysical, isPhantom, shapeType, localID); |
1329 | } | 1329 | } |
1330 | return newPrim; | 1330 | return newPrim; |
@@ -1372,7 +1372,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1372 | { | 1372 | { |
1373 | // lock (OdeLock) | 1373 | // lock (OdeLock) |
1374 | { | 1374 | { |
1375 | 1375 | ||
1376 | OdePrim p = (OdePrim)prim; | 1376 | OdePrim p = (OdePrim)prim; |
1377 | p.setPrimForRemoval(); | 1377 | p.setPrimForRemoval(); |
1378 | } | 1378 | } |
@@ -1423,7 +1423,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1423 | _prims[prim.LocalID] = prim; | 1423 | _prims[prim.LocalID] = prim; |
1424 | } | 1424 | } |
1425 | } | 1425 | } |
1426 | 1426 | ||
1427 | public bool haveActor(PhysicsActor actor) | 1427 | public bool haveActor(PhysicsActor actor) |
1428 | { | 1428 | { |
1429 | if (actor is OdePrim) | 1429 | if (actor is OdePrim) |
@@ -1531,14 +1531,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1531 | x = (int)(pos.X * spacesPerMeterX); | 1531 | x = (int)(pos.X * spacesPerMeterX); |
1532 | if (x > spaceGridMaxX) | 1532 | if (x > spaceGridMaxX) |
1533 | return staticPrimspaceOffRegion[1]; | 1533 | return staticPrimspaceOffRegion[1]; |
1534 | 1534 | ||
1535 | y = (int)(pos.Y * spacesPerMeterY); | 1535 | y = (int)(pos.Y * spacesPerMeterY); |
1536 | if (y > spaceGridMaxY) | 1536 | if (y > spaceGridMaxY) |
1537 | return staticPrimspaceOffRegion[3]; | 1537 | return staticPrimspaceOffRegion[3]; |
1538 | 1538 | ||
1539 | return staticPrimspace[x, y]; | 1539 | return staticPrimspace[x, y]; |
1540 | } | 1540 | } |
1541 | 1541 | ||
1542 | #endregion | 1542 | #endregion |
1543 | 1543 | ||
1544 | 1544 | ||
@@ -1628,7 +1628,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1628 | TimeSpan timedif = now - m_lastframe; | 1628 | TimeSpan timedif = now - m_lastframe; |
1629 | float timeStep = (float)timedif.TotalSeconds; | 1629 | float timeStep = (float)timedif.TotalSeconds; |
1630 | m_lastframe = now; | 1630 | m_lastframe = now; |
1631 | 1631 | ||
1632 | // acumulate time so we can reduce error | 1632 | // acumulate time so we can reduce error |
1633 | step_time += timeStep; | 1633 | step_time += timeStep; |
1634 | 1634 | ||
@@ -1654,7 +1654,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1654 | } | 1654 | } |
1655 | 1655 | ||
1656 | ODEchangeitem item; | 1656 | ODEchangeitem item; |
1657 | 1657 | ||
1658 | // d.WorldSetQuickStepNumIterations(world, curphysiteractions); | 1658 | // d.WorldSetQuickStepNumIterations(world, curphysiteractions); |
1659 | 1659 | ||
1660 | int loopstartMS = Util.EnvironmentTickCount(); | 1660 | int loopstartMS = Util.EnvironmentTickCount(); |
@@ -1662,9 +1662,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1662 | int changestimeMS = 0; | 1662 | int changestimeMS = 0; |
1663 | int maxChangestime = (int)(reqTimeStep * 500f); // half the time | 1663 | int maxChangestime = (int)(reqTimeStep * 500f); // half the time |
1664 | int maxLoopTime = (int)(reqTimeStep * 1200f); // 1.2 the time | 1664 | int maxLoopTime = (int)(reqTimeStep * 1200f); // 1.2 the time |
1665 | 1665 | ||
1666 | d.AllocateODEDataForThread(~0U); | 1666 | d.AllocateODEDataForThread(~0U); |
1667 | 1667 | ||
1668 | if (ChangesQueue.Count > 0) | 1668 | if (ChangesQueue.Count > 0) |
1669 | { | 1669 | { |
1670 | while (ChangesQueue.Dequeue(out item)) | 1670 | while (ChangesQueue.Dequeue(out item)) |
@@ -1726,7 +1726,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1726 | aprim.Move(); | 1726 | aprim.Move(); |
1727 | } | 1727 | } |
1728 | } | 1728 | } |
1729 | 1729 | ||
1730 | m_rayCastManager.ProcessQueuedRequests(); | 1730 | m_rayCastManager.ProcessQueuedRequests(); |
1731 | 1731 | ||
1732 | collision_optimized(); | 1732 | collision_optimized(); |
@@ -1750,7 +1750,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1750 | { | 1750 | { |
1751 | pobj.SendCollisions((int)(odetimestepMS)); | 1751 | pobj.SendCollisions((int)(odetimestepMS)); |
1752 | if(pobj.Body != IntPtr.Zero && !pobj.m_isSelected && | 1752 | if(pobj.Body != IntPtr.Zero && !pobj.m_isSelected && |
1753 | !pobj.m_disabled && !pobj.m_building && | 1753 | !pobj.m_disabled && !pobj.m_building && |
1754 | !d.BodyIsEnabled(pobj.Body)) | 1754 | !d.BodyIsEnabled(pobj.Body)) |
1755 | sleepers.Add(pobj); | 1755 | sleepers.Add(pobj); |
1756 | } | 1756 | } |
@@ -1900,7 +1900,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1900 | 1900 | ||
1901 | d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix); | 1901 | d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix); |
1902 | } | 1902 | } |
1903 | 1903 | ||
1904 | fps = (float)nodeframes * ODE_STEPSIZE / reqTimeStep; | 1904 | fps = (float)nodeframes * ODE_STEPSIZE / reqTimeStep; |
1905 | 1905 | ||
1906 | if(step_time < HalfOdeStep) | 1906 | if(step_time < HalfOdeStep) |
@@ -2166,7 +2166,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
2166 | h0 = (float)heights[iy]; // 0,1 | 2166 | h0 = (float)heights[iy]; // 0,1 |
2167 | h2 = (float)heights[iy+xstep]; // 1,1 vertice | 2167 | h2 = (float)heights[iy+xstep]; // 1,1 vertice |
2168 | norm.X = h0 - h2; | 2168 | norm.X = h0 - h2; |
2169 | norm.Y = h1 - h0; | 2169 | norm.Y = h1 - h0; |
2170 | } | 2170 | } |
2171 | else | 2171 | else |
2172 | { | 2172 | { |
@@ -2214,7 +2214,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
2214 | const float thickness = 10f; | 2214 | const float thickness = 10f; |
2215 | const int wrap = 0; | 2215 | const int wrap = 0; |
2216 | 2216 | ||
2217 | 2217 | ||
2218 | float hfmin = float.MaxValue; | 2218 | float hfmin = float.MaxValue; |
2219 | float hfmax = float.MinValue; | 2219 | float hfmax = float.MinValue; |
2220 | float val; | 2220 | float val; |
@@ -2503,7 +2503,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
2503 | 2503 | ||
2504 | orderedPrims.Sort(compareByCollisionsDesc); | 2504 | orderedPrims.Sort(compareByCollisionsDesc); |
2505 | topColliders = orderedPrims.Take(25).ToDictionary(p => p.LocalID, p => p.CollisionScore); | 2505 | topColliders = orderedPrims.Take(25).ToDictionary(p => p.LocalID, p => p.CollisionScore); |
2506 | 2506 | ||
2507 | return topColliders; | 2507 | return topColliders; |
2508 | } | 2508 | } |
2509 | 2509 | ||
@@ -2546,7 +2546,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
2546 | } | 2546 | } |
2547 | } | 2547 | } |
2548 | 2548 | ||
2549 | 2549 | ||
2550 | public override List<ContactResult> RaycastWorld(Vector3 position, Vector3 direction, float length, int Count) | 2550 | public override List<ContactResult> RaycastWorld(Vector3 position, Vector3 direction, float length, int Count) |
2551 | { | 2551 | { |
2552 | List<ContactResult> ourresults = new List<ContactResult>(); | 2552 | List<ContactResult> ourresults = new List<ContactResult>(); |