aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2011-10-30 10:16:25 +0000
committerMelanie2011-10-30 10:16:25 +0000
commit083b28de8c45589a43ce6ceed4dbfb70c698f2d0 (patch)
treefc494b5d401bf2190e8c2d9ee027021f330d6285 /OpenSim
parentFix the offline message module to revert core changes and restore avn (diff)
parentAdd missing max_listens_per_region to [LL_Functions] config section in OpenSi... (diff)
downloadopensim-SC_OLD-083b28de8c45589a43ce6ceed4dbfb70c698f2d0.zip
opensim-SC_OLD-083b28de8c45589a43ce6ceed4dbfb70c698f2d0.tar.gz
opensim-SC_OLD-083b28de8c45589a43ce6ceed4dbfb70c698f2d0.tar.bz2
opensim-SC_OLD-083b28de8c45589a43ce6ceed4dbfb70c698f2d0.tar.xz
Merge branch 'master' into bigmerge
Conflicts: OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs38
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs33
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs25
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs18
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs126
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs2
10 files changed, 125 insertions, 139 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 0e82859..30acbdf 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -4925,8 +4925,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4925 4925
4926 data.CollisionPlane.ToBytes(objectData, 0); 4926 data.CollisionPlane.ToBytes(objectData, 0);
4927 data.OffsetPosition.ToBytes(objectData, 16); 4927 data.OffsetPosition.ToBytes(objectData, 16);
4928 //data.Velocity.ToBytes(objectData, 28); 4928// data.Velocity.ToBytes(objectData, 28);
4929 //data.Acceleration.ToBytes(objectData, 40); 4929// data.Acceleration.ToBytes(objectData, 40);
4930 data.Rotation.ToBytes(objectData, 52); 4930 data.Rotation.ToBytes(objectData, 52);
4931 //data.AngularVelocity.ToBytes(objectData, 64); 4931 //data.AngularVelocity.ToBytes(objectData, 64);
4932 4932
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 7263b51..26151bf 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1712,7 +1712,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1712 1712
1713 // Offset the positions for the new region across the border 1713 // Offset the positions for the new region across the border
1714 Vector3 oldGroupPosition = grp.RootPart.GroupPosition; 1714 Vector3 oldGroupPosition = grp.RootPart.GroupPosition;
1715 grp.OffsetForNewRegion(pos); 1715 grp.RootPart.GroupPosition = pos;
1716 1716
1717 // If we fail to cross the border, then reset the position of the scene object on that border. 1717 // If we fail to cross the border, then reset the position of the scene object on that border.
1718 uint x = 0, y = 0; 1718 uint x = 0, y = 0;
@@ -1720,7 +1720,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1720 GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); 1720 GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
1721 if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, silent)) 1721 if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, silent))
1722 { 1722 {
1723 grp.OffsetForNewRegion(oldGroupPosition); 1723 grp.RootPart.GroupPosition = oldGroupPosition;
1724 grp.ScheduleGroupForFullUpdate(); 1724 grp.ScheduleGroupForFullUpdate();
1725 } 1725 }
1726 } 1726 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 0cb6681..bad2b21 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -528,12 +528,6 @@ namespace OpenSim.Region.Framework.Scenes
528 } 528 }
529 } 529 }
530 530
531 // This gets locked so things stay thread safe.
532 public object SyncRoot
533 {
534 get { return m_sceneGraph.m_syncRoot; }
535 }
536
537 public string DefaultScriptEngine 531 public string DefaultScriptEngine
538 { 532 {
539 get { return m_defaultScriptEngine; } 533 get { return m_defaultScriptEngine; }
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index a4080ca..a6178e7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -93,8 +93,6 @@ namespace OpenSim.Region.Framework.Scenes
93 protected int m_activeScripts = 0; 93 protected int m_activeScripts = 0;
94 protected int m_scriptLPS = 0; 94 protected int m_scriptLPS = 0;
95 95
96 protected internal object m_syncRoot = new object();
97
98 protected internal PhysicsScene _PhyScene; 96 protected internal PhysicsScene _PhyScene;
99 97
100 /// <summary> 98 /// <summary>
@@ -201,26 +199,22 @@ namespace OpenSim.Region.Framework.Scenes
201 /// <returns></returns> 199 /// <returns></returns>
202 protected internal float UpdatePhysics(double elapsed) 200 protected internal float UpdatePhysics(double elapsed)
203 { 201 {
204 lock (m_syncRoot) 202 // Here is where the Scene calls the PhysicsScene. This is a one-way
205 { 203 // interaction; the PhysicsScene cannot access the calling Scene directly.
206 // Here is where the Scene calls the PhysicsScene. This is a one-way 204 // But with joints, we want a PhysicsActor to be able to influence a
207 // interaction; the PhysicsScene cannot access the calling Scene directly. 205 // non-physics SceneObjectPart. In particular, a PhysicsActor that is connected
208 // But with joints, we want a PhysicsActor to be able to influence a 206 // with a joint should be able to move the SceneObjectPart which is the visual
209 // non-physics SceneObjectPart. In particular, a PhysicsActor that is connected 207 // representation of that joint (for editing and serialization purposes).
210 // with a joint should be able to move the SceneObjectPart which is the visual 208 // However the PhysicsActor normally cannot directly influence anything outside
211 // representation of that joint (for editing and serialization purposes). 209 // of the PhysicsScene, and the non-physical SceneObjectPart which represents
212 // However the PhysicsActor normally cannot directly influence anything outside 210 // the joint in the Scene does not exist in the PhysicsScene.
213 // of the PhysicsScene, and the non-physical SceneObjectPart which represents 211 //
214 // the joint in the Scene does not exist in the PhysicsScene. 212 // To solve this, we have an event in the PhysicsScene that is fired when a joint
215 // 213 // has changed position (because one of its associated PhysicsActors has changed
216 // To solve this, we have an event in the PhysicsScene that is fired when a joint 214 // position).
217 // has changed position (because one of its associated PhysicsActors has changed 215 //
218 // position). 216 // Therefore, JointMoved and JointDeactivated events will be fired as a result of the following Simulate().
219 // 217 return _PhyScene.Simulate((float)elapsed);
220 // Therefore, JointMoved and JointDeactivated events will be fired as a result of the following Simulate().
221
222 return _PhyScene.Simulate((float)elapsed);
223 }
224 } 218 }
225 219
226 protected internal void UpdateScenePresenceMovement() 220 protected internal void UpdateScenePresenceMovement()
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 5381f63..8b71f5b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -344,15 +344,15 @@ namespace OpenSim.Region.Framework.Scenes
344 get { return m_parts.Count; } 344 get { return m_parts.Count; }
345 } 345 }
346 346
347 protected Quaternion m_rotation = Quaternion.Identity; 347// protected Quaternion m_rotation = Quaternion.Identity;
348 348//
349 public virtual Quaternion Rotation 349// public virtual Quaternion Rotation
350 { 350// {
351 get { return m_rotation; } 351// get { return m_rotation; }
352 set { 352// set {
353 m_rotation = value; 353// m_rotation = value;
354 } 354// }
355 } 355// }
356 356
357 public Quaternion GroupRotation 357 public Quaternion GroupRotation
358 { 358 {
@@ -3216,17 +3216,12 @@ namespace OpenSim.Region.Framework.Scenes
3216 } 3216 }
3217 } 3217 }
3218 3218
3219 public void OffsetForNewRegion(Vector3 offset)
3220 {
3221 m_rootPart.GroupPosition = offset;
3222 }
3223
3224 #endregion 3219 #endregion
3225 3220
3226 #region Rotation 3221 #region Rotation
3227 3222
3228 /// <summary> 3223 /// <summary>
3229 /// 3224 /// Update the rotation of the group.
3230 /// </summary> 3225 /// </summary>
3231 /// <param name="rot"></param> 3226 /// <param name="rot"></param>
3232 public void UpdateGroupRotationR(Quaternion rot) 3227 public void UpdateGroupRotationR(Quaternion rot)
@@ -3254,7 +3249,7 @@ namespace OpenSim.Region.Framework.Scenes
3254 } 3249 }
3255 3250
3256 /// <summary> 3251 /// <summary>
3257 /// 3252 /// Update the position and rotation of a group simultaneously.
3258 /// </summary> 3253 /// </summary>
3259 /// <param name="pos"></param> 3254 /// <param name="pos"></param>
3260 /// <param name="rot"></param> 3255 /// <param name="rot"></param>
@@ -3288,7 +3283,7 @@ namespace OpenSim.Region.Framework.Scenes
3288 } 3283 }
3289 3284
3290 /// <summary> 3285 /// <summary>
3291 /// 3286 /// Update the rotation of a single prim within the group.
3292 /// </summary> 3287 /// </summary>
3293 /// <param name="rot"></param> 3288 /// <param name="rot"></param>
3294 /// <param name="localID"></param> 3289 /// <param name="localID"></param>
@@ -3314,7 +3309,7 @@ namespace OpenSim.Region.Framework.Scenes
3314 } 3309 }
3315 3310
3316 /// <summary> 3311 /// <summary>
3317 /// 3312 /// Update the position and rotation simultaneously of a single prim within the group.
3318 /// </summary> 3313 /// </summary>
3319 /// <param name="rot"></param> 3314 /// <param name="rot"></param>
3320 /// <param name="localID"></param> 3315 /// <param name="localID"></param>
@@ -3355,7 +3350,7 @@ namespace OpenSim.Region.Framework.Scenes
3355 } 3350 }
3356 3351
3357 /// <summary> 3352 /// <summary>
3358 /// 3353 /// Update the entire rotation of the group.
3359 /// </summary> 3354 /// </summary>
3360 /// <param name="rot"></param> 3355 /// <param name="rot"></param>
3361 public void UpdateRootRotation(Quaternion rot) 3356 public void UpdateRootRotation(Quaternion rot)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 0a8edf9..a2e13ce 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -821,7 +821,14 @@ namespace OpenSim.Region.Framework.Scenes
821 m_rotationOffset = actor.Orientation; 821 m_rotationOffset = actor.Orientation;
822 } 822 }
823 } 823 }
824 824
825// float roll, pitch, yaw = 0;
826// m_rotationOffset.GetEulerAngles(out roll, out pitch, out yaw);
827//
828// m_log.DebugFormat(
829// "[SCENE OBJECT PART]: Got euler {0} for RotationOffset on {1} {2}",
830// new Vector3(roll, pitch, yaw), Name, LocalId);
831
825 return m_rotationOffset; 832 return m_rotationOffset;
826 } 833 }
827 834
@@ -858,6 +865,13 @@ namespace OpenSim.Region.Framework.Scenes
858 m_log.Error("[SCENEOBJECTPART]: ROTATIONOFFSET" + ex.Message); 865 m_log.Error("[SCENEOBJECTPART]: ROTATIONOFFSET" + ex.Message);
859 } 866 }
860 } 867 }
868
869// float roll, pitch, yaw = 0;
870// m_rotationOffset.GetEulerAngles(out roll, out pitch, out yaw);
871//
872// m_log.DebugFormat(
873// "[SCENE OBJECT PART]: Set euler {0} for RotationOffset on {1} {2}",
874// new Vector3(roll, pitch, yaw), Name, LocalId);
861 } 875 }
862 } 876 }
863 877
@@ -4548,12 +4562,13 @@ namespace OpenSim.Region.Framework.Scenes
4548 PhysActor = null; 4562 PhysActor = null;
4549 } 4563 }
4550 4564
4565 /// <summary>
4566 /// This updates the part's rotation and sends out an update to clients if necessary.
4567 /// </summary>
4568 /// <param name="rot"></param>
4551 public void UpdateRotation(Quaternion rot) 4569 public void UpdateRotation(Quaternion rot)
4552 { 4570 {
4553 if ((rot.X != RotationOffset.X) || 4571 if (rot != RotationOffset)
4554 (rot.Y != RotationOffset.Y) ||
4555 (rot.Z != RotationOffset.Z) ||
4556 (rot.W != RotationOffset.W))
4557 { 4572 {
4558 RotationOffset = rot; 4573 RotationOffset = rot;
4559 4574
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 35870c5..d8939fc 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -548,8 +548,7 @@ namespace OpenSim.Region.Framework.Scenes
548 { 548 {
549 try 549 try
550 { 550 {
551 lock (m_scene.SyncRoot) 551 PhysicsActor.Position = value;
552 PhysicsActor.Position = value;
553 } 552 }
554 catch (Exception e) 553 catch (Exception e)
555 { 554 {
@@ -601,8 +600,7 @@ namespace OpenSim.Region.Framework.Scenes
601 { 600 {
602 try 601 try
603 { 602 {
604 lock (m_scene.SyncRoot) 603 PhysicsActor.Velocity = value;
605 PhysicsActor.Velocity = value;
606 } 604 }
607 catch (Exception e) 605 catch (Exception e)
608 { 606 {
@@ -1904,7 +1902,7 @@ namespace OpenSim.Region.Framework.Scenes
1904 1902
1905 Rotation = Quaternion.CreateFromEulers(angle); 1903 Rotation = Quaternion.CreateFromEulers(angle);
1906// m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, Rotation); 1904// m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, Rotation);
1907 1905
1908 Vector3 agent_control_v3 = new Vector3(); 1906 Vector3 agent_control_v3 = new Vector3();
1909 HandleMoveToTargetUpdate(ref agent_control_v3); 1907 HandleMoveToTargetUpdate(ref agent_control_v3);
1910 AddNewMovement(agent_control_v3); 1908 AddNewMovement(agent_control_v3);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index 2912a46..90cdd7b 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -62,9 +62,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
62 62
63 grp1.AbsolutePosition = new Vector3(10, 10, 10); 63 grp1.AbsolutePosition = new Vector3(10, 10, 10);
64 grp2.AbsolutePosition = Vector3.Zero; 64 grp2.AbsolutePosition = Vector3.Zero;
65 65
66 // <90,0,0> 66 // <90,0,0>
67 grp1.Rotation = (Quaternion.CreateFromEulers(90 * Utils.DEG_TO_RAD, 0, 0)); 67// grp1.UpdateGroupRotationR(Quaternion.CreateFromEulers(90 * Utils.DEG_TO_RAD, 0, 0));
68 68
69 // <180,0,0> 69 // <180,0,0>
70 grp2.UpdateGroupRotationR(Quaternion.CreateFromEulers(180 * Utils.DEG_TO_RAD, 0, 0)); 70 grp2.UpdateGroupRotationR(Quaternion.CreateFromEulers(180 * Utils.DEG_TO_RAD, 0, 0));
@@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
85 if (debugtest) 85 if (debugtest)
86 { 86 {
87 m_log.Debug("parts: " + grp1.Parts.Length); 87 m_log.Debug("parts: " + grp1.Parts.Length);
88 m_log.Debug("Group1: Pos:"+grp1.AbsolutePosition+", Rot:"+grp1.Rotation); 88 m_log.Debug("Group1: Pos:"+grp1.AbsolutePosition+", Rot:"+grp1.GroupRotation);
89 m_log.Debug("Group1: Prim1: OffsetPosition:"+ part1.OffsetPosition+", OffsetRotation:"+part1.RotationOffset); 89 m_log.Debug("Group1: Prim1: OffsetPosition:"+ part1.OffsetPosition+", OffsetRotation:"+part1.RotationOffset);
90 m_log.Debug("Group1: Prim2: OffsetPosition:"+part2.OffsetPosition+", OffsetRotation:"+part2.RotationOffset); 90 m_log.Debug("Group1: Prim2: OffsetPosition:"+part2.OffsetPosition+", OffsetRotation:"+part2.RotationOffset);
91 } 91 }
@@ -152,13 +152,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
152 grp4.AbsolutePosition = new Vector3(40, 40, 40); 152 grp4.AbsolutePosition = new Vector3(40, 40, 40);
153 153
154 // <90,0,0> 154 // <90,0,0>
155 grp1.Rotation = (Quaternion.CreateFromEulers(90 * Utils.DEG_TO_RAD, 0, 0)); 155// grp1.UpdateGroupRotationR(Quaternion.CreateFromEulers(90 * Utils.DEG_TO_RAD, 0, 0));
156 156
157 // <180,0,0> 157 // <180,0,0>
158 grp2.UpdateGroupRotationR(Quaternion.CreateFromEulers(180 * Utils.DEG_TO_RAD, 0, 0)); 158 grp2.UpdateGroupRotationR(Quaternion.CreateFromEulers(180 * Utils.DEG_TO_RAD, 0, 0));
159 159
160 // <270,0,0> 160 // <270,0,0>
161 grp3.Rotation = (Quaternion.CreateFromEulers(270 * Utils.DEG_TO_RAD, 0, 0)); 161// grp3.UpdateGroupRotationR(Quaternion.CreateFromEulers(270 * Utils.DEG_TO_RAD, 0, 0));
162 162
163 // <0,90,0> 163 // <0,90,0>
164 grp4.UpdateGroupRotationR(Quaternion.CreateFromEulers(0, 90 * Utils.DEG_TO_RAD, 0)); 164 grp4.UpdateGroupRotationR(Quaternion.CreateFromEulers(0, 90 * Utils.DEG_TO_RAD, 0));
@@ -187,12 +187,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
187 { 187 {
188 m_log.Debug("--------After Link-------"); 188 m_log.Debug("--------After Link-------");
189 m_log.Debug("Group1: parts:" + grp1.Parts.Length); 189 m_log.Debug("Group1: parts:" + grp1.Parts.Length);
190 m_log.Debug("Group1: Pos:"+grp1.AbsolutePosition+", Rot:"+grp1.Rotation); 190 m_log.Debug("Group1: Pos:"+grp1.AbsolutePosition+", Rot:"+grp1.GroupRotation);
191 m_log.Debug("Group1: Prim1: OffsetPosition:" + part1.OffsetPosition + ", OffsetRotation:" + part1.RotationOffset); 191 m_log.Debug("Group1: Prim1: OffsetPosition:" + part1.OffsetPosition + ", OffsetRotation:" + part1.RotationOffset);
192 m_log.Debug("Group1: Prim2: OffsetPosition:"+part2.OffsetPosition+", OffsetRotation:"+ part2.RotationOffset); 192 m_log.Debug("Group1: Prim2: OffsetPosition:"+part2.OffsetPosition+", OffsetRotation:"+ part2.RotationOffset);
193 193
194 m_log.Debug("Group3: parts:" + grp3.Parts.Length); 194 m_log.Debug("Group3: parts:" + grp3.Parts.Length);
195 m_log.Debug("Group3: Pos:"+grp3.AbsolutePosition+", Rot:"+grp3.Rotation); 195 m_log.Debug("Group3: Pos:"+grp3.AbsolutePosition+", Rot:"+grp3.GroupRotation);
196 m_log.Debug("Group3: Prim1: OffsetPosition:"+part3.OffsetPosition+", OffsetRotation:"+part3.RotationOffset); 196 m_log.Debug("Group3: Prim1: OffsetPosition:"+part3.OffsetPosition+", OffsetRotation:"+part3.RotationOffset);
197 m_log.Debug("Group3: Prim2: OffsetPosition:"+part4.OffsetPosition+", OffsetRotation:"+part4.RotationOffset); 197 m_log.Debug("Group3: Prim2: OffsetPosition:"+part4.OffsetPosition+", OffsetRotation:"+part4.RotationOffset);
198 } 198 }
@@ -240,12 +240,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
240 { 240 {
241 m_log.Debug("--------After De-Link-------"); 241 m_log.Debug("--------After De-Link-------");
242 m_log.Debug("Group1: parts:" + grp1.Parts.Length); 242 m_log.Debug("Group1: parts:" + grp1.Parts.Length);
243 m_log.Debug("Group1: Pos:" + grp1.AbsolutePosition + ", Rot:" + grp1.Rotation); 243 m_log.Debug("Group1: Pos:" + grp1.AbsolutePosition + ", Rot:" + grp1.GroupRotation);
244 m_log.Debug("Group1: Prim1: OffsetPosition:" + part1.OffsetPosition + ", OffsetRotation:" + part1.RotationOffset); 244 m_log.Debug("Group1: Prim1: OffsetPosition:" + part1.OffsetPosition + ", OffsetRotation:" + part1.RotationOffset);
245 m_log.Debug("Group1: Prim2: OffsetPosition:" + part2.OffsetPosition + ", OffsetRotation:" + part2.RotationOffset); 245 m_log.Debug("Group1: Prim2: OffsetPosition:" + part2.OffsetPosition + ", OffsetRotation:" + part2.RotationOffset);
246 246
247 m_log.Debug("Group3: parts:" + grp3.Parts.Length); 247 m_log.Debug("Group3: parts:" + grp3.Parts.Length);
248 m_log.Debug("Group3: Pos:" + grp3.AbsolutePosition + ", Rot:" + grp3.Rotation); 248 m_log.Debug("Group3: Pos:" + grp3.AbsolutePosition + ", Rot:" + grp3.GroupRotation);
249 m_log.Debug("Group3: Prim1: OffsetPosition:" + part3.OffsetPosition + ", OffsetRotation:" + part3.RotationOffset); 249 m_log.Debug("Group3: Prim1: OffsetPosition:" + part3.OffsetPosition + ", OffsetRotation:" + part3.RotationOffset);
250 m_log.Debug("Group3: Prim2: OffsetPosition:" + part4.OffsetPosition + ", OffsetRotation:" + part4.RotationOffset); 250 m_log.Debug("Group3: Prim2: OffsetPosition:" + part4.OffsetPosition + ", OffsetRotation:" + part4.RotationOffset);
251 } 251 }
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index c22d27f..f93d7ba 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -74,6 +74,7 @@ namespace OpenSim.Region.Physics.OdePlugin
74 private bool _zeroFlag = false; 74 private bool _zeroFlag = false;
75 private bool m_lastUpdateSent = false; 75 private bool m_lastUpdateSent = false;
76 private Vector3 _velocity; 76 private Vector3 _velocity;
77 private Vector3 m_taintTargetVelocity;
77 private Vector3 _target_velocity; 78 private Vector3 _target_velocity;
78 private Vector3 _acceleration; 79 private Vector3 _acceleration;
79 private Vector3 m_rotationalVelocity; 80 private Vector3 m_rotationalVelocity;
@@ -161,17 +162,19 @@ namespace OpenSim.Region.Physics.OdePlugin
161 { 162 {
162 pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5; 163 pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
163 } 164 }
165
164 _position = pos; 166 _position = pos;
165 m_taintPosition.X = pos.X; 167 m_taintPosition = pos;
166 m_taintPosition.Y = pos.Y;
167 m_taintPosition.Z = pos.Z;
168 } 168 }
169 else 169 else
170 { 170 {
171 _position = new Vector3(((float)_parent_scene.WorldExtents.X * 0.5f), ((float)_parent_scene.WorldExtents.Y * 0.5f), parent_scene.GetTerrainHeightAtXY(128f, 128f) + 10f); 171 _position
172 m_taintPosition.X = _position.X; 172 = new Vector3(
173 m_taintPosition.Y = _position.Y; 173 (float)_parent_scene.WorldExtents.X * 0.5f,
174 m_taintPosition.Z = _position.Z; 174 (float)_parent_scene.WorldExtents.Y * 0.5f,
175 parent_scene.GetTerrainHeightAtXY(128f, 128f) + 10f);
176 m_taintPosition = _position;
177
175 m_log.Warn("[PHYSICS]: Got NaN Position on Character Create"); 178 m_log.Warn("[PHYSICS]: Got NaN Position on Character Create");
176 } 179 }
177 180
@@ -431,13 +434,7 @@ namespace OpenSim.Region.Physics.OdePlugin
431 value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5; 434 value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
432 } 435 }
433 436
434 _position.X = value.X; 437 m_taintPosition = value;
435 _position.Y = value.Y;
436 _position.Z = value.Z;
437
438 m_taintPosition.X = value.X;
439 m_taintPosition.Y = value.Y;
440 m_taintPosition.Z = value.Z;
441 _parent_scene.AddPhysicsActorTaint(this); 438 _parent_scene.AddPhysicsActorTaint(this);
442 } 439 }
443 else 440 else
@@ -585,15 +582,12 @@ namespace OpenSim.Region.Physics.OdePlugin
585 d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH); 582 d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH);
586 Body = d.BodyCreate(_parent_scene.world); 583 Body = d.BodyCreate(_parent_scene.world);
587 d.BodySetPosition(Body, npositionX, npositionY, npositionZ); 584 d.BodySetPosition(Body, npositionX, npositionY, npositionZ);
588 585
589 _position.X = npositionX; 586 _position.X = npositionX;
590 _position.Y = npositionY; 587 _position.Y = npositionY;
591 _position.Z = npositionZ; 588 _position.Z = npositionZ;
592 589
593 590 m_taintPosition = _position;
594 m_taintPosition.X = npositionX;
595 m_taintPosition.Y = npositionY;
596 m_taintPosition.Z = npositionZ;
597 591
598 d.BodySetMass(Body, ref ShellMass); 592 d.BodySetMass(Body, ref ShellMass);
599 d.Matrix3 m_caprot; 593 d.Matrix3 m_caprot;
@@ -708,7 +702,7 @@ namespace OpenSim.Region.Physics.OdePlugin
708// d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f); 702// d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f);
709// d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f); 703// d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f);
710// //d.Matrix3 bodyrotation = d.BodyGetRotation(Body); 704// //d.Matrix3 bodyrotation = d.BodyGetRotation(Body);
711// //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22); 705// //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyFArotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22);
712// } 706// }
713 707
714 public override Vector3 Force 708 public override Vector3 Force
@@ -774,14 +768,15 @@ namespace OpenSim.Region.Physics.OdePlugin
774 if (value.IsFinite()) 768 if (value.IsFinite())
775 { 769 {
776 m_pidControllerActive = true; 770 m_pidControllerActive = true;
777 _target_velocity = value; 771 m_taintTargetVelocity = value;
772 _parent_scene.AddPhysicsActorTaint(this);
778 } 773 }
779 else 774 else
780 { 775 {
781 m_log.Warn("[PHYSICS]: Got a NaN velocity from Scene in a Character"); 776 m_log.Warn("[PHYSICS]: Got a NaN velocity from Scene in a Character");
782 } 777 }
783 778
784// m_log.DebugFormat("[PHYSICS]: Set target velocity of {0}", _target_velocity); 779// m_log.DebugFormat("[PHYSICS]: Set target velocity of {0}", m_taintTargetVelocity);
785 } 780 }
786 } 781 }
787 782
@@ -841,16 +836,14 @@ namespace OpenSim.Region.Physics.OdePlugin
841 // If uncommented, things get pushed off world 836 // If uncommented, things get pushed off world
842 // 837 //
843 // m_log.Debug("Push!"); 838 // m_log.Debug("Push!");
844 // _target_velocity.X += force.X; 839 // m_taintTargetVelocity.X += force.X;
845 // _target_velocity.Y += force.Y; 840 // m_taintTargetVelocity.Y += force.Y;
846 // _target_velocity.Z += force.Z; 841 // m_taintTargetVelocity.Z += force.Z;
847 } 842 }
848 else 843 else
849 { 844 {
850 m_pidControllerActive = true; 845 m_pidControllerActive = true;
851 _target_velocity.X += force.X; 846 m_taintTargetVelocity += force;
852 _target_velocity.Y += force.Y;
853 _target_velocity.Z += force.Z;
854 } 847 }
855 } 848 }
856 else 849 else
@@ -871,8 +864,6 @@ namespace OpenSim.Region.Physics.OdePlugin
871 public void doForce(Vector3 force) 864 public void doForce(Vector3 force)
872 { 865 {
873 d.BodyAddForce(Body, force.X, force.Y, force.Z); 866 d.BodyAddForce(Body, force.X, force.Y, force.Z);
874 //d.BodySetRotation(Body, ref m_StandUpRotation);
875 //standupStraight();
876 } 867 }
877 868
878 public override void SetMomentum(Vector3 momentum) 869 public override void SetMomentum(Vector3 momentum)
@@ -1062,69 +1053,66 @@ namespace OpenSim.Region.Physics.OdePlugin
1062 internal void UpdatePositionAndVelocity() 1053 internal void UpdatePositionAndVelocity()
1063 { 1054 {
1064 // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! 1055 // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
1065 d.Vector3 vec; 1056 d.Vector3 newPos;
1066 try 1057 try
1067 { 1058 {
1068 vec = d.BodyGetPosition(Body); 1059 newPos = d.BodyGetPosition(Body);
1069 } 1060 }
1070 catch (NullReferenceException) 1061 catch (NullReferenceException)
1071 { 1062 {
1072 bad = true; 1063 bad = true;
1073 _parent_scene.BadCharacter(this); 1064 _parent_scene.BadCharacter(this);
1074 vec = new d.Vector3(_position.X, _position.Y, _position.Z); 1065 newPos = new d.Vector3(_position.X, _position.Y, _position.Z);
1075 base.RaiseOutOfBounds(_position); // Tells ScenePresence that there's a problem! 1066 base.RaiseOutOfBounds(_position); // Tells ScenePresence that there's a problem!
1076 m_log.WarnFormat("[ODEPLUGIN]: Avatar Null reference for Avatar {0}, physical actor {1}", m_name, m_uuid); 1067 m_log.WarnFormat("[ODEPLUGIN]: Avatar Null reference for Avatar {0}, physical actor {1}", m_name, m_uuid);
1077 } 1068 }
1078 1069
1079 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) 1070 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
1080 if (vec.X < 0.0f) vec.X = 0.0f; 1071 if (newPos.X < 0.0f) newPos.X = 0.0f;
1081 if (vec.Y < 0.0f) vec.Y = 0.0f; 1072 if (newPos.Y < 0.0f) newPos.Y = 0.0f;
1082 if (vec.X > (int)_parent_scene.WorldExtents.X - 0.05f) vec.X = (int)_parent_scene.WorldExtents.X - 0.05f; 1073 if (newPos.X > (int)_parent_scene.WorldExtents.X - 0.05f) newPos.X = (int)_parent_scene.WorldExtents.X - 0.05f;
1083 if (vec.Y > (int)_parent_scene.WorldExtents.Y - 0.05f) vec.Y = (int)_parent_scene.WorldExtents.Y - 0.05f; 1074 if (newPos.Y > (int)_parent_scene.WorldExtents.Y - 0.05f) newPos.Y = (int)_parent_scene.WorldExtents.Y - 0.05f;
1084 1075
1085 _position.X = vec.X; 1076 _position.X = newPos.X;
1086 _position.Y = vec.Y; 1077 _position.Y = newPos.Y;
1087 _position.Z = vec.Z; 1078 _position.Z = newPos.Z;
1088 1079
1089 // I think we need to update the taintPosition too -- Diva 12/24/10 1080 // I think we need to update the taintPosition too -- Diva 12/24/10
1090 m_taintPosition.X = vec.X; 1081 m_taintPosition = _position;
1091 m_taintPosition.Y = vec.Y;
1092 m_taintPosition.Z = vec.Z;
1093 1082
1094 // Did we move last? = zeroflag 1083 // Did we move last? = zeroflag
1095 // This helps keep us from sliding all over 1084 // This helps keep us from sliding all over
1096 1085
1097 if (_zeroFlag) 1086 if (_zeroFlag)
1098 { 1087 {
1099 _velocity.X = 0.0f; 1088 _velocity = Vector3.Zero;
1100 _velocity.Y = 0.0f;
1101 _velocity.Z = 0.0f;
1102 1089
1103 // Did we send out the 'stopped' message? 1090 // Did we send out the 'stopped' message?
1104 if (!m_lastUpdateSent) 1091 if (!m_lastUpdateSent)
1105 { 1092 {
1106 m_lastUpdateSent = true; 1093 m_lastUpdateSent = true;
1107 //base.RequestPhysicsterseUpdate(); 1094 //base.RequestPhysicsterseUpdate();
1108
1109 } 1095 }
1110 } 1096 }
1111 else 1097 else
1112 { 1098 {
1113 m_lastUpdateSent = false; 1099 m_lastUpdateSent = false;
1100 d.Vector3 newVelocity;
1101
1114 try 1102 try
1115 { 1103 {
1116 vec = d.BodyGetLinearVel(Body); 1104 newVelocity = d.BodyGetLinearVel(Body);
1117 } 1105 }
1118 catch (NullReferenceException) 1106 catch (NullReferenceException)
1119 { 1107 {
1120 vec.X = _velocity.X; 1108 newVelocity.X = _velocity.X;
1121 vec.Y = _velocity.Y; 1109 newVelocity.Y = _velocity.Y;
1122 vec.Z = _velocity.Z; 1110 newVelocity.Z = _velocity.Z;
1123 } 1111 }
1124 _velocity.X = (vec.X);
1125 _velocity.Y = (vec.Y);
1126 1112
1127 _velocity.Z = (vec.Z); 1113 _velocity.X = newVelocity.X;
1114 _velocity.Y = newVelocity.Y;
1115 _velocity.Z = newVelocity.Z;
1128 1116
1129 if (_velocity.Z < -6 && !m_hackSentFall) 1117 if (_velocity.Z < -6 && !m_hackSentFall)
1130 { 1118 {
@@ -1253,6 +1241,18 @@ namespace OpenSim.Region.Physics.OdePlugin
1253 1241
1254 internal void ProcessTaints() 1242 internal void ProcessTaints()
1255 { 1243 {
1244 if (m_taintPosition != _position)
1245 {
1246 if (Body != IntPtr.Zero)
1247 {
1248 d.BodySetPosition(Body, m_taintPosition.X, m_taintPosition.Y, m_taintPosition.Z);
1249 _position = m_taintPosition;
1250 }
1251 }
1252
1253 if (m_taintTargetVelocity != _target_velocity)
1254 _target_velocity = m_taintTargetVelocity;
1255
1256 if (m_tainted_isPhysical != m_isPhysical) 1256 if (m_tainted_isPhysical != m_isPhysical)
1257 { 1257 {
1258 if (m_tainted_isPhysical) 1258 if (m_tainted_isPhysical)
@@ -1294,8 +1294,10 @@ namespace OpenSim.Region.Physics.OdePlugin
1294 //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); 1294 //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString());
1295 d.BodyDestroy(Body); 1295 d.BodyDestroy(Body);
1296 d.GeomDestroy(Shell); 1296 d.GeomDestroy(Shell);
1297 AvatarGeomAndBodyCreation(_position.X, _position.Y, 1297 AvatarGeomAndBodyCreation(
1298 _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor); 1298 _position.X,
1299 _position.Y,
1300 _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor);
1299 1301
1300 // As with Size, we reset velocity. However, this isn't strictly necessary since it doesn't 1302 // As with Size, we reset velocity. However, this isn't strictly necessary since it doesn't
1301 // appear to stall initial region crossings when done here. Being done for consistency. 1303 // appear to stall initial region crossings when done here. Being done for consistency.
@@ -1312,18 +1314,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1312 + (Amotor==IntPtr.Zero ? "Amotor ":"")); 1314 + (Amotor==IntPtr.Zero ? "Amotor ":""));
1313 } 1315 }
1314 } 1316 }
1315
1316 if (!m_taintPosition.ApproxEquals(_position, 0.05f))
1317 {
1318 if (Body != IntPtr.Zero)
1319 {
1320 d.BodySetPosition(Body, m_taintPosition.X, m_taintPosition.Y, m_taintPosition.Z);
1321
1322 _position.X = m_taintPosition.X;
1323 _position.Y = m_taintPosition.Y;
1324 _position.Z = m_taintPosition.Z;
1325 }
1326 }
1327 } 1317 }
1328 1318
1329 internal void AddCollisionFrameTime(int p) 1319 internal void AddCollisionFrameTime(int p)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index dc22017..c0d2f38 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -550,7 +550,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
550 if (World.Entities.TryGetValue(target, out entity)) 550 if (World.Entities.TryGetValue(target, out entity))
551 { 551 {
552 if (entity is SceneObjectGroup) 552 if (entity is SceneObjectGroup)
553 ((SceneObjectGroup)entity).Rotation = rotation; 553 ((SceneObjectGroup)entity).UpdateGroupRotationR(rotation);
554 else if (entity is ScenePresence) 554 else if (entity is ScenePresence)
555 ((ScenePresence)entity).Rotation = rotation; 555 ((ScenePresence)entity).Rotation = rotation;
556 } 556 }