aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorBlueWall2011-11-23 10:50:29 -0500
committerBlueWall2011-11-23 10:50:29 -0500
commit0738fc43e46bd12343c4e43ea19affe65514521a (patch)
tree607b0dcb20f1f05675a00af00ab94fe2f86c5a1e
parentShell Environment Variables in config (diff)
parentLog error if we attempt to add/remove an OdeCharacter from the _characters li... (diff)
downloadopensim-SC_OLD-0738fc43e46bd12343c4e43ea19affe65514521a.zip
opensim-SC_OLD-0738fc43e46bd12343c4e43ea19affe65514521a.tar.gz
opensim-SC_OLD-0738fc43e46bd12343c4e43ea19affe65514521a.tar.bz2
opensim-SC_OLD-0738fc43e46bd12343c4e43ea19affe65514521a.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
-rw-r--r--OpenSim/Framework/IScene.cs22
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs26
-rwxr-xr-xOpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs2
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs10
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs234
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs1
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs207
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs54
11 files changed, 288 insertions, 293 deletions
diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs
index f1b4732..76b731f 100644
--- a/OpenSim/Framework/IScene.cs
+++ b/OpenSim/Framework/IScene.cs
@@ -102,12 +102,28 @@ namespace OpenSim.Framework
102 102
103 bool TryGetScenePresence(UUID agentID, out object scenePresence); 103 bool TryGetScenePresence(UUID agentID, out object scenePresence);
104 104
105 T RequestModuleInterface<T>(); 105 /// <summary>
106 T[] RequestModuleInterfaces<T>(); 106 /// Register an interface to a region module. This allows module methods to be called directly as
107 107 /// well as via events. If there is already a module registered for this interface, it is not replaced
108 /// (is this the best behaviour?)
109 /// </summary>
110 /// <param name="mod"></param>
108 void RegisterModuleInterface<M>(M mod); 111 void RegisterModuleInterface<M>(M mod);
112
109 void StackModuleInterface<M>(M mod); 113 void StackModuleInterface<M>(M mod);
110 114
115 /// <summary>
116 /// For the given interface, retrieve the region module which implements it.
117 /// </summary>
118 /// <returns>null if there is no registered module implementing that interface</returns>
119 T RequestModuleInterface<T>();
120
121 /// <summary>
122 /// For the given interface, retrieve an array of region modules that implement it.
123 /// </summary>
124 /// <returns>an empty array if there are no registered modules implementing that interface</returns>
125 T[] RequestModuleInterfaces<T>();
126
111// void AddCommand(object module, string command, string shorthelp, string longhelp, CommandDelegate callback); 127// void AddCommand(object module, string command, string shorthelp, string longhelp, CommandDelegate callback);
112 128
113 ISceneObject DeserializeObject(string representation); 129 ISceneObject DeserializeObject(string representation);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 663aa22..26eb729 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -82,16 +82,9 @@ namespace OpenSim.Region.Framework.Scenes
82 m_log.Info("[PRIM INVENTORY]: Starting scripts in scene"); 82 m_log.Info("[PRIM INVENTORY]: Starting scripts in scene");
83 83
84 IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>(); 84 IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>();
85 if (engines != null) 85
86 { 86 foreach (IScriptModule engine in engines)
87 foreach (IScriptModule engine in engines) 87 engine.StartProcessing();
88 {
89 if (engine != null)
90 {
91 engine.StartProcessing();
92 }
93 }
94 }
95 } 88 }
96 89
97 public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item) 90 public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item)
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index dee2ecb..0336fe5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -449,7 +449,7 @@ namespace OpenSim.Region.Framework.Scenes
449 } 449 }
450 else 450 else
451 { 451 {
452 return new T[] { default(T) }; 452 return new T[] {};
453 } 453 }
454 } 454 }
455 455
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 9446741..d80944b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -232,8 +232,6 @@ namespace OpenSim.Region.Framework.Scenes
232 ArrayList ret = new ArrayList(); 232 ArrayList ret = new ArrayList();
233 233
234 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); 234 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
235 if (engines == null) // No engine at all
236 return ret;
237 235
238 foreach (IScriptModule e in engines) 236 foreach (IScriptModule e in engines)
239 { 237 {
@@ -329,7 +327,7 @@ namespace OpenSim.Region.Framework.Scenes
329 private void RestoreSavedScriptState(UUID oldID, UUID newID) 327 private void RestoreSavedScriptState(UUID oldID, UUID newID)
330 { 328 {
331 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); 329 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
332 if (engines == null) // No engine at all 330 if (engines.Length == 0) // No engine at all
333 return; 331 return;
334 332
335 if (m_part.ParentGroup.m_savedScriptState.ContainsKey(oldID)) 333 if (m_part.ParentGroup.m_savedScriptState.ContainsKey(oldID))
@@ -369,6 +367,7 @@ namespace OpenSim.Region.Framework.Scenes
369 367
370 m_part.ParentGroup.m_savedScriptState[oldID] = newDoc.OuterXml; 368 m_part.ParentGroup.m_savedScriptState[oldID] = newDoc.OuterXml;
371 } 369 }
370
372 foreach (IScriptModule e in engines) 371 foreach (IScriptModule e in engines)
373 { 372 {
374 if (e != null) 373 if (e != null)
@@ -377,6 +376,7 @@ namespace OpenSim.Region.Framework.Scenes
377 break; 376 break;
378 } 377 }
379 } 378 }
379
380 m_part.ParentGroup.m_savedScriptState.Remove(oldID); 380 m_part.ParentGroup.m_savedScriptState.Remove(oldID);
381 } 381 }
382 } 382 }
@@ -1129,7 +1129,7 @@ namespace OpenSim.Region.Framework.Scenes
1129 1129
1130 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); 1130 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
1131 1131
1132 if (engines == null) // No engine at all 1132 if (engines.Length == 0) // No engine at all
1133 return ret; 1133 return ret;
1134 1134
1135 List<TaskInventoryItem> scripts = GetInventoryScripts(); 1135 List<TaskInventoryItem> scripts = GetInventoryScripts();
@@ -1157,7 +1157,7 @@ namespace OpenSim.Region.Framework.Scenes
1157 public void ResumeScripts() 1157 public void ResumeScripts()
1158 { 1158 {
1159 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); 1159 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
1160 if (engines == null) 1160 if (engines.Length == 0)
1161 return; 1161 return;
1162 1162
1163 List<TaskInventoryItem> scripts = GetInventoryScripts(); 1163 List<TaskInventoryItem> scripts = GetInventoryScripts();
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 7d901c9..c2d3501 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3525,23 +3525,23 @@ namespace OpenSim.Region.Framework.Scenes
3525 /// <param name="args">The arguments for the event</param> 3525 /// <param name="args">The arguments for the event</param>
3526 public void SendScriptEventToAttachments(string eventName, Object[] args) 3526 public void SendScriptEventToAttachments(string eventName, Object[] args)
3527 { 3527 {
3528 if (m_scriptEngines != null) 3528 if (m_scriptEngines.Length == 0)
3529 return;
3530
3531 lock (m_attachments)
3529 { 3532 {
3530 lock (m_attachments) 3533 foreach (SceneObjectGroup grp in m_attachments)
3531 { 3534 {
3532 foreach (SceneObjectGroup grp in m_attachments) 3535 // 16384 is CHANGED_ANIMATION
3536 //
3537 // Send this to all attachment root prims
3538 //
3539 foreach (IScriptModule m in m_scriptEngines)
3533 { 3540 {
3534 // 16384 is CHANGED_ANIMATION 3541 if (m == null) // No script engine loaded
3535 // 3542 continue;
3536 // Send this to all attachment root prims
3537 //
3538 foreach (IScriptModule m in m_scriptEngines)
3539 {
3540 if (m == null) // No script engine loaded
3541 continue;
3542 3543
3543 m.PostObjectEvent(grp.RootPart.UUID, "changed", new Object[] { (int)Changed.ANIMATION }); 3544 m.PostObjectEvent(grp.RootPart.UUID, "changed", new Object[] { (int)Changed.ANIMATION });
3544 }
3545 } 3545 }
3546 } 3546 }
3547 } 3547 }
diff --git a/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs b/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs
index 2a44360..23ef757 100755
--- a/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs
+++ b/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters
48 public class PhysicsParameters : ISharedRegionModule 48 public class PhysicsParameters : ISharedRegionModule
49 { 49 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 private static string LogHeader = "[PHYSICS PARAMETERS]"; 51// private static string LogHeader = "[PHYSICS PARAMETERS]";
52 52
53 private List<Scene> m_scenes = new List<Scene>(); 53 private List<Scene> m_scenes = new List<Scene>();
54 private static bool m_commandsLoaded = false; 54 private static bool m_commandsLoaded = false;
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index eaa1175..7ab295a 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -221,15 +221,9 @@ namespace OpenSim.Region.Physics.Manager
221 return false; 221 return false;
222 } 222 }
223 223
224 public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) 224 public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) {}
225 {
226 return;
227 }
228 225
229 public virtual void UnCombine(PhysicsScene pScene) 226 public virtual void UnCombine(PhysicsScene pScene) {}
230 {
231
232 }
233 227
234 /// <summary> 228 /// <summary>
235 /// Queue a raycast against the physics scene. 229 /// Queue a raycast against the physics scene.
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index cfe64f2..489a23a 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -542,123 +542,6 @@ namespace OpenSim.Region.Physics.OdePlugin
542 } 542 }
543 543
544 /// <summary> 544 /// <summary>
545 /// This creates the Avatar's physical Surrogate in ODE at the position supplied
546 /// </summary>
547 /// <remarks>
548 /// WARNING: This MUST NOT be called outside of ProcessTaints, else we can have unsynchronized access
549 /// to ODE internals. ProcessTaints is called from within thread-locked Simulate(), so it is the only
550 /// place that is safe to call this routine AvatarGeomAndBodyCreation.
551 /// </remarks>
552 /// <param name="npositionX"></param>
553 /// <param name="npositionY"></param>
554 /// <param name="npositionZ"></param>
555 /// <param name="tensor"></param>
556 private void CreateOdeStructures(float npositionX, float npositionY, float npositionZ, float tensor)
557 {
558 int dAMotorEuler = 1;
559// _parent_scene.waitForSpaceUnlock(_parent_scene.space);
560 if (CAPSULE_LENGTH <= 0)
561 {
562 m_log.Warn("[ODE CHARACTER]: The capsule size you specified in opensim.ini is invalid! Setting it to the smallest possible size!");
563 CAPSULE_LENGTH = 0.01f;
564 }
565
566 if (CAPSULE_RADIUS <= 0)
567 {
568 m_log.Warn("[ODE CHARACTER]: The capsule size you specified in opensim.ini is invalid! Setting it to the smallest possible size!");
569 CAPSULE_RADIUS = 0.01f;
570 }
571
572 Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH);
573
574 d.GeomSetCategoryBits(Shell, (int)m_collisionCategories);
575 d.GeomSetCollideBits(Shell, (int)m_collisionFlags);
576
577 d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH);
578 Body = d.BodyCreate(_parent_scene.world);
579 d.BodySetPosition(Body, npositionX, npositionY, npositionZ);
580
581 _position.X = npositionX;
582 _position.Y = npositionY;
583 _position.Z = npositionZ;
584
585 m_taintPosition = _position;
586
587 d.BodySetMass(Body, ref ShellMass);
588 d.Matrix3 m_caprot;
589 // 90 Stand up on the cap of the capped cyllinder
590 if (_parent_scene.IsAvCapsuleTilted)
591 {
592 d.RFromAxisAndAngle(out m_caprot, 1, 0, 1, (float)(Math.PI / 2));
593 }
594 else
595 {
596 d.RFromAxisAndAngle(out m_caprot, 0, 0, 1, (float)(Math.PI / 2));
597 }
598
599 d.GeomSetRotation(Shell, ref m_caprot);
600 d.BodySetRotation(Body, ref m_caprot);
601
602 d.GeomSetBody(Shell, Body);
603
604 // The purpose of the AMotor here is to keep the avatar's physical
605 // surrogate from rotating while moving
606 Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero);
607 d.JointAttach(Amotor, Body, IntPtr.Zero);
608 d.JointSetAMotorMode(Amotor, dAMotorEuler);
609 d.JointSetAMotorNumAxes(Amotor, 3);
610 d.JointSetAMotorAxis(Amotor, 0, 0, 1, 0, 0);
611 d.JointSetAMotorAxis(Amotor, 1, 0, 0, 1, 0);
612 d.JointSetAMotorAxis(Amotor, 2, 0, 0, 0, 1);
613 d.JointSetAMotorAngle(Amotor, 0, 0);
614 d.JointSetAMotorAngle(Amotor, 1, 0);
615 d.JointSetAMotorAngle(Amotor, 2, 0);
616
617 // These lowstops and high stops are effectively (no wiggle room)
618 if (_parent_scene.IsAvCapsuleTilted)
619 {
620 d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -0.000000000001f);
621 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0.000000000001f);
622 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, -0.000000000001f);
623 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.000000000001f);
624 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0.000000000001f);
625 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.000000000001f);
626 }
627 else
628 {
629 #region Documentation of capsule motor LowStop and HighStop parameters
630 // Intentionally introduce some tilt into the capsule by setting
631 // the motor stops to small epsilon values. This small tilt prevents
632 // the capsule from falling into the terrain; a straight-up capsule
633 // (with -0..0 motor stops) falls into the terrain for reasons yet
634 // to be comprehended in their entirety.
635 #endregion
636 AlignAvatarTiltWithCurrentDirectionOfMovement(Vector3.Zero);
637 d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0.08f);
638 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0f);
639 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0.08f);
640 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.08f); // must be same as lowstop, else a different, spurious tilt is introduced
641 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); // same as lowstop
642 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.08f); // same as lowstop
643 }
644
645 // Fudge factor is 1f by default, we're setting it to 0. We don't want it to Fudge or the
646 // capped cyllinder will fall over
647 d.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f);
648 d.JointSetAMotorParam(Amotor, (int)dParam.FMax, tensor);
649
650 //d.Matrix3 bodyrotation = d.BodyGetRotation(Body);
651 //d.QfromR(
652 //d.Matrix3 checkrotation = new d.Matrix3(0.7071068,0.5, -0.7071068,
653 //
654 //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22);
655 //standupStraight();
656
657 _parent_scene.geom_name_map[Shell] = Name;
658 _parent_scene.actor_name_map[Shell] = this;
659 }
660
661 /// <summary>
662 /// Uses the capped cyllinder volume formula to calculate the avatar's mass. 545 /// Uses the capped cyllinder volume formula to calculate the avatar's mass.
663 /// This may be used in calculations in the scene/scenepresence 546 /// This may be used in calculations in the scene/scenepresence
664 /// </summary> 547 /// </summary>
@@ -1126,6 +1009,123 @@ namespace OpenSim.Region.Physics.OdePlugin
1126 } 1009 }
1127 1010
1128 /// <summary> 1011 /// <summary>
1012 /// This creates the Avatar's physical Surrogate in ODE at the position supplied
1013 /// </summary>
1014 /// <remarks>
1015 /// WARNING: This MUST NOT be called outside of ProcessTaints, else we can have unsynchronized access
1016 /// to ODE internals. ProcessTaints is called from within thread-locked Simulate(), so it is the only
1017 /// place that is safe to call this routine AvatarGeomAndBodyCreation.
1018 /// </remarks>
1019 /// <param name="npositionX"></param>
1020 /// <param name="npositionY"></param>
1021 /// <param name="npositionZ"></param>
1022 /// <param name="tensor"></param>
1023 private void CreateOdeStructures(float npositionX, float npositionY, float npositionZ, float tensor)
1024 {
1025 int dAMotorEuler = 1;
1026// _parent_scene.waitForSpaceUnlock(_parent_scene.space);
1027 if (CAPSULE_LENGTH <= 0)
1028 {
1029 m_log.Warn("[ODE CHARACTER]: The capsule size you specified in opensim.ini is invalid! Setting it to the smallest possible size!");
1030 CAPSULE_LENGTH = 0.01f;
1031 }
1032
1033 if (CAPSULE_RADIUS <= 0)
1034 {
1035 m_log.Warn("[ODE CHARACTER]: The capsule size you specified in opensim.ini is invalid! Setting it to the smallest possible size!");
1036 CAPSULE_RADIUS = 0.01f;
1037 }
1038
1039 Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH);
1040
1041 d.GeomSetCategoryBits(Shell, (int)m_collisionCategories);
1042 d.GeomSetCollideBits(Shell, (int)m_collisionFlags);
1043
1044 d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH);
1045 Body = d.BodyCreate(_parent_scene.world);
1046 d.BodySetPosition(Body, npositionX, npositionY, npositionZ);
1047
1048 _position.X = npositionX;
1049 _position.Y = npositionY;
1050 _position.Z = npositionZ;
1051
1052 m_taintPosition = _position;
1053
1054 d.BodySetMass(Body, ref ShellMass);
1055 d.Matrix3 m_caprot;
1056 // 90 Stand up on the cap of the capped cyllinder
1057 if (_parent_scene.IsAvCapsuleTilted)
1058 {
1059 d.RFromAxisAndAngle(out m_caprot, 1, 0, 1, (float)(Math.PI / 2));
1060 }
1061 else
1062 {
1063 d.RFromAxisAndAngle(out m_caprot, 0, 0, 1, (float)(Math.PI / 2));
1064 }
1065
1066 d.GeomSetRotation(Shell, ref m_caprot);
1067 d.BodySetRotation(Body, ref m_caprot);
1068
1069 d.GeomSetBody(Shell, Body);
1070
1071 // The purpose of the AMotor here is to keep the avatar's physical
1072 // surrogate from rotating while moving
1073 Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero);
1074 d.JointAttach(Amotor, Body, IntPtr.Zero);
1075 d.JointSetAMotorMode(Amotor, dAMotorEuler);
1076 d.JointSetAMotorNumAxes(Amotor, 3);
1077 d.JointSetAMotorAxis(Amotor, 0, 0, 1, 0, 0);
1078 d.JointSetAMotorAxis(Amotor, 1, 0, 0, 1, 0);
1079 d.JointSetAMotorAxis(Amotor, 2, 0, 0, 0, 1);
1080 d.JointSetAMotorAngle(Amotor, 0, 0);
1081 d.JointSetAMotorAngle(Amotor, 1, 0);
1082 d.JointSetAMotorAngle(Amotor, 2, 0);
1083
1084 // These lowstops and high stops are effectively (no wiggle room)
1085 if (_parent_scene.IsAvCapsuleTilted)
1086 {
1087 d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -0.000000000001f);
1088 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0.000000000001f);
1089 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, -0.000000000001f);
1090 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.000000000001f);
1091 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0.000000000001f);
1092 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.000000000001f);
1093 }
1094 else
1095 {
1096 #region Documentation of capsule motor LowStop and HighStop parameters
1097 // Intentionally introduce some tilt into the capsule by setting
1098 // the motor stops to small epsilon values. This small tilt prevents
1099 // the capsule from falling into the terrain; a straight-up capsule
1100 // (with -0..0 motor stops) falls into the terrain for reasons yet
1101 // to be comprehended in their entirety.
1102 #endregion
1103 AlignAvatarTiltWithCurrentDirectionOfMovement(Vector3.Zero);
1104 d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0.08f);
1105 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0f);
1106 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0.08f);
1107 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.08f); // must be same as lowstop, else a different, spurious tilt is introduced
1108 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); // same as lowstop
1109 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.08f); // same as lowstop
1110 }
1111
1112 // Fudge factor is 1f by default, we're setting it to 0. We don't want it to Fudge or the
1113 // capped cyllinder will fall over
1114 d.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f);
1115 d.JointSetAMotorParam(Amotor, (int)dParam.FMax, tensor);
1116
1117 //d.Matrix3 bodyrotation = d.BodyGetRotation(Body);
1118 //d.QfromR(
1119 //d.Matrix3 checkrotation = new d.Matrix3(0.7071068,0.5, -0.7071068,
1120 //
1121 //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22);
1122 //standupStraight();
1123
1124 _parent_scene.geom_name_map[Shell] = Name;
1125 _parent_scene.actor_name_map[Shell] = this;
1126 }
1127
1128 /// <summary>
1129 /// Cleanup the things we use in the scene. 1129 /// Cleanup the things we use in the scene.
1130 /// </summary> 1130 /// </summary>
1131 internal void Destroy() 1131 internal void Destroy()
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index fec4693..94e6185 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -272,7 +272,6 @@ namespace OpenSim.Region.Physics.OdePlugin
272 272
273 m_taintadd = true; 273 m_taintadd = true;
274 _parent_scene.AddPhysicsActorTaint(this); 274 _parent_scene.AddPhysicsActorTaint(this);
275 // don't do .add() here; old geoms get recycled with the same hash
276 } 275 }
277 276
278 public override int PhysicsActorType 277 public override int PhysicsActorType
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index e219535..0456f56 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -377,8 +377,7 @@ namespace OpenSim.Region.Physics.OdePlugin
377 /// <param value="name">Name of the scene. Useful in debug messages.</param> 377 /// <param value="name">Name of the scene. Useful in debug messages.</param>
378 public OdeScene(string name) 378 public OdeScene(string name)
379 { 379 {
380 m_log 380 m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + name);
381 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + name);
382 381
383 Name = name; 382 Name = name;
384 383
@@ -769,7 +768,7 @@ namespace OpenSim.Region.Physics.OdePlugin
769 } 768 }
770 catch (AccessViolationException) 769 catch (AccessViolationException)
771 { 770 {
772 m_log.Warn("[PHYSICS]: Unable to collide test a space"); 771 m_log.Warn("[ODE SCENE]: Unable to collide test a space");
773 return; 772 return;
774 } 773 }
775 //Colliding a space or a geom with a space or a geom. so drill down 774 //Colliding a space or a geom with a space or a geom. so drill down
@@ -821,17 +820,17 @@ namespace OpenSim.Region.Physics.OdePlugin
821 820
822 count = d.Collide(g1, g2, contacts.Length, contacts, d.ContactGeom.SizeOf); 821 count = d.Collide(g1, g2, contacts.Length, contacts, d.ContactGeom.SizeOf);
823 if (count > contacts.Length) 822 if (count > contacts.Length)
824 m_log.Error("[PHYSICS]: Got " + count + " contacts when we asked for a maximum of " + contacts.Length); 823 m_log.Error("[ODE SCENE]: Got " + count + " contacts when we asked for a maximum of " + contacts.Length);
825 } 824 }
826 catch (SEHException) 825 catch (SEHException)
827 { 826 {
828 m_log.Error( 827 m_log.Error(
829 "[PHYSICS]: The Operating system shut down ODE because of corrupt memory. This could be a result of really irregular terrain. If this repeats continuously, restart using Basic Physics and terrain fill your terrain. Restarting the sim."); 828 "[ODE SCENE]: The Operating system shut down ODE because of corrupt memory. This could be a result of really irregular terrain. If this repeats continuously, restart using Basic Physics and terrain fill your terrain. Restarting the sim.");
830 base.TriggerPhysicsBasedRestart(); 829 base.TriggerPhysicsBasedRestart();
831 } 830 }
832 catch (Exception e) 831 catch (Exception e)
833 { 832 {
834 m_log.WarnFormat("[PHYSICS]: Unable to collide test an object: {0}", e.Message); 833 m_log.WarnFormat("[ODE SCENE]: Unable to collide test an object: {0}", e.Message);
835 return; 834 return;
836 } 835 }
837 836
@@ -1556,7 +1555,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1556 } 1555 }
1557 catch (AccessViolationException) 1556 catch (AccessViolationException)
1558 { 1557 {
1559 m_log.WarnFormat("[PHYSICS]: Unable to space collide {0}", Name); 1558 m_log.WarnFormat("[ODE SCENE]: Unable to space collide {0}", Name);
1560 } 1559 }
1561 1560
1562 //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y); 1561 //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y);
@@ -1587,13 +1586,13 @@ namespace OpenSim.Region.Physics.OdePlugin
1587 removeprims = new List<OdePrim>(); 1586 removeprims = new List<OdePrim>();
1588 } 1587 }
1589 removeprims.Add(chr); 1588 removeprims.Add(chr);
1590 m_log.Debug("[PHYSICS]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed. Removed it from the active prim list. This needs to be fixed!"); 1589 m_log.Debug("[ODE SCENE]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed. Removed it from the active prim list. This needs to be fixed!");
1591 } 1590 }
1592 } 1591 }
1593 } 1592 }
1594 catch (AccessViolationException) 1593 catch (AccessViolationException)
1595 { 1594 {
1596 m_log.Warn("[PHYSICS]: Unable to space collide"); 1595 m_log.Warn("[ODE SCENE]: Unable to space collide");
1597 } 1596 }
1598 } 1597 }
1599 } 1598 }
@@ -1729,18 +1728,24 @@ namespace OpenSim.Region.Physics.OdePlugin
1729 _characters.Add(chr); 1728 _characters.Add(chr);
1730 1729
1731 if (chr.bad) 1730 if (chr.bad)
1732 m_log.ErrorFormat("[PHYSICS] Added BAD actor {0} to characters list", chr.m_uuid); 1731 m_log.ErrorFormat("[ODE SCENE]: Added BAD actor {0} to characters list", chr.m_uuid);
1732 }
1733 else
1734 {
1735 m_log.ErrorFormat(
1736 "[ODE SCENE]: Tried to add character {0} {1} but they are already in the set!",
1737 chr.Name, chr.LocalID);
1733 } 1738 }
1734 } 1739 }
1735 1740
1736 internal void RemoveCharacter(OdeCharacter chr) 1741 internal void RemoveCharacter(OdeCharacter chr)
1737 { 1742 {
1738 if (_characters.Contains(chr)) 1743 if (_characters.Contains(chr))
1739 {
1740 _characters.Remove(chr); 1744 _characters.Remove(chr);
1741 geom_name_map.Remove(chr.Shell); 1745 else
1742 actor_name_map.Remove(chr.Shell); 1746 m_log.ErrorFormat(
1743 } 1747 "[ODE SCENE]: Tried to remove character {0} {1} but they are not in the list!",
1748 chr.Name, chr.LocalID);
1744 } 1749 }
1745 1750
1746 private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation, 1751 private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation,
@@ -2160,7 +2165,6 @@ namespace OpenSim.Region.Physics.OdePlugin
2160 2165
2161 p.setPrimForRemoval(); 2166 p.setPrimForRemoval();
2162 AddPhysicsActorTaint(prim); 2167 AddPhysicsActorTaint(prim);
2163 //RemovePrimThreadLocked(p);
2164 } 2168 }
2165 } 2169 }
2166 } 2170 }
@@ -2228,7 +2232,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2228 //m_log.Warn(prim.prim_geom); 2232 //m_log.Warn(prim.prim_geom);
2229 2233
2230 if (!prim.RemoveGeom()) 2234 if (!prim.RemoveGeom())
2231 m_log.Warn("[PHYSICS]: Unable to remove prim from physics scene"); 2235 m_log.Warn("[ODE SCENE]: Unable to remove prim from physics scene");
2232 2236
2233 lock (_prims) 2237 lock (_prims)
2234 _prims.Remove(prim); 2238 _prims.Remove(prim);
@@ -2320,7 +2324,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2320 } 2324 }
2321 else 2325 else
2322 { 2326 {
2323 m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + currentspace + 2327 m_log.Info("[ODE SCENE]: Invalid Scene passed to 'recalculatespace':" + currentspace +
2324 " Geom:" + geom); 2328 " Geom:" + geom);
2325 } 2329 }
2326 } 2330 }
@@ -2336,7 +2340,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2336 } 2340 }
2337 else 2341 else
2338 { 2342 {
2339 m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + 2343 m_log.Info("[ODE SCENE]: Invalid Scene passed to 'recalculatespace':" +
2340 sGeomIsIn + " Geom:" + geom); 2344 sGeomIsIn + " Geom:" + geom);
2341 } 2345 }
2342 } 2346 }
@@ -2359,7 +2363,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2359 } 2363 }
2360 else 2364 else
2361 { 2365 {
2362 m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + 2366 m_log.Info("[ODE SCENE]: Invalid Scene passed to 'recalculatespace':" +
2363 currentspace + " Geom:" + geom); 2367 currentspace + " Geom:" + geom);
2364 } 2368 }
2365 } 2369 }
@@ -2379,7 +2383,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2379 } 2383 }
2380 else 2384 else
2381 { 2385 {
2382 m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + 2386 m_log.Info("[ODE SCENE]: Invalid Scene passed to 'recalculatespace':" +
2383 currentspace + " Geom:" + geom); 2387 currentspace + " Geom:" + geom);
2384 } 2388 }
2385 } 2389 }
@@ -2395,7 +2399,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2395 } 2399 }
2396 else 2400 else
2397 { 2401 {
2398 m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + 2402 m_log.Info("[ODE SCENE]: Invalid Scene passed to 'recalculatespace':" +
2399 sGeomIsIn + " Geom:" + geom); 2403 sGeomIsIn + " Geom:" + geom);
2400 } 2404 }
2401 } 2405 }
@@ -2607,15 +2611,17 @@ namespace OpenSim.Region.Physics.OdePlugin
2607 2611
2608 /// <summary> 2612 /// <summary>
2609 /// Called after our prim properties are set Scale, position etc. 2613 /// Called after our prim properties are set Scale, position etc.
2614 /// </summary>
2615 /// <remarks>
2610 /// We use this event queue like method to keep changes to the physical scene occuring in the threadlocked mutex 2616 /// We use this event queue like method to keep changes to the physical scene occuring in the threadlocked mutex
2611 /// This assures us that we have no race conditions 2617 /// This assures us that we have no race conditions
2612 /// </summary> 2618 /// </remarks>
2613 /// <param name="prim"></param> 2619 /// <param name="actor"></param>
2614 public override void AddPhysicsActorTaint(PhysicsActor prim) 2620 public override void AddPhysicsActorTaint(PhysicsActor actor)
2615 { 2621 {
2616 if (prim is OdePrim) 2622 if (actor is OdePrim)
2617 { 2623 {
2618 OdePrim taintedprim = ((OdePrim) prim); 2624 OdePrim taintedprim = ((OdePrim)actor);
2619 lock (_taintedPrimLock) 2625 lock (_taintedPrimLock)
2620 { 2626 {
2621 if (!(_taintedPrimH.Contains(taintedprim))) 2627 if (!(_taintedPrimH.Contains(taintedprim)))
@@ -2627,18 +2633,17 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
2627 _taintedPrimL.Add(taintedprim); // List for ordered readout 2633 _taintedPrimL.Add(taintedprim); // List for ordered readout
2628 } 2634 }
2629 } 2635 }
2630 return;
2631 } 2636 }
2632 else if (prim is OdeCharacter) 2637 else if (actor is OdeCharacter)
2633 { 2638 {
2634 OdeCharacter taintedchar = ((OdeCharacter)prim); 2639 OdeCharacter taintedchar = ((OdeCharacter)actor);
2635 lock (_taintedActors) 2640 lock (_taintedActors)
2636 { 2641 {
2637 if (!(_taintedActors.Contains(taintedchar))) 2642 if (!(_taintedActors.Contains(taintedchar)))
2638 { 2643 {
2639 _taintedActors.Add(taintedchar); 2644 _taintedActors.Add(taintedchar);
2640 if (taintedchar.bad) 2645 if (taintedchar.bad)
2641 m_log.DebugFormat("[PHYSICS]: Added BAD actor {0} to tainted actors", taintedchar.m_uuid); 2646 m_log.DebugFormat("[ODE SCENE]: Added BAD actor {0} to tainted actors", taintedchar.m_uuid);
2642 } 2647 }
2643 } 2648 }
2644 } 2649 }
@@ -2734,29 +2739,18 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
2734 { 2739 {
2735 try 2740 try
2736 { 2741 {
2737 // Insert, remove Characters
2738 bool processedtaints = false;
2739
2740 lock (_taintedActors) 2742 lock (_taintedActors)
2741 { 2743 {
2742 if (_taintedActors.Count > 0) 2744 if (_taintedActors.Count > 0)
2743 { 2745 {
2744 foreach (OdeCharacter character in _taintedActors) 2746 foreach (OdeCharacter character in _taintedActors)
2745 {
2746 character.ProcessTaints(); 2747 character.ProcessTaints();
2747 2748
2748 processedtaints = true; 2749 if (_taintedActors.Count > 0)
2749 //character.m_collisionscore = 0;
2750 }
2751
2752 if (processedtaints)
2753 _taintedActors.Clear(); 2750 _taintedActors.Clear();
2754 } 2751 }
2755 } 2752 }
2756 2753
2757 // Modify other objects in the scene.
2758 processedtaints = false;
2759
2760 lock (_taintedPrimLock) 2754 lock (_taintedPrimLock)
2761 { 2755 {
2762 foreach (OdePrim prim in _taintedPrimL) 2756 foreach (OdePrim prim in _taintedPrimL)
@@ -2772,7 +2766,6 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
2772 prim.ProcessTaints(); 2766 prim.ProcessTaints();
2773 } 2767 }
2774 2768
2775 processedtaints = true;
2776 prim.m_collisionscore = 0; 2769 prim.m_collisionscore = 0;
2777 2770
2778 // This loop can block up the Heartbeat for a very long time on large regions. 2771 // This loop can block up the Heartbeat for a very long time on large regions.
@@ -2785,7 +2778,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
2785 if (SupportsNINJAJoints) 2778 if (SupportsNINJAJoints)
2786 SimulatePendingNINJAJoints(); 2779 SimulatePendingNINJAJoints();
2787 2780
2788 if (processedtaints) 2781 if (_taintedPrimL.Count > 0)
2789 { 2782 {
2790//Console.WriteLine("Simulate calls Clear of _taintedPrim list"); 2783//Console.WriteLine("Simulate calls Clear of _taintedPrim list");
2791 _taintedPrimH.Clear(); 2784 _taintedPrimH.Clear();
@@ -2853,7 +2846,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
2853 } 2846 }
2854 catch (Exception e) 2847 catch (Exception e)
2855 { 2848 {
2856 m_log.ErrorFormat("[PHYSICS]: {0}, {1}, {2}", e.Message, e.TargetSite, e); 2849 m_log.ErrorFormat("[ODE SCENE]: {0}, {1}, {2}", e.Message, e.TargetSite, e);
2857 } 2850 }
2858 2851
2859 timeLeft -= ODE_STEPSIZE; 2852 timeLeft -= ODE_STEPSIZE;
@@ -2862,7 +2855,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
2862 foreach (OdeCharacter actor in _characters) 2855 foreach (OdeCharacter actor in _characters)
2863 { 2856 {
2864 if (actor.bad) 2857 if (actor.bad)
2865 m_log.WarnFormat("[PHYSICS]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid); 2858 m_log.WarnFormat("[ODE SCENE]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid);
2866 2859
2867 actor.UpdatePositionAndVelocity(defects); 2860 actor.UpdatePositionAndVelocity(defects);
2868 } 2861 }
@@ -3422,7 +3415,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
3422 { 3415 {
3423 if (Single.IsNaN(resultarr2[y, x]) || Single.IsInfinity(resultarr2[y, x])) 3416 if (Single.IsNaN(resultarr2[y, x]) || Single.IsInfinity(resultarr2[y, x]))
3424 { 3417 {
3425 m_log.Warn("[PHYSICS]: Non finite heightfield element detected. Setting it to 0"); 3418 m_log.Warn("[ODE SCENE]: Non finite heightfield element detected. Setting it to 0");
3426 resultarr2[y, x] = 0; 3419 resultarr2[y, x] = 0;
3427 } 3420 }
3428 returnarr[i] = resultarr2[y, x]; 3421 returnarr[i] = resultarr2[y, x];
@@ -3453,7 +3446,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
3453 private void SetTerrain(float[] heightMap, Vector3 pOffset) 3446 private void SetTerrain(float[] heightMap, Vector3 pOffset)
3454 { 3447 {
3455 int startTime = Util.EnvironmentTickCount(); 3448 int startTime = Util.EnvironmentTickCount();
3456 m_log.DebugFormat("[PHYSICS]: Setting terrain for {0}", Name); 3449 m_log.DebugFormat("[ODE SCENE]: Setting terrain for {0}", Name);
3457 3450
3458 // this._heightmap[i] = (double)heightMap[i]; 3451 // this._heightmap[i] = (double)heightMap[i];
3459 // dbm (danx0r) -- creating a buffer zone of one extra sample all around 3452 // dbm (danx0r) -- creating a buffer zone of one extra sample all around
@@ -3578,7 +3571,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
3578 } 3571 }
3579 3572
3580 m_log.DebugFormat( 3573 m_log.DebugFormat(
3581 "[PHYSICS]: Setting terrain for {0} took {1}ms", Name, Util.EnvironmentTickCountSubtract(startTime)); 3574 "[ODE SCENE]: Setting terrain for {0} took {1}ms", Name, Util.EnvironmentTickCountSubtract(startTime));
3582 } 3575 }
3583 3576
3584 public override void DeleteTerrain() 3577 public override void DeleteTerrain()
@@ -3595,64 +3588,64 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
3595 return true; 3588 return true;
3596 } 3589 }
3597 3590
3598 public override void UnCombine(PhysicsScene pScene) 3591// public override void UnCombine(PhysicsScene pScene)
3599 { 3592// {
3600 IntPtr localGround = IntPtr.Zero; 3593// IntPtr localGround = IntPtr.Zero;
3601// float[] localHeightfield; 3594//// float[] localHeightfield;
3602 bool proceed = false; 3595// bool proceed = false;
3603 List<IntPtr> geomDestroyList = new List<IntPtr>(); 3596// List<IntPtr> geomDestroyList = new List<IntPtr>();
3604 3597//
3605 lock (OdeLock) 3598// lock (OdeLock)
3606 { 3599// {
3607 if (RegionTerrain.TryGetValue(Vector3.Zero, out localGround)) 3600// if (RegionTerrain.TryGetValue(Vector3.Zero, out localGround))
3608 { 3601// {
3609 foreach (IntPtr geom in TerrainHeightFieldHeights.Keys) 3602// foreach (IntPtr geom in TerrainHeightFieldHeights.Keys)
3610 { 3603// {
3611 if (geom == localGround) 3604// if (geom == localGround)
3612 { 3605// {
3613// localHeightfield = TerrainHeightFieldHeights[geom]; 3606//// localHeightfield = TerrainHeightFieldHeights[geom];
3614 proceed = true; 3607// proceed = true;
3615 } 3608// }
3616 else 3609// else
3617 { 3610// {
3618 geomDestroyList.Add(geom); 3611// geomDestroyList.Add(geom);
3619 } 3612// }
3620 } 3613// }
3621 3614//
3622 if (proceed) 3615// if (proceed)
3623 { 3616// {
3624 m_worldOffset = Vector3.Zero; 3617// m_worldOffset = Vector3.Zero;
3625 WorldExtents = new Vector2((int)Constants.RegionSize, (int)Constants.RegionSize); 3618// WorldExtents = new Vector2((int)Constants.RegionSize, (int)Constants.RegionSize);
3626 m_parentScene = null; 3619// m_parentScene = null;
3627 3620//
3628 foreach (IntPtr g in geomDestroyList) 3621// foreach (IntPtr g in geomDestroyList)
3629 { 3622// {
3630 // removingHeightField needs to be done or the garbage collector will 3623// // removingHeightField needs to be done or the garbage collector will
3631 // collect the terrain data before we tell ODE to destroy it causing 3624// // collect the terrain data before we tell ODE to destroy it causing
3632 // memory corruption 3625// // memory corruption
3633 if (TerrainHeightFieldHeights.ContainsKey(g)) 3626// if (TerrainHeightFieldHeights.ContainsKey(g))
3634 { 3627// {
3635// float[] removingHeightField = TerrainHeightFieldHeights[g]; 3628//// float[] removingHeightField = TerrainHeightFieldHeights[g];
3636 TerrainHeightFieldHeights.Remove(g); 3629// TerrainHeightFieldHeights.Remove(g);
3637 3630//
3638 if (RegionTerrain.ContainsKey(g)) 3631// if (RegionTerrain.ContainsKey(g))
3639 { 3632// {
3640 RegionTerrain.Remove(g); 3633// RegionTerrain.Remove(g);
3641 } 3634// }
3642 3635//
3643 d.GeomDestroy(g); 3636// d.GeomDestroy(g);
3644 //removingHeightField = new float[0]; 3637// //removingHeightField = new float[0];
3645 } 3638// }
3646 } 3639// }
3647 3640//
3648 } 3641// }
3649 else 3642// else
3650 { 3643// {
3651 m_log.Warn("[PHYSICS]: Couldn't proceed with UnCombine. Region has inconsistant data."); 3644// m_log.Warn("[PHYSICS]: Couldn't proceed with UnCombine. Region has inconsistant data.");
3652 } 3645// }
3653 } 3646// }
3654 } 3647// }
3655 } 3648// }
3656 3649
3657 public override void SetWaterLevel(float baseheight) 3650 public override void SetWaterLevel(float baseheight)
3658 { 3651 {
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
index 92cbbc6..3f9834c 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
@@ -841,33 +841,33 @@ namespace OpenSim.Region.RegionCombinerModule
841 { 841 {
842 } 842 }
843 843
844 /// <summary> 844// /// <summary>
845 /// TODO: 845// /// TODO:
846 /// </summary> 846// /// </summary>
847 /// <param name="rdata"></param> 847// /// <param name="rdata"></param>
848 public void UnCombineRegion(RegionData rdata) 848// public void UnCombineRegion(RegionData rdata)
849 { 849// {
850 lock (m_regions) 850// lock (m_regions)
851 { 851// {
852 if (m_regions.ContainsKey(rdata.RegionId)) 852// if (m_regions.ContainsKey(rdata.RegionId))
853 { 853// {
854 // uncombine root region and virtual regions 854// // uncombine root region and virtual regions
855 } 855// }
856 else 856// else
857 { 857// {
858 foreach (RegionConnections r in m_regions.Values) 858// foreach (RegionConnections r in m_regions.Values)
859 { 859// {
860 foreach (RegionData rd in r.ConnectedRegions) 860// foreach (RegionData rd in r.ConnectedRegions)
861 { 861// {
862 if (rd.RegionId == rdata.RegionId) 862// if (rd.RegionId == rdata.RegionId)
863 { 863// {
864 // uncombine virtual region 864// // uncombine virtual region
865 } 865// }
866 } 866// }
867 } 867// }
868 } 868// }
869 } 869// }
870 } 870// }
871 871
872 // Create a set of infinite borders around the whole aabb of the combined island. 872 // Create a set of infinite borders around the whole aabb of the combined island.
873 private void AdjustLargeRegionBounds() 873 private void AdjustLargeRegionBounds()