diff options
Fix scripted sit offset in child prims
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index efe3365..1fc4a81 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1935,8 +1935,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1935 | //Console.WriteLine("Scripted, unoccupied"); | 1935 | //Console.WriteLine("Scripted, unoccupied"); |
1936 | part.SetAvatarOnSitTarget(UUID); // set that Av will be on it | 1936 | part.SetAvatarOnSitTarget(UUID); // set that Av will be on it |
1937 | offset = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z); // change ofset to the scripted one | 1937 | offset = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z); // change ofset to the scripted one |
1938 | sitOrientation = avSitOrientation; // Change rotatione to the scripted one | 1938 | |
1939 | OffsetRotation = avSitOrientation; | 1939 | Quaternion nrot = avSitOrientation; |
1940 | if (!part.IsRoot) | ||
1941 | { | ||
1942 | nrot = nrot * part.RotationOffset; | ||
1943 | } | ||
1944 | sitOrientation = nrot; // Change rotatione to the scripted one | ||
1945 | OffsetRotation = nrot; | ||
1940 | autopilot = false; // Jump direct to scripted llSitPos() | 1946 | autopilot = false; // Jump direct to scripted llSitPos() |
1941 | } | 1947 | } |
1942 | else | 1948 | else |
@@ -2010,7 +2016,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2010 | // offsetr = (part.OffsetPosition * Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset)) + (offset * partIRot); | 2016 | // offsetr = (part.OffsetPosition * Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset)) + (offset * partIRot); |
2011 | // if (part.LinkNum < 2) 091216 All this was necessary because of the GetWorldRotation error. | 2017 | // if (part.LinkNum < 2) 091216 All this was necessary because of the GetWorldRotation error. |
2012 | // { // Single, or Root prim of linkset, target is ClickOffset * RootRot | 2018 | // { // Single, or Root prim of linkset, target is ClickOffset * RootRot |
2013 | offsetr = offset * partIRot; | 2019 | //offsetr = offset * partIRot; |
2014 | // | 2020 | // |
2015 | // else | 2021 | // else |
2016 | // { // Child prim, offset is (ChildOffset * RootRot) + (ClickOffset * ChildRot) | 2022 | // { // Child prim, offset is (ChildOffset * RootRot) + (ClickOffset * ChildRot) |
@@ -2029,7 +2035,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2029 | //Console.WriteLine("Camera Eye ={0}", cameraEyeOffset); | 2035 | //Console.WriteLine("Camera Eye ={0}", cameraEyeOffset); |
2030 | 2036 | ||
2031 | //NOTE: SendSitResponse should be relative to the GROUP *NOT* THE PRIM if we're sitting on a child | 2037 | //NOTE: SendSitResponse should be relative to the GROUP *NOT* THE PRIM if we're sitting on a child |
2032 | ControllingClient.SendSitResponse(part.ParentGroup.UUID, offsetr + part.OffsetPosition, sitOrientation, autopilot, cameraAtOffset, cameraEyeOffset, forceMouselook); | 2038 | ControllingClient.SendSitResponse(part.ParentGroup.UUID, ((offset * part.RotationOffset) + part.OffsetPosition), sitOrientation, autopilot, cameraAtOffset, cameraEyeOffset, forceMouselook); |
2033 | 2039 | ||
2034 | m_requestedSitTargetUUID = part.UUID; //KF: Correct autopilot target | 2040 | m_requestedSitTargetUUID = part.UUID; //KF: Correct autopilot target |
2035 | // This calls HandleAgentSit twice, once from here, and the client calls | 2041 | // This calls HandleAgentSit twice, once from here, and the client calls |
@@ -2343,6 +2349,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2343 | Quaternion sitTargetOrient = part.SitTargetOrientation; | 2349 | Quaternion sitTargetOrient = part.SitTargetOrientation; |
2344 | m_pos = new Vector3(sitTargetPos.X, sitTargetPos.Y, sitTargetPos.Z); | 2350 | m_pos = new Vector3(sitTargetPos.X, sitTargetPos.Y, sitTargetPos.Z); |
2345 | m_pos += SIT_TARGET_ADJUSTMENT; | 2351 | m_pos += SIT_TARGET_ADJUSTMENT; |
2352 | if (!part.IsRoot) | ||
2353 | { | ||
2354 | m_pos *= part.RotationOffset; | ||
2355 | } | ||
2346 | m_bodyRot = sitTargetOrient; | 2356 | m_bodyRot = sitTargetOrient; |
2347 | m_parentPosition = part.AbsolutePosition; | 2357 | m_parentPosition = part.AbsolutePosition; |
2348 | part.IsOccupied = true; | 2358 | part.IsOccupied = true; |