diff options
author | Melanie | 2012-02-22 20:40:44 +0100 |
---|---|---|
committer | Melanie | 2012-02-22 20:40:44 +0100 |
commit | 1e1270166f6d574916ada7b2bd5923115bd07052 (patch) | |
tree | edd8ba7a8ed5629675943e5295a38d08078e95c8 /OpenSim/Region/Framework | |
parent | Merge branch 'master' into careminster (diff) | |
download | opensim-SC_OLD-1e1270166f6d574916ada7b2bd5923115bd07052.zip opensim-SC_OLD-1e1270166f6d574916ada7b2bd5923115bd07052.tar.gz opensim-SC_OLD-1e1270166f6d574916ada7b2bd5923115bd07052.tar.bz2 opensim-SC_OLD-1e1270166f6d574916ada7b2bd5923115bd07052.tar.xz |
Adjust sit target and the llSetLinkPrimitiveParams sit position hack
to match SL.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 283de39..ec8716b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -91,7 +91,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
91 | /// rotation, prim cut, prim twist, prim taper, and prim shear. See mantis | 91 | /// rotation, prim cut, prim twist, prim taper, and prim shear. See mantis |
92 | /// issue #1716 | 92 | /// issue #1716 |
93 | /// </summary> | 93 | /// </summary> |
94 | public static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.0f, 0.0f, 0.418f); | 94 | public static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.0f, 0.0f, 0.4f); |
95 | 95 | ||
96 | /// <summary> | 96 | /// <summary> |
97 | /// Movement updates for agents in neighboring regions are sent directly to clients. | 97 | /// Movement updates for agents in neighboring regions are sent directly to clients. |
@@ -2301,7 +2301,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2301 | 2301 | ||
2302 | //Quaternion result = (sitTargetOrient * vq) * nq; | 2302 | //Quaternion result = (sitTargetOrient * vq) * nq; |
2303 | 2303 | ||
2304 | m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT; | 2304 | double x, y, z, m; |
2305 | |||
2306 | Quaternion r = sitTargetOrient; | ||
2307 | m = r.X * r.X + r.Y * r.Y + r.Z * r.Z + r.W * r.W; | ||
2308 | |||
2309 | if (Math.Abs(1.0 - m) > 0.000001) | ||
2310 | { | ||
2311 | m = 1.0 / Math.Sqrt(m); | ||
2312 | r.X *= (float)m; | ||
2313 | r.Y *= (float)m; | ||
2314 | r.Z *= (float)m; | ||
2315 | r.W *= (float)m; | ||
2316 | } | ||
2317 | |||
2318 | x = 2 * (r.X * r.Z + r.Y * r.W); | ||
2319 | y = 2 * (-r.X * r.W + r.Y * r.Z); | ||
2320 | z = -r.X * r.X - r.Y * r.Y + r.Z * r.Z + r.W * r.W; | ||
2321 | |||
2322 | Vector3 up = new Vector3((float)x, (float)y, (float)z); | ||
2323 | Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f; | ||
2324 | m_pos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT; | ||
2305 | Rotation = sitTargetOrient; | 2325 | Rotation = sitTargetOrient; |
2306 | ParentPosition = part.AbsolutePosition; | 2326 | ParentPosition = part.AbsolutePosition; |
2307 | part.ParentGroup.AddAvatar(UUID); | 2327 | part.ParentGroup.AddAvatar(UUID); |