aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMW2009-07-17 14:58:54 +0000
committerMW2009-07-17 14:58:54 +0000
commitacea31518b00b02e2ba8b08106a76de0fbef29ab (patch)
tree78a4cb7eace911f11077045c1f0fb1266392c9dc /OpenSim/Region
parent* Change the order of Update so Physics processes a frame before the scene ma... (diff)
downloadopensim-SC_OLD-acea31518b00b02e2ba8b08106a76de0fbef29ab.zip
opensim-SC_OLD-acea31518b00b02e2ba8b08106a76de0fbef29ab.tar.gz
opensim-SC_OLD-acea31518b00b02e2ba8b08106a76de0fbef29ab.tar.bz2
opensim-SC_OLD-acea31518b00b02e2ba8b08106a76de0fbef29ab.tar.xz
fixed the bug where changing the rotation of a selection of prims in a linkset, made each of those prims rotate around its own centre rather than around the geometric centre of the selection like they should do (and like the client expects).
This involved adding a new OnUpdatePrimSingleRotationPosition event to IClientAPI so that we can get the changed position from the client. Btw adding new events to IClientAPI is really tedious where you have to copy the change across to at least 5 or 6 other files. [Note this doesn't fix the bug where any rotation changes to the root prim (but not the whole linkset) cause rotation errors on the child prims.]
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs22
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs19
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs70
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs1
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs1
7 files changed, 103 insertions, 12 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 3fdb386..a13f6d4 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -267,6 +267,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
267 267
268 private UpdateVector handlerUpdatePrimSinglePosition; //OnUpdatePrimSinglePosition; 268 private UpdateVector handlerUpdatePrimSinglePosition; //OnUpdatePrimSinglePosition;
269 private UpdatePrimSingleRotation handlerUpdatePrimSingleRotation; //OnUpdatePrimSingleRotation; 269 private UpdatePrimSingleRotation handlerUpdatePrimSingleRotation; //OnUpdatePrimSingleRotation;
270 private UpdatePrimSingleRotationPosition handlerUpdatePrimSingleRotationPosition; //OnUpdatePrimSingleRotation;
270 private UpdateVector handlerUpdatePrimScale; //OnUpdatePrimScale; 271 private UpdateVector handlerUpdatePrimScale; //OnUpdatePrimScale;
271 private UpdateVector handlerUpdatePrimGroupScale; //OnUpdateGroupScale; 272 private UpdateVector handlerUpdatePrimGroupScale; //OnUpdateGroupScale;
272 private UpdateVector handlerUpdateVector; //OnUpdatePrimGroupPosition; 273 private UpdateVector handlerUpdateVector; //OnUpdatePrimGroupPosition;
@@ -1095,6 +1096,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1095 public event UpdateVector OnUpdatePrimSinglePosition; 1096 public event UpdateVector OnUpdatePrimSinglePosition;
1096 public event UpdatePrimRotation OnUpdatePrimGroupRotation; 1097 public event UpdatePrimRotation OnUpdatePrimGroupRotation;
1097 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; 1098 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
1099 public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition;
1098 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; 1100 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
1099 public event UpdateVector OnUpdatePrimScale; 1101 public event UpdateVector OnUpdatePrimScale;
1100 public event UpdateVector OnUpdatePrimGroupScale; 1102 public event UpdateVector OnUpdatePrimGroupScale;
@@ -4481,18 +4483,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4481 handlerUpdatePrimSingleRotation = OnUpdatePrimSingleRotation; 4483 handlerUpdatePrimSingleRotation = OnUpdatePrimSingleRotation;
4482 if (handlerUpdatePrimSingleRotation != null) 4484 if (handlerUpdatePrimSingleRotation != null)
4483 { 4485 {
4484 //m_log.Debug("new tab rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); 4486 // m_log.Info("new tab rotation is " + rot1.X + " , " + rot1.Y + " , " + rot1.Z + " , " + rot1.W);
4485 handlerUpdatePrimSingleRotation(localId, rot1, this); 4487 handlerUpdatePrimSingleRotation(localId, rot1, this);
4486 } 4488 }
4487 break; 4489 break;
4488 case 3: 4490 case 3:
4489 4491 Vector3 rotPos = new Vector3(block.Data, 0);
4490 Quaternion rot2 = new Quaternion(block.Data, 12, true); 4492 Quaternion rot2 = new Quaternion(block.Data, 12, true);
4491 handlerUpdatePrimSingleRotation = OnUpdatePrimSingleRotation; 4493
4492 if (handlerUpdatePrimSingleRotation != null) 4494 handlerUpdatePrimSingleRotationPosition = OnUpdatePrimSingleRotationPosition;
4495 if (handlerUpdatePrimSingleRotationPosition != null)
4493 { 4496 {
4494 //m_log.Debug("new mouse rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); 4497 // m_log.Debug("new mouse rotation position is " + rotPos.X + " , " + rotPos.Y + " , " + rotPos.Z);
4495 handlerUpdatePrimSingleRotation(localId, rot2, this); 4498 // m_log.Info("new mouse rotation is " + rot2.X + " , " + rot2.Y + " , " + rot2.Z + " , " + rot2.W);
4499 handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this);
4496 } 4500 }
4497 break; 4501 break;
4498 case 4: 4502 case 4:
@@ -4541,7 +4545,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4541 handlerUpdatePrimRotation = OnUpdatePrimGroupRotation; 4545 handlerUpdatePrimRotation = OnUpdatePrimGroupRotation;
4542 if (handlerUpdatePrimRotation != null) 4546 if (handlerUpdatePrimRotation != null)
4543 { 4547 {
4544 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); 4548 // Console.WriteLine("new rotation is " + rot3.X + " , " + rot3.Y + " , " + rot3.Z + " , " + rot3.W);
4545 handlerUpdatePrimRotation(localId, rot3, this); 4549 handlerUpdatePrimRotation(localId, rot3, this);
4546 } 4550 }
4547 break; 4551 break;
@@ -4552,8 +4556,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4552 handlerUpdatePrimGroupRotation = OnUpdatePrimGroupMouseRotation; 4556 handlerUpdatePrimGroupRotation = OnUpdatePrimGroupMouseRotation;
4553 if (handlerUpdatePrimGroupRotation != null) 4557 if (handlerUpdatePrimGroupRotation != null)
4554 { 4558 {
4555 //m_log.Debug("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); 4559 // m_log.Debug("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
4556 // m_log.Debug("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); 4560 // m_log.Debug("new group mouse rotation is " + rot4.X + " , " + rot4.Y + " , " + rot4.Z + " , " + rot4.W);
4557 handlerUpdatePrimGroupRotation(localId, pos3, rot4, this); 4561 handlerUpdatePrimGroupRotation(localId, pos3, rot4, this);
4558 } 4562 }
4559 break; 4563 break;
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 5e33729..ed38046 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -117,6 +117,7 @@ namespace OpenSim.Region.Examples.SimpleModule
117 public event UpdateVector OnUpdatePrimGroupPosition; 117 public event UpdateVector OnUpdatePrimGroupPosition;
118 public event UpdateVector OnUpdatePrimSinglePosition; 118 public event UpdateVector OnUpdatePrimSinglePosition;
119 public event UpdatePrimRotation OnUpdatePrimGroupRotation; 119 public event UpdatePrimRotation OnUpdatePrimGroupRotation;
120 public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition;
120 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; 121 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
121 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; 122 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
122 public event UpdateVector OnUpdatePrimScale; 123 public event UpdateVector OnUpdatePrimScale;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 81d54e7..63cf9ce 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1964,6 +1964,7 @@ namespace OpenSim.Region.Framework.Scenes
1964 client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation; 1964 client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation;
1965 client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimRotation; 1965 client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimRotation;
1966 client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; 1966 client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation;
1967 client.OnUpdatePrimSingleRotationPosition += m_sceneGraph.UpdatePrimSingleRotationPosition;
1967 client.OnUpdatePrimScale += m_sceneGraph.UpdatePrimScale; 1968 client.OnUpdatePrimScale += m_sceneGraph.UpdatePrimScale;
1968 client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale; 1969 client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale;
1969 client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam; 1970 client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam;
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 62870d5..3f63481 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1207,6 +1207,25 @@ namespace OpenSim.Region.Framework.Scenes
1207 /// <param name="localID"></param> 1207 /// <param name="localID"></param>
1208 /// <param name="rot"></param> 1208 /// <param name="rot"></param>
1209 /// <param name="remoteClient"></param> 1209 /// <param name="remoteClient"></param>
1210 protected internal void UpdatePrimSingleRotationPosition(uint localID, Quaternion rot, Vector3 pos, IClientAPI remoteClient)
1211 {
1212 SceneObjectGroup group = GetGroupByPrim(localID);
1213 if (group != null)
1214 {
1215 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))
1216 {
1217 group.UpdateSingleRotation(rot,pos, localID);
1218 }
1219 }
1220 }
1221
1222
1223 /// <summary>
1224 ///
1225 /// </summary>
1226 /// <param name="localID"></param>
1227 /// <param name="rot"></param>
1228 /// <param name="remoteClient"></param>
1210 protected internal void UpdatePrimRotation(uint localID, Quaternion rot, IClientAPI remoteClient) 1229 protected internal void UpdatePrimRotation(uint localID, Quaternion rot, IClientAPI remoteClient)
1211 { 1230 {
1212 SceneObjectGroup group = GetGroupByPrim(localID); 1231 SceneObjectGroup group = GetGroupByPrim(localID);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index e987445..00ae504 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -625,6 +625,8 @@ namespace OpenSim.Region.Framework.Scenes
625 Vector3 backBottomLeft; 625 Vector3 backBottomLeft;
626 Vector3 backBottomRight; 626 Vector3 backBottomRight;
627 627
628 // Vector3[] corners = new Vector3[8];
629
628 Vector3 orig = Vector3.Zero; 630 Vector3 orig = Vector3.Zero;
629 631
630 frontTopLeft.X = orig.X - (part.Scale.X / 2); 632 frontTopLeft.X = orig.X - (part.Scale.X / 2);
@@ -660,6 +662,36 @@ namespace OpenSim.Region.Framework.Scenes
660 backBottomRight.Y = orig.Y + (part.Scale.Y / 2); 662 backBottomRight.Y = orig.Y + (part.Scale.Y / 2);
661 backBottomRight.Z = orig.Z - (part.Scale.Z / 2); 663 backBottomRight.Z = orig.Z - (part.Scale.Z / 2);
662 664
665 //m_log.InfoFormat("pre corner 1 is {0} {1} {2}", frontTopLeft.X, frontTopLeft.Y, frontTopLeft.Z);
666 //m_log.InfoFormat("pre corner 2 is {0} {1} {2}", frontTopRight.X, frontTopRight.Y, frontTopRight.Z);
667 //m_log.InfoFormat("pre corner 3 is {0} {1} {2}", frontBottomRight.X, frontBottomRight.Y, frontBottomRight.Z);
668 //m_log.InfoFormat("pre corner 4 is {0} {1} {2}", frontBottomLeft.X, frontBottomLeft.Y, frontBottomLeft.Z);
669 //m_log.InfoFormat("pre corner 5 is {0} {1} {2}", backTopLeft.X, backTopLeft.Y, backTopLeft.Z);
670 //m_log.InfoFormat("pre corner 6 is {0} {1} {2}", backTopRight.X, backTopRight.Y, backTopRight.Z);
671 //m_log.InfoFormat("pre corner 7 is {0} {1} {2}", backBottomRight.X, backBottomRight.Y, backBottomRight.Z);
672 //m_log.InfoFormat("pre corner 8 is {0} {1} {2}", backBottomLeft.X, backBottomLeft.Y, backBottomLeft.Z);
673
674 //for (int i = 0; i < 8; i++)
675 //{
676 // corners[i] = corners[i] * worldRot;
677 // corners[i] += offset;
678
679 // if (corners[i].X > maxX)
680 // maxX = corners[i].X;
681 // if (corners[i].X < minX)
682 // minX = corners[i].X;
683
684 // if (corners[i].Y > maxY)
685 // maxY = corners[i].Y;
686 // if (corners[i].Y < minY)
687 // minY = corners[i].Y;
688
689 // if (corners[i].Z > maxZ)
690 // maxZ = corners[i].Y;
691 // if (corners[i].Z < minZ)
692 // minZ = corners[i].Z;
693 //}
694
663 frontTopLeft = frontTopLeft * worldRot; 695 frontTopLeft = frontTopLeft * worldRot;
664 frontTopRight = frontTopRight * worldRot; 696 frontTopRight = frontTopRight * worldRot;
665 frontBottomLeft = frontBottomLeft * worldRot; 697 frontBottomLeft = frontBottomLeft * worldRot;
@@ -681,6 +713,15 @@ namespace OpenSim.Region.Framework.Scenes
681 backTopLeft += offset; 713 backTopLeft += offset;
682 backTopRight += offset; 714 backTopRight += offset;
683 715
716 //m_log.InfoFormat("corner 1 is {0} {1} {2}", frontTopLeft.X, frontTopLeft.Y, frontTopLeft.Z);
717 //m_log.InfoFormat("corner 2 is {0} {1} {2}", frontTopRight.X, frontTopRight.Y, frontTopRight.Z);
718 //m_log.InfoFormat("corner 3 is {0} {1} {2}", frontBottomRight.X, frontBottomRight.Y, frontBottomRight.Z);
719 //m_log.InfoFormat("corner 4 is {0} {1} {2}", frontBottomLeft.X, frontBottomLeft.Y, frontBottomLeft.Z);
720 //m_log.InfoFormat("corner 5 is {0} {1} {2}", backTopLeft.X, backTopLeft.Y, backTopLeft.Z);
721 //m_log.InfoFormat("corner 6 is {0} {1} {2}", backTopRight.X, backTopRight.Y, backTopRight.Z);
722 //m_log.InfoFormat("corner 7 is {0} {1} {2}", backBottomRight.X, backBottomRight.Y, backBottomRight.Z);
723 //m_log.InfoFormat("corner 8 is {0} {1} {2}", backBottomLeft.X, backBottomLeft.Y, backBottomLeft.Z);
724
684 if (frontTopRight.X > maxX) 725 if (frontTopRight.X > maxX)
685 maxX = frontTopRight.X; 726 maxX = frontTopRight.X;
686 if (frontTopLeft.X > maxX) 727 if (frontTopLeft.X > maxX)
@@ -801,15 +842,15 @@ namespace OpenSim.Region.Framework.Scenes
801 if (lower > maxZ) 842 if (lower > maxZ)
802 { 843 {
803 offsetHeight = lower - (boundingBox.Z / 2); 844 offsetHeight = lower - (boundingBox.Z / 2);
804 845
805 } 846 }
806 else if (maxZ > lower) 847 else if (maxZ > lower)
807 { 848 {
808 offsetHeight = maxZ - (boundingBox.Z / 2); 849 offsetHeight = maxZ - (boundingBox.Z / 2);
809 offsetHeight *= -1; 850 offsetHeight *= -1;
810 } 851 }
811 852
812 // m_log.InfoFormat("BoundingBox is {0} , {1} , {2} ", boundingBox.X, boundingBox.Y, boundingBox.Z); 853 // m_log.InfoFormat("BoundingBox is {0} , {1} , {2} ", boundingBox.X, boundingBox.Y, boundingBox.Z);
813 return boundingBox; 854 return boundingBox;
814 } 855 }
815 #endregion 856 #endregion
@@ -3017,6 +3058,29 @@ namespace OpenSim.Region.Framework.Scenes
3017 /// 3058 ///
3018 /// </summary> 3059 /// </summary>
3019 /// <param name="rot"></param> 3060 /// <param name="rot"></param>
3061 /// <param name="localID"></param>
3062 public void UpdateSingleRotation(Quaternion rot, Vector3 pos, uint localID)
3063 {
3064 SceneObjectPart part = GetChildPart(localID);
3065 if (part != null)
3066 {
3067 if (part.UUID == m_rootPart.UUID)
3068 {
3069 UpdateRootRotation(rot);
3070 AbsolutePosition = pos;
3071 }
3072 else
3073 {
3074 part.UpdateRotation(rot);
3075 part.OffsetPosition = pos;
3076 }
3077 }
3078 }
3079
3080 /// <summary>
3081 ///
3082 /// </summary>
3083 /// <param name="rot"></param>
3020 private void UpdateRootRotation(Quaternion rot) 3084 private void UpdateRootRotation(Quaternion rot)
3021 { 3085 {
3022 Quaternion axRot = rot; 3086 Quaternion axRot = rot;
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 8ec1780..776e972 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -699,6 +699,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
699 public event UpdateVector OnUpdatePrimSinglePosition; 699 public event UpdateVector OnUpdatePrimSinglePosition;
700 public event UpdatePrimRotation OnUpdatePrimGroupRotation; 700 public event UpdatePrimRotation OnUpdatePrimGroupRotation;
701 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; 701 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
702 public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition;
702 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; 703 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
703 public event UpdateVector OnUpdatePrimScale; 704 public event UpdateVector OnUpdatePrimScale;
704 public event UpdateVector OnUpdatePrimGroupScale; 705 public event UpdateVector OnUpdatePrimGroupScale;
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 228683e..a1ed6ee 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -223,6 +223,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
223 public event UpdateVector OnUpdatePrimGroupPosition; 223 public event UpdateVector OnUpdatePrimGroupPosition;
224 public event UpdateVector OnUpdatePrimSinglePosition; 224 public event UpdateVector OnUpdatePrimSinglePosition;
225 public event UpdatePrimRotation OnUpdatePrimGroupRotation; 225 public event UpdatePrimRotation OnUpdatePrimGroupRotation;
226 public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition;
226 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; 227 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
227 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; 228 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
228 public event UpdateVector OnUpdatePrimScale; 229 public event UpdateVector OnUpdatePrimScale;