aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs319
1 files changed, 140 insertions, 179 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index b04e882..d465eaa 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -31,9 +31,8 @@ using System.Drawing;
31using System.IO; 31using System.IO;
32using System.Xml; 32using System.Xml;
33using System.Xml.Serialization; 33using System.Xml.Serialization;
34using Axiom.Math; 34using OpenMetaverse;
35using libsecondlife; 35using OpenMetaverse.Packets;
36using libsecondlife.Packets;
37using OpenSim.Framework; 36using OpenSim.Framework;
38using OpenSim.Region.Environment.Interfaces; 37using OpenSim.Region.Environment.Interfaces;
39using OpenSim.Region.Physics.Manager; 38using OpenSim.Region.Physics.Manager;
@@ -75,7 +74,7 @@ namespace OpenSim.Region.Environment.Scenes
75 74
76 struct scriptPosTarget 75 struct scriptPosTarget
77 { 76 {
78 public LLVector3 targetPos; 77 public Vector3 targetPos;
79 public float tolerance; 78 public float tolerance;
80 } 79 }
81 80
@@ -97,17 +96,17 @@ namespace OpenSim.Region.Environment.Scenes
97 96
98 public float scriptScore = 0f; 97 public float scriptScore = 0f;
99 98
100 private LLVector3 lastPhysGroupPos; 99 private Vector3 lastPhysGroupPos;
101 private LLQuaternion lastPhysGroupRot; 100 private Quaternion lastPhysGroupRot;
102 101
103 /// <summary> 102 /// <summary>
104 /// The constituent parts of this group 103 /// The constituent parts of this group
105 /// </summary> 104 /// </summary>
106 protected Dictionary<LLUUID, SceneObjectPart> m_parts = new Dictionary<LLUUID, SceneObjectPart>(); 105 protected Dictionary<UUID, SceneObjectPart> m_parts = new Dictionary<UUID, SceneObjectPart>();
107 106
108 protected ulong m_regionHandle; 107 protected ulong m_regionHandle;
109 protected SceneObjectPart m_rootPart; 108 protected SceneObjectPart m_rootPart;
110 // private Dictionary<LLUUID, scriptEvents> m_scriptEvents = new Dictionary<LLUUID, scriptEvents>(); 109 // private Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>();
111 110
112 private Dictionary<uint, scriptPosTarget> m_targets = new Dictionary<uint, scriptPosTarget>(); 111 private Dictionary<uint, scriptPosTarget> m_targets = new Dictionary<uint, scriptPosTarget>();
113 112
@@ -142,18 +141,18 @@ namespace OpenSim.Region.Environment.Scenes
142 get { return m_parts.Count; } 141 get { return m_parts.Count; }
143 } 142 }
144 143
145 public LLQuaternion GroupRotation 144 public Quaternion GroupRotation
146 { 145 {
147 get { return m_rootPart.RotationOffset; } 146 get { return m_rootPart.RotationOffset; }
148 } 147 }
149 148
150 public LLUUID GroupID 149 public UUID GroupID
151 { 150 {
152 get { return m_rootPart.GroupID; } 151 get { return m_rootPart.GroupID; }
153 set { m_rootPart.GroupID = value; } 152 set { m_rootPart.GroupID = value; }
154 } 153 }
155 154
156 public Dictionary<LLUUID, SceneObjectPart> Children 155 public Dictionary<UUID, SceneObjectPart> Children
157 { 156 {
158 get { return m_parts; } 157 get { return m_parts; }
159 set { m_parts = value; } 158 set { m_parts = value; }
@@ -181,7 +180,7 @@ namespace OpenSim.Region.Environment.Scenes
181 } 180 }
182 } 181 }
183 182
184 public override LLVector3 AbsolutePosition 183 public override Vector3 AbsolutePosition
185 { 184 {
186 get 185 get
187 { 186 {
@@ -195,7 +194,7 @@ namespace OpenSim.Region.Environment.Scenes
195 } 194 }
196 set 195 set
197 { 196 {
198 LLVector3 val = value; 197 Vector3 val = value;
199 if ((val.X > 257f || val.X < -1f || val.Y > 257f || val.Y < -1f) && !m_rootPart.IsAttachment) 198 if ((val.X > 257f || val.X < -1f || val.Y > 257f || val.Y < -1f) && !m_rootPart.IsAttachment)
200 { 199 {
201 m_scene.CrossPrimGroupIntoNewRegion(val, this); 200 m_scene.CrossPrimGroupIntoNewRegion(val, this);
@@ -234,18 +233,18 @@ namespace OpenSim.Region.Environment.Scenes
234 set { m_rootPart.LocalId = value; } 233 set { m_rootPart.LocalId = value; }
235 } 234 }
236 235
237 public override LLUUID UUID 236 public override UUID UUID
238 { 237 {
239 get { return m_rootPart.UUID; } 238 get { return m_rootPart.UUID; }
240 set { m_rootPart.UUID = value; } 239 set { m_rootPart.UUID = value; }
241 } 240 }
242 241
243 public LLUUID OwnerID 242 public UUID OwnerID
244 { 243 {
245 get 244 get
246 { 245 {
247 if (m_rootPart == null) 246 if (m_rootPart == null)
248 return LLUUID.Zero; 247 return UUID.Zero;
249 248
250 return m_rootPart.OwnerID; 249 return m_rootPart.OwnerID;
251 } 250 }
@@ -299,7 +298,7 @@ namespace OpenSim.Region.Environment.Scenes
299 } 298 }
300 299
301 // The UUID for the Region this Object is in. 300 // The UUID for the Region this Object is in.
302 public LLUUID RegionUUID 301 public UUID RegionUUID
303 { 302 {
304 get 303 get
305 { 304 {
@@ -307,7 +306,7 @@ namespace OpenSim.Region.Environment.Scenes
307 { 306 {
308 return m_scene.RegionInfo.RegionID; 307 return m_scene.RegionInfo.RegionID;
309 } 308 }
310 return LLUUID.Zero; 309 return UUID.Zero;
311 } 310 }
312 } 311 }
313 312
@@ -455,14 +454,14 @@ namespace OpenSim.Region.Environment.Scenes
455 /// <summary> 454 /// <summary>
456 /// 455 ///
457 /// </summary> 456 /// </summary>
458 public SceneObjectGroup(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos, 457 public SceneObjectGroup(Scene scene, ulong regionHandle, UUID ownerID, uint localID, Vector3 pos,
459 LLQuaternion rot, PrimitiveBaseShape shape) 458 Quaternion rot, PrimitiveBaseShape shape)
460 { 459 {
461 m_regionHandle = regionHandle; 460 m_regionHandle = regionHandle;
462 m_scene = scene; 461 m_scene = scene;
463 462
464 // this.Pos = pos; 463 // this.Pos = pos;
465 LLVector3 rootOffset = new LLVector3(0, 0, 0); 464 Vector3 rootOffset = new Vector3(0, 0, 0);
466 SceneObjectPart newPart = 465 SceneObjectPart newPart =
467 new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rot, rootOffset); 466 new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rot, rootOffset);
468 newPart.LinkNum = 0; 467 newPart.LinkNum = 0;
@@ -479,13 +478,13 @@ namespace OpenSim.Region.Environment.Scenes
479 /// <summary> 478 /// <summary>
480 /// 479 ///
481 /// </summary> 480 /// </summary>
482 public SceneObjectGroup(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos, 481 public SceneObjectGroup(Scene scene, ulong regionHandle, UUID ownerID, uint localID, Vector3 pos,
483 PrimitiveBaseShape shape) 482 PrimitiveBaseShape shape)
484 : this(scene, regionHandle, ownerID, localID, pos, LLQuaternion.Identity, shape) 483 : this(scene, regionHandle, ownerID, localID, pos, Quaternion.Identity, shape)
485 { 484 {
486 } 485 }
487 486
488 public void SetFromAssetID(LLUUID AssetId) 487 public void SetFromAssetID(UUID AssetId)
489 { 488 {
490 lock (m_parts) 489 lock (m_parts)
491 { 490 {
@@ -496,13 +495,13 @@ namespace OpenSim.Region.Environment.Scenes
496 } 495 }
497 } 496 }
498 497
499 public LLUUID GetFromAssetID() 498 public UUID GetFromAssetID()
500 { 499 {
501 if (m_rootPart != null) 500 if (m_rootPart != null)
502 { 501 {
503 return m_rootPart.FromAssetID; 502 return m_rootPart.FromAssetID;
504 } 503 }
505 return LLUUID.Zero; 504 return UUID.Zero;
506 } 505 }
507 506
508 /// <summary> 507 /// <summary>
@@ -519,18 +518,18 @@ namespace OpenSim.Region.Environment.Scenes
519 } 518 }
520 } 519 }
521 520
522 public LLVector3 GroupScale() 521 public Vector3 GroupScale()
523 { 522 {
524 LLVector3 minScale = new LLVector3(Constants.RegionSize,Constants.RegionSize,Constants.RegionSize); 523 Vector3 minScale = new Vector3(Constants.RegionSize,Constants.RegionSize,Constants.RegionSize);
525 LLVector3 maxScale = new LLVector3(0f,0f,0f); 524 Vector3 maxScale = new Vector3(0f,0f,0f);
526 LLVector3 finalScale = new LLVector3(0.5f, 0.5f, 0.5f); 525 Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f);
527 526
528 lock (m_parts) 527 lock (m_parts)
529 { 528 {
530 foreach (SceneObjectPart part in m_parts.Values) 529 foreach (SceneObjectPart part in m_parts.Values)
531 { 530 {
532 LLVector3 partscale = part.Scale; 531 Vector3 partscale = part.Scale;
533 LLVector3 partoffset = part.OffsetPosition; 532 Vector3 partoffset = part.OffsetPosition;
534 533
535 minScale.X = (partscale.X + partoffset.X < minScale.X) ? partscale.X + partoffset.X : minScale.X; 534 minScale.X = (partscale.X + partoffset.X < minScale.X) ? partscale.X + partoffset.X : minScale.X;
536 minScale.Y = (partscale.Y + partoffset.Y < minScale.Y) ? partscale.X + partoffset.Y : minScale.Y; 535 minScale.Y = (partscale.Y + partoffset.Y < minScale.Y) ? partscale.X + partoffset.Y : minScale.Y;
@@ -563,8 +562,7 @@ namespace OpenSim.Region.Environment.Scenes
563 // Temporary commented to stop compiler warning 562 // Temporary commented to stop compiler warning
564 //Vector3 partPosition = 563 //Vector3 partPosition =
565 // new Vector3(part.AbsolutePosition.X, part.AbsolutePosition.Y, part.AbsolutePosition.Z); 564 // new Vector3(part.AbsolutePosition.X, part.AbsolutePosition.Y, part.AbsolutePosition.Z);
566 Quaternion parentrotation = 565 Quaternion parentrotation = GroupRotation;
567 new Quaternion(GroupRotation.W, GroupRotation.X, GroupRotation.Y, GroupRotation.Z);
568 566
569 // Telling the prim to raytrace. 567 // Telling the prim to raytrace.
570 //EntityIntersection inter = part.TestIntersection(hRay, parentrotation); 568 //EntityIntersection inter = part.TestIntersection(hRay, parentrotation);
@@ -684,7 +682,7 @@ namespace OpenSim.Region.Environment.Scenes
684 /// <param name="agentID"></param> 682 /// <param name="agentID"></param>
685 /// <param name="attachmentpoint"></param> 683 /// <param name="attachmentpoint"></param>
686 /// <param name="AttachOffset"></param> 684 /// <param name="AttachOffset"></param>
687 public void AttachToAgent(LLUUID agentID, uint attachmentpoint, LLVector3 AttachOffset) 685 public void AttachToAgent(UUID agentID, uint attachmentpoint, Vector3 AttachOffset)
688 { 686 {
689 ScenePresence avatar = m_scene.GetScenePresence(agentID); 687 ScenePresence avatar = m_scene.GetScenePresence(agentID);
690 if (avatar != null) 688 if (avatar != null)
@@ -737,14 +735,14 @@ namespace OpenSim.Region.Environment.Scenes
737 public void DetachToGround() 735 public void DetachToGround()
738 { 736 {
739 ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar); 737 ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar);
740 LLVector3 detachedpos = new LLVector3(127f,127f,127f); 738 Vector3 detachedpos = new Vector3(127f,127f,127f);
741 if (avatar != null) 739 if (avatar != null)
742 { 740 {
743 detachedpos = avatar.AbsolutePosition; 741 detachedpos = avatar.AbsolutePosition;
744 avatar.RemoveAttachment(this); 742 avatar.RemoveAttachment(this);
745 } 743 }
746 AbsolutePosition = detachedpos; 744 AbsolutePosition = detachedpos;
747 m_rootPart.AttachedAvatar = LLUUID.Zero; 745 m_rootPart.AttachedAvatar = UUID.Zero;
748 m_rootPart.SetParentLocalId(0); 746 m_rootPart.SetParentLocalId(0);
749 m_rootPart.SetAttachmentPoint((byte)0); 747 m_rootPart.SetAttachmentPoint((byte)0);
750 m_rootPart.IsAttachment = false; 748 m_rootPart.IsAttachment = false;
@@ -758,14 +756,14 @@ namespace OpenSim.Region.Environment.Scenes
758 public void DetachToInventoryPrep() 756 public void DetachToInventoryPrep()
759 { 757 {
760 ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar); 758 ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar);
761 //LLVector3 detachedpos = new LLVector3(127f, 127f, 127f); 759 //Vector3 detachedpos = new Vector3(127f, 127f, 127f);
762 if (avatar != null) 760 if (avatar != null)
763 { 761 {
764 //detachedpos = avatar.AbsolutePosition; 762 //detachedpos = avatar.AbsolutePosition;
765 avatar.RemoveAttachment(this); 763 avatar.RemoveAttachment(this);
766 } 764 }
767 765
768 m_rootPart.AttachedAvatar = LLUUID.Zero; 766 m_rootPart.AttachedAvatar = UUID.Zero;
769 m_rootPart.SetParentLocalId(0); 767 m_rootPart.SetParentLocalId(0);
770 //m_rootPart.SetAttachmentPoint((byte)0); 768 //m_rootPart.SetAttachmentPoint((byte)0);
771 m_rootPart.IsAttachment = false; 769 m_rootPart.IsAttachment = false;
@@ -861,7 +859,7 @@ namespace OpenSim.Region.Environment.Scenes
861 { 859 {
862 foreach (SceneObjectPart part in m_parts.Values) 860 foreach (SceneObjectPart part in m_parts.Values)
863 { 861 {
864 part.UUID = LLUUID.Random(); 862 part.UUID = UUID.Random();
865 863
866 } 864 }
867 } 865 }
@@ -885,7 +883,7 @@ namespace OpenSim.Region.Environment.Scenes
885 //HasGroupChanged = false; 883 //HasGroupChanged = false;
886 } 884 }
887 885
888 public LLUUID GetPartsFullID(uint localID) 886 public UUID GetPartsFullID(uint localID)
889 { 887 {
890 SceneObjectPart part = GetChildPart(localID); 888 SceneObjectPart part = GetChildPart(localID);
891 if (part != null) 889 if (part != null)
@@ -895,7 +893,7 @@ namespace OpenSim.Region.Environment.Scenes
895 return null; 893 return null;
896 } 894 }
897 895
898 public void ObjectGrabHandler(uint localId, LLVector3 offsetPos, IClientAPI remoteClient) 896 public void ObjectGrabHandler(uint localId, Vector3 offsetPos, IClientAPI remoteClient)
899 { 897 {
900 if (m_rootPart.LocalId == localId) 898 if (m_rootPart.LocalId == localId)
901 { 899 {
@@ -909,14 +907,14 @@ namespace OpenSim.Region.Environment.Scenes
909 } 907 }
910 } 908 }
911 909
912 public virtual void OnGrabPart(SceneObjectPart part, LLVector3 offsetPos, IClientAPI remoteClient) 910 public virtual void OnGrabPart(SceneObjectPart part, Vector3 offsetPos, IClientAPI remoteClient)
913 { 911 {
914 part.StoreUndoState(); 912 part.StoreUndoState();
915 part.OnGrab(offsetPos, remoteClient); 913 part.OnGrab(offsetPos, remoteClient);
916 914
917 } 915 }
918 916
919 public virtual void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient) 917 public virtual void OnGrabGroup(Vector3 offsetPos, IClientAPI remoteClient)
920 { 918 {
921 m_scene.EventManager.TriggerGroupGrab(UUID, offsetPos, remoteClient.AgentId); 919 m_scene.EventManager.TriggerGroupGrab(UUID, offsetPos, remoteClient.AgentId);
922 } 920 }
@@ -949,7 +947,7 @@ namespace OpenSim.Region.Environment.Scenes
949 } 947 }
950 948
951 if (m_rootPart != null && part == m_rootPart) 949 if (m_rootPart != null && part == m_rootPart)
952 avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalId); 950 avatars[i].ControllingClient.SendKiPrimitive(m_regionHandle, part.LocalId);
953 } 951 }
954 } 952 }
955 953
@@ -975,7 +973,7 @@ namespace OpenSim.Region.Environment.Scenes
975 } 973 }
976 974
977 if (m_rootPart != null && part == m_rootPart) 975 if (m_rootPart != null && part == m_rootPart)
978 avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalId); 976 avatars[i].ControllingClient.SendKiPrimitive(m_regionHandle, part.LocalId);
979 } 977 }
980 } 978 }
981 } 979 }
@@ -1047,9 +1045,9 @@ namespace OpenSim.Region.Environment.Scenes
1047 public override void SetText(string text, Vector3 color, double alpha) 1045 public override void SetText(string text, Vector3 color, double alpha)
1048 { 1046 {
1049 Color = Color.FromArgb(0xff - (int) (alpha * 0xff), 1047 Color = Color.FromArgb(0xff - (int) (alpha * 0xff),
1050 (int) (color.x * 0xff), 1048 (int) (color.X * 0xff),
1051 (int) (color.y * 0xff), 1049 (int) (color.Y * 0xff),
1052 (int) (color.z * 0xff)); 1050 (int) (color.Z * 0xff));
1053 Text = text; 1051 Text = text;
1054 1052
1055 HasGroupChanged = true; 1053 HasGroupChanged = true;
@@ -1085,7 +1083,7 @@ namespace OpenSim.Region.Environment.Scenes
1085 } 1083 }
1086 } 1084 }
1087 1085
1088 public void SetOwnerId(LLUUID userId) 1086 public void SetOwnerId(UUID userId)
1089 { 1087 {
1090 ForEachPart(delegate(SceneObjectPart part) { part.OwnerID = userId; }); 1088 ForEachPart(delegate(SceneObjectPart part) { part.OwnerID = userId; });
1091 } 1089 }
@@ -1207,14 +1205,14 @@ namespace OpenSim.Region.Environment.Scenes
1207 /// Duplicates this object, including operations such as physics set up and attaching to the backup event. 1205 /// Duplicates this object, including operations such as physics set up and attaching to the backup event.
1208 /// </summary> 1206 /// </summary>
1209 /// <returns></returns> 1207 /// <returns></returns>
1210 public SceneObjectGroup Copy(LLUUID cAgentID, LLUUID cGroupID, bool userExposed) 1208 public SceneObjectGroup Copy(UUID cAgentID, UUID cGroupID, bool userExposed)
1211 { 1209 {
1212 SceneObjectGroup dupe = (SceneObjectGroup) MemberwiseClone(); 1210 SceneObjectGroup dupe = (SceneObjectGroup) MemberwiseClone();
1213 dupe.m_parts = new Dictionary<LLUUID, SceneObjectPart>(); 1211 dupe.m_parts = new Dictionary<UUID, SceneObjectPart>();
1214 dupe.m_parts.Clear(); 1212 dupe.m_parts.Clear();
1215 //dupe.OwnerID = AgentID; 1213 //dupe.OwnerID = AgentID;
1216 //dupe.GroupID = GroupID; 1214 //dupe.GroupID = GroupID;
1217 dupe.AbsolutePosition = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); 1215 dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
1218 dupe.m_scene = m_scene; 1216 dupe.m_scene = m_scene;
1219 dupe.m_regionHandle = m_regionHandle; 1217 dupe.m_regionHandle = m_regionHandle;
1220 1218
@@ -1231,11 +1229,9 @@ namespace OpenSim.Region.Environment.Scenes
1231 dupe.RootPart.PhysActor = m_scene.PhysicsScene.AddPrimShape( 1229 dupe.RootPart.PhysActor = m_scene.PhysicsScene.AddPrimShape(
1232 dupe.RootPart.Name, 1230 dupe.RootPart.Name,
1233 pbs, 1231 pbs,
1234 new PhysicsVector(dupe.RootPart.AbsolutePosition.X, dupe.RootPart.AbsolutePosition.Y, 1232 new PhysicsVector(dupe.RootPart.AbsolutePosition.X, dupe.RootPart.AbsolutePosition.Y, dupe.RootPart.AbsolutePosition.Z),
1235 dupe.RootPart.AbsolutePosition.Z),
1236 new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z), 1233 new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z),
1237 new Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X, 1234 dupe.RootPart.RotationOffset,
1238 dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z),
1239 dupe.RootPart.PhysActor.IsPhysical); 1235 dupe.RootPart.PhysActor.IsPhysical);
1240 1236
1241 dupe.RootPart.PhysActor.LocalID = dupe.RootPart.LocalId; 1237 dupe.RootPart.PhysActor.LocalID = dupe.RootPart.LocalId;
@@ -1286,7 +1282,7 @@ namespace OpenSim.Region.Environment.Scenes
1286 /// <param name="part"></param> 1282 /// <param name="part"></param>
1287 /// <param name="cAgentID"></param> 1283 /// <param name="cAgentID"></param>
1288 /// <param name="cGroupID"></param> 1284 /// <param name="cGroupID"></param>
1289 public void CopyRootPart(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID, bool userExposed) 1285 public void CopyRootPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed)
1290 { 1286 {
1291 SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID, m_parts.Count, userExposed); 1287 SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID, m_parts.Count, userExposed);
1292 newPart.SetParent(this); 1288 newPart.SetParent(this);
@@ -1308,9 +1304,9 @@ namespace OpenSim.Region.Environment.Scenes
1308 foreach (SceneObjectPart part in m_parts.Values) 1304 foreach (SceneObjectPart part in m_parts.Values)
1309 { 1305 {
1310 if (UsePhysics) 1306 if (UsePhysics)
1311 part.AddFlag(LLObject.ObjectFlags.Physics); 1307 part.AddFlag(PrimFlags.Physics);
1312 else 1308 else
1313 part.RemFlag(LLObject.ObjectFlags.Physics); 1309 part.RemFlag(PrimFlags.Physics);
1314 1310
1315 part.DoPhysicsPropertyUpdate(UsePhysics, false); 1311 part.DoPhysicsPropertyUpdate(UsePhysics, false);
1316 IsSelected = false; 1312 IsSelected = false;
@@ -1327,7 +1323,7 @@ namespace OpenSim.Region.Environment.Scenes
1327 { 1323 {
1328 if (PhantomStatus) 1324 if (PhantomStatus)
1329 { 1325 {
1330 part.AddFlag(LLObject.ObjectFlags.Phantom); 1326 part.AddFlag(PrimFlags.Phantom);
1331 if (part.PhysActor != null) 1327 if (part.PhysActor != null)
1332 { 1328 {
1333 m_scene.PhysicsScene.RemovePrim(part.PhysActor); 1329 m_scene.PhysicsScene.RemovePrim(part.PhysActor);
@@ -1335,8 +1331,8 @@ namespace OpenSim.Region.Environment.Scenes
1335 } 1331 }
1336 else 1332 else
1337 { 1333 {
1338 part.RemFlag(LLObject.ObjectFlags.Phantom); 1334 part.RemFlag(PrimFlags.Phantom);
1339 if ((part.GetEffectiveObjectFlags() & (int) LLObject.ObjectFlags.Physics) != 0) 1335 if ((part.GetEffectiveObjectFlags() & (int) PrimFlags.Physics) != 0)
1340 { 1336 {
1341 part.DoPhysicsPropertyUpdate(true, false); 1337 part.DoPhysicsPropertyUpdate(true, false);
1342 } 1338 }
@@ -1372,7 +1368,7 @@ namespace OpenSim.Region.Environment.Scenes
1372 } 1368 }
1373 } 1369 }
1374 1370
1375 public void moveToTarget(LLVector3 target, float tau) 1371 public void moveToTarget(Vector3 target, float tau)
1376 { 1372 {
1377 SceneObjectPart rootpart = m_rootPart; 1373 SceneObjectPart rootpart = m_rootPart;
1378 if (rootpart != null) 1374 if (rootpart != null)
@@ -1395,7 +1391,7 @@ namespace OpenSim.Region.Environment.Scenes
1395 } 1391 }
1396 } 1392 }
1397 1393
1398 public void SetRootPartOwner(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID) 1394 public void SetRootPartOwner(SceneObjectPart part, UUID cAgentID, UUID cGroupID)
1399 { 1395 {
1400 part.LastOwnerID = part.OwnerID; 1396 part.LastOwnerID = part.OwnerID;
1401 part.OwnerID = cAgentID; 1397 part.OwnerID = cAgentID;
@@ -1417,7 +1413,7 @@ namespace OpenSim.Region.Environment.Scenes
1417 /// <param name="part"></param> 1413 /// <param name="part"></param>
1418 /// <param name="cAgentID"></param> 1414 /// <param name="cAgentID"></param>
1419 /// <param name="cGroupID"></param> 1415 /// <param name="cGroupID"></param>
1420 public void CopyPart(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID, bool userExposed) 1416 public void CopyPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed)
1421 { 1417 {
1422 SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID, m_parts.Count, userExposed); 1418 SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate(), OwnerID, GroupID, m_parts.Count, userExposed);
1423 newPart.SetParent(this); 1419 newPart.SetParent(this);
@@ -1432,7 +1428,7 @@ namespace OpenSim.Region.Environment.Scenes
1432 } 1428 }
1433 1429
1434 /// <summary> 1430 /// <summary>
1435 /// Reset the LLUUIDs for all the prims that make up this group. 1431 /// Reset the UUIDs for all the prims that make up this group.
1436 /// 1432 ///
1437 /// This is called by methods which want to add a new group to an existing scene, in order 1433 /// This is called by methods which want to add a new group to an existing scene, in order
1438 /// to ensure that there are no clashes with groups already present. 1434 /// to ensure that there are no clashes with groups already present.
@@ -1454,7 +1450,7 @@ namespace OpenSim.Region.Environment.Scenes
1454 /// 1450 ///
1455 /// </summary> 1451 /// </summary>
1456 /// <param name="part"></param> 1452 /// <param name="part"></param>
1457 public void ServiceObjectPropertiesFamilyRequest(IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags) 1453 public void ServiceObjectPropertiesFamilyRequest(IClientAPI remoteClient, UUID AgentID, uint RequestFlags)
1458 { 1454 {
1459 1455
1460 remoteClient.SendObjectPropertiesFamilyData(RequestFlags, RootPart.UUID, RootPart.ObjectOwner, RootPart.GroupID, RootPart.BaseMask, 1456 remoteClient.SendObjectPropertiesFamilyData(RequestFlags, RootPart.UUID, RootPart.ObjectOwner, RootPart.GroupID, RootPart.BaseMask,
@@ -1463,7 +1459,7 @@ namespace OpenSim.Region.Environment.Scenes
1463 RootPart.CreatorID, RootPart.Name, RootPart.Description); 1459 RootPart.CreatorID, RootPart.Name, RootPart.Description);
1464 } 1460 }
1465 1461
1466 public void SetPartOwner(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID) 1462 public void SetPartOwner(SceneObjectPart part, UUID cAgentID, UUID cGroupID)
1467 { 1463 {
1468 part.OwnerID = cAgentID; 1464 part.OwnerID = cAgentID;
1469 part.GroupID = cGroupID; 1465 part.GroupID = cGroupID;
@@ -1640,7 +1636,7 @@ namespace OpenSim.Region.Environment.Scenes
1640 /// </summary> 1636 /// </summary>
1641 /// <param name="primID"></param> 1637 /// <param name="primID"></param>
1642 /// <returns>null if a child part with the primID was not found</returns> 1638 /// <returns>null if a child part with the primID was not found</returns>
1643 public SceneObjectPart GetChildPart(LLUUID primID) 1639 public SceneObjectPart GetChildPart(UUID primID)
1644 { 1640 {
1645 SceneObjectPart childPart = null; 1641 SceneObjectPart childPart = null;
1646 if (m_parts.ContainsKey(primID)) 1642 if (m_parts.ContainsKey(primID))
@@ -1677,7 +1673,7 @@ namespace OpenSim.Region.Environment.Scenes
1677 /// </summary> 1673 /// </summary>
1678 /// <param name="primID"></param> 1674 /// <param name="primID"></param>
1679 /// <returns></returns> 1675 /// <returns></returns>
1680 public bool HasChildPrim(LLUUID primID) 1676 public bool HasChildPrim(UUID primID)
1681 { 1677 {
1682 if (m_parts.ContainsKey(primID)) 1678 if (m_parts.ContainsKey(primID))
1683 { 1679 {
@@ -1735,27 +1731,20 @@ namespace OpenSim.Region.Environment.Scenes
1735 1731
1736 SceneObjectPart linkPart = objectGroup.m_rootPart; 1732 SceneObjectPart linkPart = objectGroup.m_rootPart;
1737 1733
1738 Vector3 oldGroupPosition = 1734 Vector3 oldGroupPosition = linkPart.GroupPosition;
1739 new Vector3(linkPart.GroupPosition.X, linkPart.GroupPosition.Y, linkPart.GroupPosition.Z); 1735 Quaternion oldRootRotation = linkPart.RotationOffset;
1740 Quaternion oldRootRotation =
1741 new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y,
1742 linkPart.RotationOffset.Z);
1743 1736
1744 linkPart.OffsetPosition = linkPart.GroupPosition - AbsolutePosition; 1737 linkPart.OffsetPosition = linkPart.GroupPosition - AbsolutePosition;
1745 linkPart.GroupPosition = AbsolutePosition; 1738 linkPart.GroupPosition = AbsolutePosition;
1746 Vector3 axPos = new Vector3(linkPart.OffsetPosition.X, linkPart.OffsetPosition.Y, linkPart.OffsetPosition.Z); 1739 Vector3 axPos = linkPart.OffsetPosition;
1747 1740
1748 Quaternion parentRot = 1741 Quaternion parentRot = m_rootPart.RotationOffset;
1749 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, 1742 axPos *= Quaternion.Inverse(parentRot);
1750 m_rootPart.RotationOffset.Z);
1751 axPos = parentRot.Inverse() * axPos;
1752 1743
1753 linkPart.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z); 1744 linkPart.OffsetPosition = axPos;
1754 Quaternion oldRot = 1745 Quaternion oldRot = linkPart.RotationOffset;
1755 new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y, 1746 Quaternion newRot = oldRot * Quaternion.Inverse(parentRot);
1756 linkPart.RotationOffset.Z); 1747 linkPart.RotationOffset = newRot;
1757 Quaternion newRot = parentRot.Inverse() * oldRot;
1758 linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
1759 1748
1760 linkPart.ParentID = m_rootPart.LocalId; 1749 linkPart.ParentID = m_rootPart.LocalId;
1761 if (m_rootPart.LinkNum == 0) 1750 if (m_rootPart.LinkNum == 0)
@@ -1769,7 +1758,7 @@ namespace OpenSim.Region.Environment.Scenes
1769 linkPart.LinkNum = m_parts.Count; 1758 linkPart.LinkNum = m_parts.Count;
1770 1759
1771 linkPart.SetParent(this); 1760 linkPart.SetParent(this);
1772 linkPart.AddFlag(LLObject.ObjectFlags.CreateSelected); 1761 linkPart.AddFlag(PrimFlags.CreateSelected);
1773 1762
1774 //if (linkPart.PhysActor != null) 1763 //if (linkPart.PhysActor != null)
1775 //{ 1764 //{
@@ -1821,7 +1810,7 @@ namespace OpenSim.Region.Environment.Scenes
1821// "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}", 1810// "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}",
1822// linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID); 1811// linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID);
1823 1812
1824 LLQuaternion worldRot = linkPart.GetWorldRotation(); 1813 Quaternion worldRot = linkPart.GetWorldRotation();
1825 1814
1826 // Remove the part from this object 1815 // Remove the part from this object
1827 lock (m_parts) 1816 lock (m_parts)
@@ -1850,23 +1839,14 @@ namespace OpenSim.Region.Environment.Scenes
1850 1839
1851 // We need to reset the child part's position 1840 // We need to reset the child part's position
1852 // ready for life as a separate object after being a part of another object 1841 // ready for life as a separate object after being a part of another object
1853 Quaternion parentRot 1842 Quaternion parentRot = m_rootPart.RotationOffset;
1854 = new Quaternion( 1843
1855 m_rootPart.RotationOffset.W, 1844 Vector3 axPos = linkPart.OffsetPosition;
1856 m_rootPart.RotationOffset.X, 1845
1857 m_rootPart.RotationOffset.Y, 1846 axPos *= parentRot;
1858 m_rootPart.RotationOffset.Z); 1847 linkPart.OffsetPosition = new Vector3(axPos.X, axPos.Y, axPos.Z);
1859
1860 Vector3 axPos
1861 = new Vector3(
1862 linkPart.OffsetPosition.X,
1863 linkPart.OffsetPosition.Y,
1864 linkPart.OffsetPosition.Z);
1865
1866 axPos = parentRot * axPos;
1867 linkPart.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z);
1868 linkPart.GroupPosition = AbsolutePosition + linkPart.OffsetPosition; 1848 linkPart.GroupPosition = AbsolutePosition + linkPart.OffsetPosition;
1869 linkPart.OffsetPosition = new LLVector3(0, 0, 0); 1849 linkPart.OffsetPosition = new Vector3(0, 0, 0);
1870 1850
1871 linkPart.RotationOffset = worldRot; 1851 linkPart.RotationOffset = worldRot;
1872 1852
@@ -1909,28 +1889,23 @@ namespace OpenSim.Region.Environment.Scenes
1909 1889
1910 part.LinkNum = m_parts.Count; 1890 part.LinkNum = m_parts.Count;
1911 1891
1912 Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z); 1892 Vector3 oldPos = part.OffsetPosition;
1913 axiomOldPos = oldGroupRotation * axiomOldPos; 1893 oldPos *= oldGroupRotation;
1914 axiomOldPos += oldGroupPosition; 1894 oldPos += oldGroupPosition;
1915 LLVector3 oldAbsolutePosition = new LLVector3(axiomOldPos.x, axiomOldPos.y, axiomOldPos.z); 1895 Vector3 oldAbsolutePosition = oldPos;
1916 part.OffsetPosition = oldAbsolutePosition - AbsolutePosition; 1896 part.OffsetPosition = oldAbsolutePosition - AbsolutePosition;
1917 1897
1918 Quaternion axiomRootRotation = 1898 Quaternion rootRotation = m_rootPart.RotationOffset;
1919 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
1920 m_rootPart.RotationOffset.Z);
1921 1899
1922 Vector3 axiomPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z); 1900 Vector3 pos = part.OffsetPosition;
1923 axiomPos = axiomRootRotation.Inverse() * axiomPos; 1901 pos *= Quaternion.Inverse(rootRotation);
1924 part.OffsetPosition = new LLVector3(axiomPos.x, axiomPos.y, axiomPos.z); 1902 part.OffsetPosition = pos;
1925 1903
1926 Quaternion axiomPartRotation = 1904 Quaternion partRotation = part.RotationOffset;
1927 new Quaternion(part.RotationOffset.W, part.RotationOffset.X, part.RotationOffset.Y,
1928 part.RotationOffset.Z);
1929 1905
1930 axiomPartRotation = oldGroupRotation * axiomPartRotation; 1906 partRotation *= oldGroupRotation;
1931 axiomPartRotation = axiomRootRotation.Inverse() * axiomPartRotation; 1907 partRotation *= Quaternion.Inverse(rootRotation);
1932 part.RotationOffset = 1908 part.RotationOffset = partRotation;
1933 new LLQuaternion(axiomPartRotation.x, axiomPartRotation.y, axiomPartRotation.z, axiomPartRotation.w);
1934 } 1909 }
1935 1910
1936 /// <summary> 1911 /// <summary>
@@ -1940,7 +1915,7 @@ namespace OpenSim.Region.Environment.Scenes
1940 /// <param name="offset">Always seems to be 0,0,0, so ignoring</param> 1915 /// <param name="offset">Always seems to be 0,0,0, so ignoring</param>
1941 /// <param name="pos">New position. We do the math here to turn it into a force</param> 1916 /// <param name="pos">New position. We do the math here to turn it into a force</param>
1942 /// <param name="remoteClient"></param> 1917 /// <param name="remoteClient"></param>
1943 public void GrabMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) 1918 public void GrabMovement(Vector3 offset, Vector3 pos, IClientAPI remoteClient)
1944 { 1919 {
1945 if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) 1920 if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
1946 { 1921 {
@@ -1948,7 +1923,7 @@ namespace OpenSim.Region.Environment.Scenes
1948 { 1923 {
1949 if (m_rootPart.PhysActor.IsPhysical) 1924 if (m_rootPart.PhysActor.IsPhysical)
1950 { 1925 {
1951 LLVector3 llmoveforce = pos - AbsolutePosition; 1926 Vector3 llmoveforce = pos - AbsolutePosition;
1952 PhysicsVector grabforce = new PhysicsVector(llmoveforce.X, llmoveforce.Y, llmoveforce.Z); 1927 PhysicsVector grabforce = new PhysicsVector(llmoveforce.X, llmoveforce.Y, llmoveforce.Z);
1953 grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass; 1928 grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass;
1954 m_rootPart.PhysActor.AddForce(grabforce,true); 1929 m_rootPart.PhysActor.AddForce(grabforce,true);
@@ -1966,7 +1941,7 @@ namespace OpenSim.Region.Environment.Scenes
1966 } 1941 }
1967 } 1942 }
1968 1943
1969 public void NonPhysicalGrabMovement(LLVector3 pos) 1944 public void NonPhysicalGrabMovement(Vector3 pos)
1970 { 1945 {
1971 AbsolutePosition = pos; 1946 AbsolutePosition = pos;
1972 m_rootPart.SendTerseUpdateToAllClients(); 1947 m_rootPart.SendTerseUpdateToAllClients();
@@ -2013,7 +1988,7 @@ namespace OpenSim.Region.Environment.Scenes
2013 } 1988 }
2014 } 1989 }
2015 1990
2016 public void SetPartText(string text, LLUUID partID) 1991 public void SetPartText(string text, UUID partID)
2017 { 1992 {
2018 SceneObjectPart part = GetChildPart(partID); 1993 SceneObjectPart part = GetChildPart(partID);
2019 if (part != null) 1994 if (part != null)
@@ -2109,7 +2084,7 @@ namespace OpenSim.Region.Environment.Scenes
2109 } 2084 }
2110 } 2085 }
2111 2086
2112 public void UpdatePermissions(LLUUID AgentID, byte field, uint localID, uint mask, byte addRemTF) 2087 public void UpdatePermissions(UUID AgentID, byte field, uint localID, uint mask, byte addRemTF)
2113 { 2088 {
2114 SceneObjectPart updatePart = GetChildPart(localID); 2089 SceneObjectPart updatePart = GetChildPart(localID);
2115 updatePart.UpdatePermissions(AgentID, field, localID, mask, addRemTF); 2090 updatePart.UpdatePermissions(AgentID, field, localID, mask, addRemTF);
@@ -2145,7 +2120,7 @@ namespace OpenSim.Region.Environment.Scenes
2145 /// </summary> 2120 /// </summary>
2146 /// <param name="scale"></param> 2121 /// <param name="scale"></param>
2147 /// <param name="localID"></param> 2122 /// <param name="localID"></param>
2148 public void Resize(LLVector3 scale, uint localID) 2123 public void Resize(Vector3 scale, uint localID)
2149 { 2124 {
2150 if (scale.X > m_scene.m_maxNonphys) 2125 if (scale.X > m_scene.m_maxNonphys)
2151 scale.X = m_scene.m_maxNonphys; 2126 scale.X = m_scene.m_maxNonphys;
@@ -2190,7 +2165,7 @@ namespace OpenSim.Region.Environment.Scenes
2190 } 2165 }
2191 } 2166 }
2192 2167
2193 public void GroupResize(LLVector3 scale, uint localID) 2168 public void GroupResize(Vector3 scale, uint localID)
2194 { 2169 {
2195 SceneObjectPart part = GetChildPart(localID); 2170 SceneObjectPart part = GetChildPart(localID);
2196 if (part != null) 2171 if (part != null)
@@ -2222,7 +2197,7 @@ namespace OpenSim.Region.Environment.Scenes
2222 { 2197 {
2223 if (obPart.UUID != m_rootPart.UUID) 2198 if (obPart.UUID != m_rootPart.UUID)
2224 { 2199 {
2225 LLVector3 oldSize = new LLVector3(obPart.Scale); 2200 Vector3 oldSize = new Vector3(obPart.Scale);
2226 2201
2227 float f = 1.0f; 2202 float f = 1.0f;
2228 float a = 1.0f; 2203 float a = 1.0f;
@@ -2286,7 +2261,7 @@ namespace OpenSim.Region.Environment.Scenes
2286 } 2261 }
2287 } 2262 }
2288 2263
2289 LLVector3 prevScale = part.Scale; 2264 Vector3 prevScale = part.Scale;
2290 prevScale.X *= x; 2265 prevScale.X *= x;
2291 prevScale.Y *= y; 2266 prevScale.Y *= y;
2292 prevScale.Z *= z; 2267 prevScale.Z *= z;
@@ -2298,11 +2273,11 @@ namespace OpenSim.Region.Environment.Scenes
2298 { 2273 {
2299 if (obPart.UUID != m_rootPart.UUID) 2274 if (obPart.UUID != m_rootPart.UUID)
2300 { 2275 {
2301 LLVector3 currentpos = new LLVector3(obPart.OffsetPosition); 2276 Vector3 currentpos = new Vector3(obPart.OffsetPosition);
2302 currentpos.X *= x; 2277 currentpos.X *= x;
2303 currentpos.Y *= y; 2278 currentpos.Y *= y;
2304 currentpos.Z *= z; 2279 currentpos.Z *= z;
2305 LLVector3 newSize = new LLVector3(obPart.Scale); 2280 Vector3 newSize = new Vector3(obPart.Scale);
2306 newSize.X *= x; 2281 newSize.X *= x;
2307 newSize.Y *= y; 2282 newSize.Y *= y;
2308 newSize.Z *= z; 2283 newSize.Z *= z;
@@ -2332,7 +2307,7 @@ namespace OpenSim.Region.Environment.Scenes
2332 /// Move this scene object 2307 /// Move this scene object
2333 /// </summary> 2308 /// </summary>
2334 /// <param name="pos"></param> 2309 /// <param name="pos"></param>
2335 public void UpdateGroupPosition(LLVector3 pos) 2310 public void UpdateGroupPosition(Vector3 pos)
2336 { 2311 {
2337 if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) 2312 if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
2338 { 2313 {
@@ -2356,7 +2331,7 @@ namespace OpenSim.Region.Environment.Scenes
2356 /// </summary> 2331 /// </summary>
2357 /// <param name="pos"></param> 2332 /// <param name="pos"></param>
2358 /// <param name="localID"></param> 2333 /// <param name="localID"></param>
2359 public void UpdateSinglePosition(LLVector3 pos, uint localID) 2334 public void UpdateSinglePosition(Vector3 pos, uint localID)
2360 { 2335 {
2361 SceneObjectPart part = GetChildPart(localID); 2336 SceneObjectPart part = GetChildPart(localID);
2362 2337
@@ -2379,22 +2354,18 @@ namespace OpenSim.Region.Environment.Scenes
2379 /// 2354 ///
2380 /// </summary> 2355 /// </summary>
2381 /// <param name="pos"></param> 2356 /// <param name="pos"></param>
2382 private void UpdateRootPosition(LLVector3 pos) 2357 private void UpdateRootPosition(Vector3 pos)
2383 { 2358 {
2384 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); 2359 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
2385 LLVector3 oldPos = 2360 Vector3 oldPos =
2386 new LLVector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X, 2361 new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X,
2387 AbsolutePosition.Y + m_rootPart.OffsetPosition.Y, 2362 AbsolutePosition.Y + m_rootPart.OffsetPosition.Y,
2388 AbsolutePosition.Z + m_rootPart.OffsetPosition.Z); 2363 AbsolutePosition.Z + m_rootPart.OffsetPosition.Z);
2389 LLVector3 diff = oldPos - newPos; 2364 Vector3 diff = oldPos - newPos;
2390 Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); 2365 Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z);
2391 Quaternion partRotation = 2366 Quaternion partRotation = m_rootPart.RotationOffset;
2392 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, 2367 axDiff *= Quaternion.Inverse(partRotation);
2393 m_rootPart.RotationOffset.Z); 2368 diff = axDiff;
2394 axDiff = partRotation.Inverse() * axDiff;
2395 diff.X = axDiff.x;
2396 diff.Y = axDiff.y;
2397 diff.Z = axDiff.z;
2398 2369
2399 lock (m_parts) 2370 lock (m_parts)
2400 { 2371 {
@@ -2413,7 +2384,7 @@ namespace OpenSim.Region.Environment.Scenes
2413 ScheduleGroupForTerseUpdate(); 2384 ScheduleGroupForTerseUpdate();
2414 } 2385 }
2415 2386
2416 public void OffsetForNewRegion(LLVector3 offset) 2387 public void OffsetForNewRegion(Vector3 offset)
2417 { 2388 {
2418 m_rootPart.GroupPosition = offset; 2389 m_rootPart.GroupPosition = offset;
2419 } 2390 }
@@ -2426,14 +2397,12 @@ namespace OpenSim.Region.Environment.Scenes
2426 /// 2397 ///
2427 /// </summary> 2398 /// </summary>
2428 /// <param name="rot"></param> 2399 /// <param name="rot"></param>
2429 public void UpdateGroupRotation(LLQuaternion rot) 2400 public void UpdateGroupRotation(Quaternion rot)
2430 { 2401 {
2431 m_rootPart.UpdateRotation(rot); 2402 m_rootPart.UpdateRotation(rot);
2432 if (m_rootPart.PhysActor != null) 2403 if (m_rootPart.PhysActor != null)
2433 { 2404 {
2434 m_rootPart.PhysActor.Orientation = 2405 m_rootPart.PhysActor.Orientation = m_rootPart.RotationOffset;
2435 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
2436 m_rootPart.RotationOffset.Z);
2437 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); 2406 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
2438 } 2407 }
2439 2408
@@ -2446,14 +2415,12 @@ namespace OpenSim.Region.Environment.Scenes
2446 /// </summary> 2415 /// </summary>
2447 /// <param name="pos"></param> 2416 /// <param name="pos"></param>
2448 /// <param name="rot"></param> 2417 /// <param name="rot"></param>
2449 public void UpdateGroupRotation(LLVector3 pos, LLQuaternion rot) 2418 public void UpdateGroupRotation(Vector3 pos, Quaternion rot)
2450 { 2419 {
2451 m_rootPart.UpdateRotation(rot); 2420 m_rootPart.UpdateRotation(rot);
2452 if (m_rootPart.PhysActor != null) 2421 if (m_rootPart.PhysActor != null)
2453 { 2422 {
2454 m_rootPart.PhysActor.Orientation = 2423 m_rootPart.PhysActor.Orientation = m_rootPart.RotationOffset;
2455 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
2456 m_rootPart.RotationOffset.Z);
2457 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); 2424 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
2458 } 2425 }
2459 AbsolutePosition = pos; 2426 AbsolutePosition = pos;
@@ -2467,7 +2434,7 @@ namespace OpenSim.Region.Environment.Scenes
2467 /// </summary> 2434 /// </summary>
2468 /// <param name="rot"></param> 2435 /// <param name="rot"></param>
2469 /// <param name="localID"></param> 2436 /// <param name="localID"></param>
2470 public void UpdateSingleRotation(LLQuaternion rot, uint localID) 2437 public void UpdateSingleRotation(Quaternion rot, uint localID)
2471 { 2438 {
2472 SceneObjectPart part = GetChildPart(localID); 2439 SceneObjectPart part = GetChildPart(localID);
2473 if (part != null) 2440 if (part != null)
@@ -2487,19 +2454,15 @@ namespace OpenSim.Region.Environment.Scenes
2487 /// 2454 ///
2488 /// </summary> 2455 /// </summary>
2489 /// <param name="rot"></param> 2456 /// <param name="rot"></param>
2490 private void UpdateRootRotation(LLQuaternion rot) 2457 private void UpdateRootRotation(Quaternion rot)
2491 { 2458 {
2492 Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z); 2459 Quaternion axRot = rot;
2493 Quaternion oldParentRot = 2460 Quaternion oldParentRot = m_rootPart.RotationOffset;
2494 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
2495 m_rootPart.RotationOffset.Z);
2496 2461
2497 m_rootPart.UpdateRotation(rot); 2462 m_rootPart.UpdateRotation(rot);
2498 if (m_rootPart.PhysActor != null) 2463 if (m_rootPart.PhysActor != null)
2499 { 2464 {
2500 m_rootPart.PhysActor.Orientation = 2465 m_rootPart.PhysActor.Orientation = m_rootPart.RotationOffset;
2501 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
2502 m_rootPart.RotationOffset.Z);
2503 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); 2466 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
2504 } 2467 }
2505 2468
@@ -2509,16 +2472,14 @@ namespace OpenSim.Region.Environment.Scenes
2509 { 2472 {
2510 if (prim.UUID != m_rootPart.UUID) 2473 if (prim.UUID != m_rootPart.UUID)
2511 { 2474 {
2512 Vector3 axPos = new Vector3(prim.OffsetPosition.X, prim.OffsetPosition.Y, prim.OffsetPosition.Z); 2475 Vector3 axPos = prim.OffsetPosition;
2513 axPos = oldParentRot * axPos; 2476 axPos *= oldParentRot;
2514 axPos = axRot.Inverse() * axPos; 2477 axPos *= Quaternion.Inverse(axRot);
2515 prim.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z); 2478 prim.OffsetPosition = axPos;
2516 Quaternion primsRot = 2479 Quaternion primsRot = prim.RotationOffset;
2517 new Quaternion(prim.RotationOffset.W, prim.RotationOffset.X, prim.RotationOffset.Y,
2518 prim.RotationOffset.Z);
2519 Quaternion newRot = oldParentRot * primsRot; 2480 Quaternion newRot = oldParentRot * primsRot;
2520 newRot = axRot.Inverse() * newRot; 2481 newRot *= Quaternion.Inverse(axRot);
2521 prim.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); 2482 prim.RotationOffset = newRot;
2522 prim.ScheduleTerseUpdate(); 2483 prim.ScheduleTerseUpdate();
2523 } 2484 }
2524 } 2485 }
@@ -2562,7 +2523,7 @@ namespace OpenSim.Region.Environment.Scenes
2562 } 2523 }
2563 } 2524 }
2564 2525
2565 public int registerTargetWaypoint(LLVector3 target, float tolerance) 2526 public int registerTargetWaypoint(Vector3 target, float tolerance)
2566 { 2527 {
2567 scriptPosTarget waypoint = new scriptPosTarget(); 2528 scriptPosTarget waypoint = new scriptPosTarget();
2568 waypoint.targetPos = target; 2529 waypoint.targetPos = target;
@@ -2590,7 +2551,7 @@ namespace OpenSim.Region.Environment.Scenes
2590 if (m_targets.Count > 0) 2551 if (m_targets.Count > 0)
2591 { 2552 {
2592 bool at_target = false; 2553 bool at_target = false;
2593 //LLVector3 targetPos; 2554 //Vector3 targetPos;
2594 //uint targetHandle; 2555 //uint targetHandle;
2595 Dictionary<uint, scriptPosTarget> atTargets = new Dictionary<uint, scriptPosTarget>(); 2556 Dictionary<uint, scriptPosTarget> atTargets = new Dictionary<uint, scriptPosTarget>();
2596 lock (m_targets) 2557 lock (m_targets)
@@ -2681,11 +2642,11 @@ namespace OpenSim.Region.Environment.Scenes
2681 { 2642 {
2682 if (RootPart != null) 2643 if (RootPart != null)
2683 { 2644 {
2684 if ((RootPart.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Phantom) == 0) 2645 if ((RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) == 0)
2685 { 2646 {
2686 foreach (SceneObjectPart part in m_parts.Values) 2647 foreach (SceneObjectPart part in m_parts.Values)
2687 { 2648 {
2688 if (part.Shape.SculptEntry && part.Shape.SculptTexture != LLUUID.Zero) 2649 if (part.Shape.SculptEntry && part.Shape.SculptTexture != UUID.Zero)
2689 { 2650 {
2690 m_scene.AssetCache.GetAsset(part.Shape.SculptTexture, part.SculptTextureCallback, true); 2651 m_scene.AssetCache.GetAsset(part.Shape.SculptTexture, part.SculptTextureCallback, true);
2691 } 2652 }
@@ -2700,7 +2661,7 @@ namespace OpenSim.Region.Environment.Scenes
2700 /// </summary> 2661 /// </summary>
2701 /// <param name="GroupID"></param> 2662 /// <param name="GroupID"></param>
2702 /// <param name="client"></param> 2663 /// <param name="client"></param>
2703 public void SetGroup(LLUUID GroupID, IClientAPI client) 2664 public void SetGroup(UUID GroupID, IClientAPI client)
2704 { 2665 {
2705 lock (m_parts) 2666 lock (m_parts)
2706 { 2667 {