aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs5
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs73
2 files changed, 77 insertions, 1 deletions
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index 5c46344..8a07f71 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -172,6 +172,11 @@ namespace OpenSim.Region.Physics.Manager
172 return; 172 return;
173 } 173 }
174 174
175 public virtual void UnCombine(PhysicsScene pScene)
176 {
177
178 }
179
175 /// <summary> 180 /// <summary>
176 /// Queue a raycast against the physics scene. 181 /// Queue a raycast against the physics scene.
177 /// The provided callback method will be called when the raycast is complete 182 /// The provided callback method will be called when the raycast is complete
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index e702d5e..dc7010e 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -3436,7 +3436,7 @@ namespace OpenSim.Region.Physics.OdePlugin
3436 3436
3437 d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); 3437 d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle);
3438 d.GeomSetRotation(GroundGeom, ref R); 3438 d.GeomSetRotation(GroundGeom, ref R);
3439 d.GeomSetPosition(GroundGeom, pOffset.X + ((int)Constants.RegionSize * 0.5f), pOffset.Y + ((int)Constants.RegionSize * 0.5f), 0); 3439 d.GeomSetPosition(GroundGeom, (pOffset.X + ((int)Constants.RegionSize * 0.5f)) - 1, (pOffset.Y + ((int)Constants.RegionSize * 0.5f)) - 1, 0);
3440 IntPtr testGround = IntPtr.Zero; 3440 IntPtr testGround = IntPtr.Zero;
3441 if (RegionTerrain.TryGetValue(pOffset, out testGround)) 3441 if (RegionTerrain.TryGetValue(pOffset, out testGround))
3442 { 3442 {
@@ -3457,7 +3457,78 @@ namespace OpenSim.Region.Physics.OdePlugin
3457 return waterlevel; 3457 return waterlevel;
3458 } 3458 }
3459 3459
3460 public override bool SupportsCombining()
3461 {
3462 return true;
3463 }
3464
3465 public override void UnCombine(PhysicsScene pScene)
3466 {
3467 IntPtr localGround = IntPtr.Zero;
3468 float[] localHeightfield;
3469 bool proceed = false;
3470 List<IntPtr> geomDestroyList = new List<IntPtr>();
3471
3472 lock (OdeLock)
3473 {
3474 if (RegionTerrain.TryGetValue(Vector3.Zero, out localGround))
3475 {
3476 foreach (IntPtr geom in TerrainHeightFieldHeights.Keys)
3477 {
3478 if (geom == localGround)
3479 {
3480 localHeightfield = TerrainHeightFieldHeights[geom];
3481 proceed = true;
3482 }
3483 else
3484 {
3485 geomDestroyList.Add(geom);
3486 }
3487 }
3460 3488
3489 if (proceed)
3490 {
3491 m_worldOffset = Vector3.Zero;
3492 WorldExtents = new Vector2((int)Constants.RegionSize, (int)Constants.RegionSize);
3493 m_parentScene = null;
3494
3495 foreach (IntPtr g in geomDestroyList)
3496 {
3497 // removingHeightField needs to be done or the garbage collector will
3498 // collect the terrain data before we tell ODE to destroy it causing
3499 // memory corruption
3500 if (TerrainHeightFieldHeights.ContainsKey(g))
3501 {
3502 float[] removingHeightField = TerrainHeightFieldHeights[g];
3503 TerrainHeightFieldHeights.Remove(g);
3504
3505 if (RegionTerrain.ContainsKey(g))
3506 {
3507 RegionTerrain.Remove(g);
3508 }
3509
3510 d.GeomDestroy(g);
3511 removingHeightField = new float[0];
3512
3513
3514
3515 }
3516
3517 }
3518
3519 }
3520 else
3521 {
3522 m_log.Warn("[PHYSICS]: Couldn't proceed with UnCombine. Region has inconsistant data.");
3523
3524 }
3525
3526 }
3527
3528 }
3529 }
3530
3531
3461 3532
3462 public override void SetWaterLevel(float baseheight) 3533 public override void SetWaterLevel(float baseheight)
3463 { 3534 {