diff options
author | Teravus Ovares | 2008-02-14 00:39:08 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-02-14 00:39:08 +0000 |
commit | 0d14c47c28f4e453540f5f6807ba8b86d5ff50c2 (patch) | |
tree | 538fa1a6079dfb496ade0e43d8699ebee4f5eaf9 /OpenSim/Region/Physics | |
parent | * Bigish ODE stability Update. Run Prebuild (diff) | |
download | opensim-SC-0d14c47c28f4e453540f5f6807ba8b86d5ff50c2.zip opensim-SC-0d14c47c28f4e453540f5f6807ba8b86d5ff50c2.tar.gz opensim-SC-0d14c47c28f4e453540f5f6807ba8b86d5ff50c2.tar.bz2 opensim-SC-0d14c47c28f4e453540f5f6807ba8b86d5ff50c2.tar.xz |
* Bigisn ODE Stability update 2
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 43 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 45 |
2 files changed, 65 insertions, 23 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 527a5cc..ececa6c 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -142,8 +142,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
142 | m_taintadd = true; | 142 | m_taintadd = true; |
143 | _parent_scene.AddPhysicsActorTaint(this); | 143 | _parent_scene.AddPhysicsActorTaint(this); |
144 | // don't do .add() here; old geoms get recycled with the same hash | 144 | // don't do .add() here; old geoms get recycled with the same hash |
145 | parent_scene.geom_name_map[prim_geom] = primName; | 145 | |
146 | parent_scene.actor_name_map[prim_geom] = (PhysicsActor) this; | ||
147 | } | 146 | } |
148 | 147 | ||
149 | /// <summary> | 148 | /// <summary> |
@@ -378,7 +377,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
378 | 377 | ||
379 | public void ProcessTaints(float timestep) | 378 | public void ProcessTaints(float timestep) |
380 | { | 379 | { |
381 | System.Threading.Thread.Sleep(5); | 380 | |
382 | 381 | ||
383 | if (m_taintadd) | 382 | if (m_taintadd) |
384 | changeadd(timestep); | 383 | changeadd(timestep); |
@@ -412,7 +411,26 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
412 | changevelocity(timestep); | 411 | changevelocity(timestep); |
413 | } | 412 | } |
414 | 413 | ||
414 | public void ResetTaints() | ||
415 | { | ||
416 | |||
417 | m_taintposition = _position; | ||
418 | |||
419 | m_taintrot = _orientation; | ||
415 | 420 | ||
421 | m_taintPhysics = m_isphysical; | ||
422 | |||
423 | m_taintsize = _size; | ||
424 | |||
425 | |||
426 | m_taintshape = false; | ||
427 | |||
428 | m_taintforce = false; | ||
429 | |||
430 | m_taintdisable = false; | ||
431 | |||
432 | m_taintVelocity = PhysicsVector.Zero; | ||
433 | } | ||
416 | public void changeadd(float timestep) | 434 | public void changeadd(float timestep) |
417 | { | 435 | { |
418 | if (_mesh != null) | 436 | if (_mesh != null) |
@@ -525,7 +543,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
525 | } | 543 | } |
526 | 544 | ||
527 | 545 | ||
528 | } | 546 | } |
547 | _parent_scene.geom_name_map[prim_geom] = this.m_primName; | ||
548 | _parent_scene.actor_name_map[prim_geom] = (PhysicsActor)this; | ||
529 | m_taintadd = false; | 549 | m_taintadd = false; |
530 | 550 | ||
531 | 551 | ||
@@ -610,8 +630,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
610 | 630 | ||
611 | public void changesize(float timestamp) | 631 | public void changesize(float timestamp) |
612 | { | 632 | { |
633 | if (!_parent_scene.geom_name_map.ContainsKey(prim_geom)) | ||
634 | { | ||
635 | m_taintsize = _size; | ||
636 | return; | ||
637 | } | ||
613 | string oldname = _parent_scene.geom_name_map[prim_geom]; | 638 | string oldname = _parent_scene.geom_name_map[prim_geom]; |
614 | 639 | ||
640 | |||
615 | // Cleanup of old prim geometry | 641 | // Cleanup of old prim geometry |
616 | if (_mesh != null) | 642 | if (_mesh != null) |
617 | { | 643 | { |
@@ -995,11 +1021,16 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
995 | public override void CrossingFailure() | 1021 | public override void CrossingFailure() |
996 | { | 1022 | { |
997 | m_crossingfailures++; | 1023 | m_crossingfailures++; |
998 | if (m_crossingfailures >= 5) | 1024 | if (m_crossingfailures > 5) |
999 | { | 1025 | { |
1000 | m_log.Warn("[PHYSICS]: Too many crossing failures for: " + m_primName); | 1026 | base.RaiseOutOfBounds(_position); |
1027 | return; | ||
1001 | 1028 | ||
1002 | } | 1029 | } |
1030 | else if (m_crossingfailures == 5) | ||
1031 | { | ||
1032 | m_log.Warn("[PHYSICS]: Too many crossing failures for: " + m_primName); | ||
1033 | } | ||
1003 | } | 1034 | } |
1004 | public void UpdatePositionAndVelocity() | 1035 | public void UpdatePositionAndVelocity() |
1005 | { | 1036 | { |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 66af095..5ff74dc 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -736,6 +736,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
736 | /// <param name="prim"></param> | 736 | /// <param name="prim"></param> |
737 | public void RemovePrimThreadLocked(OdePrim prim) | 737 | public void RemovePrimThreadLocked(OdePrim prim) |
738 | { | 738 | { |
739 | prim.ResetTaints(); | ||
739 | lock (OdeLock) | 740 | lock (OdeLock) |
740 | { | 741 | { |
741 | System.Threading.Thread.Sleep(20); | 742 | System.Threading.Thread.Sleep(20); |
@@ -1237,31 +1238,39 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1237 | actor.Move(timeStep); | 1238 | actor.Move(timeStep); |
1238 | actor.collidelock = true; | 1239 | actor.collidelock = true; |
1239 | } | 1240 | } |
1240 | 1241 | if (!ode.lockquery()) | |
1241 | ode.dlock(world); | 1242 | { |
1243 | ode.dlock(world); | ||
1242 | 1244 | ||
1243 | collision_optimized(timeStep); | 1245 | collision_optimized(timeStep); |
1244 | 1246 | ||
1245 | |||
1246 | 1247 | ||
1247 | ode.dunlock(world); | 1248 | |
1248 | 1249 | ||
1249 | try | 1250 | |
1250 | { | 1251 | try |
1251 | d.WorldQuickStep(world, ODE_STEPSIZE); | 1252 | { |
1253 | d.WorldQuickStep(world, ODE_STEPSIZE); | ||
1254 | } | ||
1255 | catch (StackOverflowException) | ||
1256 | { | ||
1257 | d.WorldQuickStep(world, 0.001f); | ||
1258 | } | ||
1259 | d.JointGroupEmpty(contactgroup); | ||
1260 | ode.dunlock(world); | ||
1261 | |||
1262 | step_time -= ODE_STEPSIZE; | ||
1263 | i++; | ||
1252 | } | 1264 | } |
1253 | catch (StackOverflowException) | 1265 | else |
1254 | { | 1266 | { |
1255 | d.WorldQuickStep(world, 0.001f); | 1267 | fps = 0; |
1256 | } | 1268 | } |
1257 | d.JointGroupEmpty(contactgroup); | 1269 | |
1258 | foreach (OdeCharacter actor in _characters) | 1270 | foreach (OdeCharacter actor in _characters) |
1259 | { | 1271 | { |
1260 | actor.collidelock = false; | 1272 | actor.collidelock = false; |
1261 | } | 1273 | } |
1262 | |||
1263 | step_time -= ODE_STEPSIZE; | ||
1264 | i++; | ||
1265 | } | 1274 | } |
1266 | 1275 | ||
1267 | foreach (OdeCharacter actor in _characters) | 1276 | foreach (OdeCharacter actor in _characters) |
@@ -1273,12 +1282,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1273 | { | 1282 | { |
1274 | bool processedtaints = false; | 1283 | bool processedtaints = false; |
1275 | foreach (OdePrim prim in _taintedPrim) | 1284 | foreach (OdePrim prim in _taintedPrim) |
1276 | { | 1285 | { |
1277 | prim.ProcessTaints(timeStep); | ||
1278 | if (prim.m_taintremove) | 1286 | if (prim.m_taintremove) |
1279 | { | 1287 | { |
1280 | RemovePrimThreadLocked(prim); | 1288 | RemovePrimThreadLocked(prim); |
1281 | } | 1289 | } |
1290 | |||
1291 | prim.ProcessTaints(timeStep); | ||
1292 | |||
1282 | processedtaints = true; | 1293 | processedtaints = true; |
1283 | prim.m_collisionscore = 0; | 1294 | prim.m_collisionscore = 0; |
1284 | } | 1295 | } |