diff options
author | teravus | 2013-01-01 23:07:37 -0500 |
---|---|---|
committer | teravus | 2013-01-01 23:07:37 -0500 |
commit | 397aa74777bc0c54ecd9e1b286e59e9de0a4f3c2 (patch) | |
tree | a850e58399b6f95afb93aebbe16e34eff78477e3 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation | |
parent | Merge remote-tracking branch 'remotes/origin/avination' into teravuswork (diff) | |
download | opensim-SC-397aa74777bc0c54ecd9e1b286e59e9de0a4f3c2.zip opensim-SC-397aa74777bc0c54ecd9e1b286e59e9de0a4f3c2.tar.gz opensim-SC-397aa74777bc0c54ecd9e1b286e59e9de0a4f3c2.tar.bz2 opensim-SC-397aa74777bc0c54ecd9e1b286e59e9de0a4f3c2.tar.xz |
* Fixes the attachment scripted rotation bug. The problem is the code was relying on m_host.ParentId = 0 to determine if the attachment should be rotated against root prim offset. To fix it for attachments, we also need to check if the host's localID == RootPart's localID. otherwise we are cumulatively rotating against the host's root part rotation offset (which in this case, is it's own rotation)
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7ff30ca..a559683 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2353,8 +2353,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2353 | { | 2353 | { |
2354 | m_host.AddScriptLPS(1); | 2354 | m_host.AddScriptLPS(1); |
2355 | 2355 | ||
2356 | |||
2357 | SceneObjectPart rootPart = m_host.ParentGroup.RootPart; | ||
2358 | |||
2359 | |||
2360 | // Teravus: if (m_host.ParentID == 0) is bug code because the ParentID for the Avatar will cause this to be nonzero for root prim attachments | ||
2361 | // which is then treated like a child prim rotation and it's offset gets cumulatively multiplied against. | ||
2362 | // to fix the scripted rotations we also have to check to see if the root part localid is the same as the host's localid. | ||
2363 | // RootPart != null should shortcircuit | ||
2364 | |||
2356 | // try to let this work as in SL... | 2365 | // try to let this work as in SL... |
2357 | if (m_host.ParentID == 0) | 2366 | if (m_host.ParentID == 0 ) //|| (rootPart != null && m_host.LocalId == rootPart.LocalId)) |
2358 | { | 2367 | { |
2359 | // special case: If we are root, rotate complete SOG to new rotation | 2368 | // special case: If we are root, rotate complete SOG to new rotation |
2360 | SetRot(m_host, rot); | 2369 | SetRot(m_host, rot); |
@@ -2362,7 +2371,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2362 | else | 2371 | else |
2363 | { | 2372 | { |
2364 | // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. | 2373 | // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. |
2365 | SceneObjectPart rootPart = m_host.ParentGroup.RootPart; | 2374 | |
2366 | if (rootPart != null) // better safe than sorry | 2375 | if (rootPart != null) // better safe than sorry |
2367 | { | 2376 | { |
2368 | SetRot(m_host, rootPart.RotationOffset * (Quaternion)rot); | 2377 | SetRot(m_host, rootPart.RotationOffset * (Quaternion)rot); |