aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-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
6 files changed, 62 insertions, 66 deletions
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 }