diff options
author | Kitto Flora | 2009-12-12 10:12:59 -0500 |
---|---|---|
committer | Kitto Flora | 2009-12-12 10:12:59 -0500 |
commit | b056c243e46daa3370f8d330b70a37b5f856e9ec (patch) | |
tree | b4e2dd3b86f333c0002d2665fcb4136768b2c7cc /OpenSim/Region/Framework/Scenes | |
parent | Merge branch 'master' into careminster (diff) | |
download | opensim-SC_OLD-b056c243e46daa3370f8d330b70a37b5f856e9ec.zip opensim-SC_OLD-b056c243e46daa3370f8d330b70a37b5f856e9ec.tar.gz opensim-SC_OLD-b056c243e46daa3370f8d330b70a37b5f856e9ec.tar.bz2 opensim-SC_OLD-b056c243e46daa3370f8d330b70a37b5f856e9ec.tar.xz |
Commit partial work because of repo change
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 83 |
1 files changed, 72 insertions, 11 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c553ca0..d0c20ff 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1660,16 +1660,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
1660 | } | 1660 | } |
1661 | // part.GetWorldRotation() is the rotation of the object being sat on | 1661 | // part.GetWorldRotation() is the rotation of the object being sat on |
1662 | // Rotation is the sittiing Av's rotation | 1662 | // Rotation is the sittiing Av's rotation |
1663 | 1663 | ||
1664 | Quaternion wr = Quaternion.Inverse(Quaternion.Inverse(Rotation) * Quaternion.Inverse(part.GetWorldRotation())); // world or. of the av | 1664 | Quaternion partRot; |
1665 | Vector3 so = new Vector3(1.0f, 0f, 0f) * wr; // 1M infront of av | 1665 | if (part.LinkNum == 1) |
1666 | Vector3 wso = so + part.GetWorldPosition() + ( m_pos * part.GetWorldRotation()); // + av sit offset! | 1666 | { // Root prim of linkset |
1667 | partRot = part.ParentGroup.RootPart.RotationOffset; | ||
1668 | } | ||
1669 | else | ||
1670 | { // single or child prim | ||
1671 | partRot = part.GetWorldRotation(); | ||
1672 | } | ||
1673 | Quaternion partIRot = Quaternion.Inverse(partRot); | ||
1674 | |||
1675 | Quaternion avatarRot = Quaternion.Inverse(Quaternion.Inverse(Rotation) * partIRot); // world or. of the av | ||
1676 | Vector3 avStandUp = new Vector3(1.0f, 0f, 0f) * avatarRot; // 1M infront of av | ||
1677 | Vector3 avWorldStandUp = avStandUp + part.GetWorldPosition() + ( m_pos * partRot); // + av sit offset! | ||
1667 | 1678 | ||
1668 | if (m_physicsActor == null) | 1679 | if (m_physicsActor == null) |
1669 | { | 1680 | { |
1670 | AddToPhysicalScene(false); | 1681 | AddToPhysicalScene(false); |
1671 | } | 1682 | } |
1672 | AbsolutePosition = wso; //KF: Fix stand up. | 1683 | AbsolutePosition = avWorldStandUp; //KF: Fix stand up. |
1673 | m_parentPosition = Vector3.Zero; | 1684 | m_parentPosition = Vector3.Zero; |
1674 | m_parentID = 0; | 1685 | m_parentID = 0; |
1675 | part.IsOccupied = false; | 1686 | part.IsOccupied = false; |
@@ -1752,8 +1763,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1752 | Quaternion avSitOrientation = part.SitTargetOrientation; | 1763 | Quaternion avSitOrientation = part.SitTargetOrientation; |
1753 | 1764 | ||
1754 | bool SitTargetisSet = (Vector3.Zero != avSitOffSet); //NB Latest SL Spec shows Sit Rotation setting is ignored. | 1765 | bool SitTargetisSet = (Vector3.Zero != avSitOffSet); //NB Latest SL Spec shows Sit Rotation setting is ignored. |
1755 | Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation()); | 1766 | // Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation()); |
1756 | 1767 | Quaternion partRot; | |
1768 | if (part.LinkNum == 1) | ||
1769 | { // Root prim of linkset | ||
1770 | partRot = part.ParentGroup.RootPart.RotationOffset; | ||
1771 | } | ||
1772 | else | ||
1773 | { // single or child prim | ||
1774 | partRot = part.GetWorldRotation(); | ||
1775 | } | ||
1776 | Quaternion partIRot = Quaternion.Inverse(partRot); | ||
1757 | //Console.WriteLine("SendSitResponse offset=" + offset + " Occup=" + part.IsOccupied + " TargSet=" + SitTargetisSet); | 1777 | //Console.WriteLine("SendSitResponse offset=" + offset + " Occup=" + part.IsOccupied + " TargSet=" + SitTargetisSet); |
1758 | // Sit analysis rewritten by KF 091125 | 1778 | // Sit analysis rewritten by KF 091125 |
1759 | if (SitTargetisSet) // scipted sit | 1779 | if (SitTargetisSet) // scipted sit |
@@ -1800,6 +1820,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1800 | cameraAtOffset = part.GetCameraAtOffset(); | 1820 | cameraAtOffset = part.GetCameraAtOffset(); |
1801 | cameraEyeOffset = part.GetCameraEyeOffset(); | 1821 | cameraEyeOffset = part.GetCameraEyeOffset(); |
1802 | forceMouselook = part.GetForceMouselook(); | 1822 | forceMouselook = part.GetForceMouselook(); |
1823 | if(cameraAtOffset == Vector3.Zero) cameraAtOffset = new Vector3(0f, 0f, 0.1f); // | ||
1824 | if(cameraEyeOffset == Vector3.Zero) cameraEyeOffset = new Vector3(0f, 0f, 0.1f); // | ||
1803 | 1825 | ||
1804 | if (m_physicsActor != null) | 1826 | if (m_physicsActor != null) |
1805 | { | 1827 | { |
@@ -1823,7 +1845,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
1823 | } | 1845 | } |
1824 | else return; // physactor is null! | 1846 | else return; // physactor is null! |
1825 | 1847 | ||
1826 | Vector3 offsetr = offset * partIRot; | 1848 | Vector3 offsetr; // = offset * partIRot; |
1849 | // KF: In a linkset, offsetr needs to be relative to the group root! 091208 | ||
1850 | // offsetr = (part.OffsetPosition * Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset)) + (offset * partIRot); | ||
1851 | if (part.LinkNum < 2) | ||
1852 | { // Single, or Root prim of linkset, target is ClickOffset * RootRot | ||
1853 | offsetr = offset * partIRot; | ||
1854 | } | ||
1855 | else | ||
1856 | { // Child prim, offset is (ChildOffset * RootRot) + (ClickOffset * ChildRot) | ||
1857 | offsetr = //(part.OffsetPosition * Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset)) + | ||
1858 | (offset * partRot); | ||
1859 | } | ||
1860 | |||
1861 | Console.WriteLine(" "); | ||
1862 | Console.WriteLine("link number ={0}", part.LinkNum); | ||
1863 | Console.WriteLine("Prim offset ={0}", part.OffsetPosition ); | ||
1864 | Console.WriteLine("Root Rotate ={0}", part.ParentGroup.RootPart.RotationOffset); | ||
1865 | Console.WriteLine("Click offst ={0}", offset); | ||
1866 | Console.WriteLine("Prim Rotate ={0}", part.GetWorldRotation()); | ||
1867 | Console.WriteLine("offsetr ={0}", offsetr); | ||
1868 | Console.WriteLine("Camera At ={0}", cameraAtOffset); | ||
1869 | Console.WriteLine("Camera Eye ={0}", cameraEyeOffset); | ||
1870 | |||
1827 | ControllingClient.SendSitResponse(part.UUID, offsetr, sitOrientation, autopilot, cameraAtOffset, cameraEyeOffset, forceMouselook); | 1871 | ControllingClient.SendSitResponse(part.UUID, offsetr, sitOrientation, autopilot, cameraAtOffset, cameraEyeOffset, forceMouselook); |
1828 | m_requestedSitTargetUUID = part.UUID; //KF: Correct autopilot target | 1872 | m_requestedSitTargetUUID = part.UUID; //KF: Correct autopilot target |
1829 | // This calls HandleAgentSit twice, once from here, and the client calls | 1873 | // This calls HandleAgentSit twice, once from here, and the client calls |
@@ -2142,13 +2186,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
2142 | } | 2186 | } |
2143 | else | 2187 | else |
2144 | { | 2188 | { |
2145 | //Console.WriteLine("NON Scripted Sit"); | ||
2146 | // if m_avUnscriptedSitPos is zero then Av sits above center | 2189 | // if m_avUnscriptedSitPos is zero then Av sits above center |
2147 | // Else Av sits at m_avUnscriptedSitPos | 2190 | // Else Av sits at m_avUnscriptedSitPos |
2148 | 2191 | ||
2149 | // Non-scripted sit by Kitto Flora 21Nov09 | 2192 | // Non-scripted sit by Kitto Flora 21Nov09 |
2150 | // Calculate angle of line from prim to Av | 2193 | // Calculate angle of line from prim to Av |
2151 | Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation()); | 2194 | Quaternion partIRot; |
2195 | if (part.LinkNum == 1) | ||
2196 | { // Root prim of linkset | ||
2197 | partIRot = Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset); | ||
2198 | } | ||
2199 | else | ||
2200 | { // single or child prim | ||
2201 | partIRot = Quaternion.Inverse(part.GetWorldRotation()); | ||
2202 | } | ||
2152 | Vector3 sitTargetPos= part.AbsolutePosition + m_avUnscriptedSitPos; | 2203 | Vector3 sitTargetPos= part.AbsolutePosition + m_avUnscriptedSitPos; |
2153 | float y_diff = (m_avInitialPos.Y - sitTargetPos.Y); | 2204 | float y_diff = (m_avInitialPos.Y - sitTargetPos.Y); |
2154 | float x_diff = ( m_avInitialPos.X - sitTargetPos.X); | 2205 | float x_diff = ( m_avInitialPos.X - sitTargetPos.X); |
@@ -2203,11 +2254,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
2203 | // collisionPoint = spot on prim where we want to sit | 2254 | // collisionPoint = spot on prim where we want to sit |
2204 | // collisionPoint.Z = global sit surface height | 2255 | // collisionPoint.Z = global sit surface height |
2205 | SceneObjectPart part = m_scene.GetSceneObjectPart(localid); | 2256 | SceneObjectPart part = m_scene.GetSceneObjectPart(localid); |
2206 | Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation()); | 2257 | Quaternion partIRot; |
2258 | if (part.LinkNum == 1) | ||
2259 | { // Root prim of linkset | ||
2260 | partIRot = Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset); | ||
2261 | } | ||
2262 | else | ||
2263 | { // single or child prim | ||
2264 | partIRot = Quaternion.Inverse(part.GetWorldRotation()); | ||
2265 | } | ||
2207 | float offZ = collisionPoint.Z - m_initialSitTarget.Z; | 2266 | float offZ = collisionPoint.Z - m_initialSitTarget.Z; |
2208 | Vector3 offset = new Vector3(0.0f, 0.0f, offZ) * partIRot; // Altitude correction | 2267 | Vector3 offset = new Vector3(0.0f, 0.0f, offZ) * partIRot; // Altitude correction |
2209 | //Console.WriteLine("sitPoint={0}, offset={1}", sitPoint, offset); | 2268 | //Console.WriteLine("sitPoint={0}, offset={1}", sitPoint, offset); |
2210 | m_pos += offset; | 2269 | m_pos += offset; |
2270 | ControllingClient.SendClearFollowCamProperties(part.UUID); | ||
2271 | |||
2211 | } | 2272 | } |
2212 | } // End SitAltitudeCallback KF. | 2273 | } // End SitAltitudeCallback KF. |
2213 | 2274 | ||