aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorKitto Flora2009-12-17 02:54:02 -0500
committerKitto Flora2009-12-17 02:54:02 -0500
commit6483470ec5e9000fb6a85bbdfe5b79be6f336a74 (patch)
tree96822de6a1e714485702e026ff2599a03bd02b16 /OpenSim/Region/Framework
parentMerge branch 'tests' (diff)
downloadopensim-SC_OLD-6483470ec5e9000fb6a85bbdfe5b79be6f336a74.zip
opensim-SC_OLD-6483470ec5e9000fb6a85bbdfe5b79be6f336a74.tar.gz
opensim-SC_OLD-6483470ec5e9000fb6a85bbdfe5b79be6f336a74.tar.bz2
opensim-SC_OLD-6483470ec5e9000fb6a85bbdfe5b79be6f336a74.tar.xz
Fix GetWorldRotation(), and a host of related Sit fixes.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs73
2 files changed, 38 insertions, 37 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 778e384..4495eda 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1775,7 +1775,7 @@ namespace OpenSim.Region.Framework.Scenes
1775 { 1775 {
1776 Quaternion newRot; 1776 Quaternion newRot;
1777 1777
1778 if (this.LinkNum == 0) 1778 if (this.LinkNum < 2) //KF Single or root prim
1779 { 1779 {
1780 newRot = RotationOffset; 1780 newRot = RotationOffset;
1781 } 1781 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index c67463a..865f649 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1661,14 +1661,14 @@ namespace OpenSim.Region.Framework.Scenes
1661 // Rotation is the sittiing Av's rotation 1661 // Rotation is the sittiing Av's rotation
1662 1662
1663 Quaternion partRot; 1663 Quaternion partRot;
1664 if (part.LinkNum == 1) 1664// if (part.LinkNum == 1)
1665 { // Root prim of linkset 1665// { // Root prim of linkset
1666 partRot = part.ParentGroup.RootPart.RotationOffset; 1666// partRot = part.ParentGroup.RootPart.RotationOffset;
1667 } 1667// }
1668 else 1668// else
1669 { // single or child prim 1669// { // single or child prim
1670 partRot = part.GetWorldRotation(); 1670 partRot = part.GetWorldRotation();
1671 } 1671// }
1672 Quaternion partIRot = Quaternion.Inverse(partRot); 1672 Quaternion partIRot = Quaternion.Inverse(partRot);
1673 1673
1674 Quaternion avatarRot = Quaternion.Inverse(Quaternion.Inverse(Rotation) * partIRot); // world or. of the av 1674 Quaternion avatarRot = Quaternion.Inverse(Quaternion.Inverse(Rotation) * partIRot); // world or. of the av
@@ -1763,14 +1763,14 @@ namespace OpenSim.Region.Framework.Scenes
1763 bool SitTargetisSet = (Vector3.Zero != avSitOffSet); //NB Latest SL Spec shows Sit Rotation setting is ignored. 1763 bool SitTargetisSet = (Vector3.Zero != avSitOffSet); //NB Latest SL Spec shows Sit Rotation setting is ignored.
1764 // Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation()); 1764 // Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation());
1765 Quaternion partRot; 1765 Quaternion partRot;
1766 if (part.LinkNum == 1) 1766// if (part.LinkNum == 1)
1767 { // Root prim of linkset 1767// { // Root prim of linkset
1768 partRot = part.ParentGroup.RootPart.RotationOffset; 1768// partRot = part.ParentGroup.RootPart.RotationOffset;
1769 } 1769// }
1770 else 1770// else
1771 { // single or child prim 1771// { // single or child prim
1772 partRot = part.GetWorldRotation(); 1772 partRot = part.GetWorldRotation();
1773 } 1773// }
1774 Quaternion partIRot = Quaternion.Inverse(partRot); 1774 Quaternion partIRot = Quaternion.Inverse(partRot);
1775//Console.WriteLine("SendSitResponse offset=" + offset + " Occup=" + part.IsOccupied + " TargSet=" + SitTargetisSet); 1775//Console.WriteLine("SendSitResponse offset=" + offset + " Occup=" + part.IsOccupied + " TargSet=" + SitTargetisSet);
1776 // Sit analysis rewritten by KF 091125 1776 // Sit analysis rewritten by KF 091125
@@ -1846,15 +1846,15 @@ namespace OpenSim.Region.Framework.Scenes
1846 Vector3 offsetr; // = offset * partIRot; 1846 Vector3 offsetr; // = offset * partIRot;
1847 // KF: In a linkset, offsetr needs to be relative to the group root! 091208 1847 // KF: In a linkset, offsetr needs to be relative to the group root! 091208
1848 // offsetr = (part.OffsetPosition * Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset)) + (offset * partIRot); 1848 // offsetr = (part.OffsetPosition * Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset)) + (offset * partIRot);
1849 if (part.LinkNum < 2) 1849 // if (part.LinkNum < 2) 091216 All this was necessary because of the GetWorldRotation error.
1850 { // Single, or Root prim of linkset, target is ClickOffset * RootRot 1850 // { // Single, or Root prim of linkset, target is ClickOffset * RootRot
1851 offsetr = offset * partIRot; 1851 offsetr = offset * partIRot;
1852 } 1852//
1853 else 1853 // else
1854 { // Child prim, offset is (ChildOffset * RootRot) + (ClickOffset * ChildRot) 1854 // { // Child prim, offset is (ChildOffset * RootRot) + (ClickOffset * ChildRot)
1855 offsetr = //(part.OffsetPosition * Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset)) + 1855 // offsetr = //(part.OffsetPosition * Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset)) +
1856 (offset * partRot); 1856 // (offset * partRot);
1857 } 1857 // }
1858 1858
1859//Console.WriteLine(" "); 1859//Console.WriteLine(" ");
1860//Console.WriteLine("link number ={0}", part.LinkNum); 1860//Console.WriteLine("link number ={0}", part.LinkNum);
@@ -2170,6 +2170,7 @@ namespace OpenSim.Region.Framework.Scenes
2170 { 2170 {
2171 if (part != null) 2171 if (part != null)
2172 { 2172 {
2173//Console.WriteLine("Link #{0}, Rot {1}", part.LinkNum, part.GetWorldRotation());
2173 if (part.GetAvatarOnSitTarget() == UUID) 2174 if (part.GetAvatarOnSitTarget() == UUID)
2174 { 2175 {
2175//Console.WriteLine("Scripted Sit"); 2176//Console.WriteLine("Scripted Sit");
@@ -2190,14 +2191,14 @@ namespace OpenSim.Region.Framework.Scenes
2190 // Non-scripted sit by Kitto Flora 21Nov09 2191 // Non-scripted sit by Kitto Flora 21Nov09
2191 // Calculate angle of line from prim to Av 2192 // Calculate angle of line from prim to Av
2192 Quaternion partIRot; 2193 Quaternion partIRot;
2193 if (part.LinkNum == 1) 2194// if (part.LinkNum == 1)
2194 { // Root prim of linkset 2195// { // Root prim of linkset
2195 partIRot = Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset); 2196// partIRot = Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset);
2196 } 2197// }
2197 else 2198// else
2198 { // single or child prim 2199// { // single or child prim
2199 partIRot = Quaternion.Inverse(part.GetWorldRotation()); 2200 partIRot = Quaternion.Inverse(part.GetWorldRotation());
2200 } 2201// }
2201 Vector3 sitTargetPos= part.AbsolutePosition + m_avUnscriptedSitPos; 2202 Vector3 sitTargetPos= part.AbsolutePosition + m_avUnscriptedSitPos;
2202 float y_diff = (m_avInitialPos.Y - sitTargetPos.Y); 2203 float y_diff = (m_avInitialPos.Y - sitTargetPos.Y);
2203 float x_diff = ( m_avInitialPos.X - sitTargetPos.X); 2204 float x_diff = ( m_avInitialPos.X - sitTargetPos.X);
@@ -2253,14 +2254,14 @@ namespace OpenSim.Region.Framework.Scenes
2253 // collisionPoint.Z = global sit surface height 2254 // collisionPoint.Z = global sit surface height
2254 SceneObjectPart part = m_scene.GetSceneObjectPart(localid); 2255 SceneObjectPart part = m_scene.GetSceneObjectPart(localid);
2255 Quaternion partIRot; 2256 Quaternion partIRot;
2256 if (part.LinkNum == 1) 2257// if (part.LinkNum == 1)
2257 { // Root prim of linkset 2258/// { // Root prim of linkset
2258 partIRot = Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset); 2259// partIRot = Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset);
2259 } 2260// }
2260 else 2261// else
2261 { // single or child prim 2262// { // single or child prim
2262 partIRot = Quaternion.Inverse(part.GetWorldRotation()); 2263 partIRot = Quaternion.Inverse(part.GetWorldRotation());
2263 } 2264// }
2264 float offZ = collisionPoint.Z - m_initialSitTarget.Z; 2265 float offZ = collisionPoint.Z - m_initialSitTarget.Z;
2265 Vector3 offset = new Vector3(0.0f, 0.0f, offZ) * partIRot; // Altitude correction 2266 Vector3 offset = new Vector3(0.0f, 0.0f, offZ) * partIRot; // Altitude correction
2266//Console.WriteLine("sitPoint={0}, offset={1}", sitPoint, offset); 2267//Console.WriteLine("sitPoint={0}, offset={1}", sitPoint, offset);