aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs54
1 files changed, 28 insertions, 26 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index d2dab6f..b20ca6d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -8015,31 +8015,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8015 8015
8016 switch (code) 8016 switch (code)
8017 { 8017 {
8018 // a avatar is a child
8019 case (int)ScriptBaseClass.PRIM_POSITION: 8018 case (int)ScriptBaseClass.PRIM_POSITION:
8020 case (int)ScriptBaseClass.PRIM_POS_LOCAL: 8019 case (int)ScriptBaseClass.PRIM_POS_LOCAL:
8021 { 8020 {
8022 if (remain < 1) 8021 if (remain < 1)
8023 return; 8022 return;
8023
8024 LSL_Vector v; 8024 LSL_Vector v;
8025 v = rules.GetVector3Item(idx++); 8025 v = rules.GetVector3Item(idx++);
8026 8026
8027 if (sitpart == null) 8027 SceneObjectPart part = World.GetSceneObjectPart(av.ParentID);
8028 if (part == null)
8028 break; 8029 break;
8029 8030
8030 Vector3 pos = new Vector3((float)v.x, (float)v.y, (float)v.z); // requested absolute position 8031 LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION;
8031 8032 LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR;
8032 if (sitpart != sitpart.ParentGroup.RootPart) 8033 if (llGetLinkNumber() > 1)
8033 { 8034 {
8034 pos -= sitpart.OffsetPosition; // remove sit part offset 8035 localRot = llGetLocalRot();
8035 Quaternion rot = sitpart.RotationOffset; 8036 localPos = llGetLocalPos();
8036 pos *= Quaternion.Conjugate(rot); // removed sit part rotation
8037 } 8037 }
8038 Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f * 2.0f);
8039 pos += sitOffset;
8040 8038
8041 finalPos = pos; 8039 v -= localPos;
8042 positionChanged = true; 8040 v /= localRot;
8041
8042 LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f);
8043
8044 v = v + 2 * sitOffset;
8045
8046 av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z);
8047 av.SendAvatarDataToAllAgents();
8048
8043 } 8049 }
8044 break; 8050 break;
8045 8051
@@ -8048,24 +8054,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8048 if (remain < 1) 8054 if (remain < 1)
8049 return; 8055 return;
8050 8056
8051 if (sitpart == null) 8057 LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION;
8052 break; 8058 LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR;
8053
8054 LSL_Rotation r = rules.GetQuaternionItem(idx++);
8055 Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested world rotation
8056 8059
8057// need to replicate SL bug 8060 if (llGetLinkNumber() > 1)
8058 SceneObjectGroup sitgrp = sitpart.ParentGroup;
8059 if (sitgrp != null && sitgrp.RootPart != sitpart)
8060 { 8061 {
8061 rot = sitgrp.RootPart.RotationOffset * rot; 8062 localRot = llGetLocalRot();
8063 localPos = llGetLocalPos();
8062 } 8064 }
8063 8065
8064 Quaternion srot = sitpart.RotationOffset; 8066 LSL_Rotation r;
8065 rot = Quaternion.Conjugate(srot) * rot; // removed sit part offset rotation 8067 r = rules.GetQuaternionItem(idx++);
8066 av.Rotation = rot; 8068 r = r * llGetRootRotation() / localRot;
8067// av.SendAvatarDataToAllAgents(); 8069 av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s);
8068 av.SendTerseUpdateToAllClients(); 8070 av.SendAvatarDataToAllAgents();
8069 } 8071 }
8070 break; 8072 break;
8071 8073