aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorUbitUmarov2012-07-16 01:47:50 +0100
committerUbitUmarov2012-07-16 01:47:50 +0100
commitcbaf59e086113621c47e1c069344f1f3723f44d4 (patch)
tree65622c43f59501c95c734a1f84ca150004a2ff21 /OpenSim/Region
parentbackkick git (diff)
downloadopensim-SC-cbaf59e086113621c47e1c069344f1f3723f44d4.zip
opensim-SC-cbaf59e086113621c47e1c069344f1f3723f44d4.tar.gz
opensim-SC-cbaf59e086113621c47e1c069344f1f3723f44d4.tar.bz2
opensim-SC-cbaf59e086113621c47e1c069344f1f3723f44d4.tar.xz
** TEST ** put back corrected SetPrimParams for avatars, referenced to
sitpart and not m_host.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs74
1 files changed, 48 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 5bade25..5cbcfec 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -8000,6 +8000,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8000 //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. 8000 //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset.
8001 8001
8002 int idx = 0; 8002 int idx = 0;
8003 SceneObjectPart sitpart = World.GetSceneObjectPart(av.ParentID); // betting this will be used
8003 8004
8004 bool positionChanged = false; 8005 bool positionChanged = false;
8005 Vector3 finalPos = Vector3.Zero; 8006 Vector3 finalPos = Vector3.Zero;
@@ -8014,60 +8015,81 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8014 8015
8015 switch (code) 8016 switch (code)
8016 { 8017 {
8018 // a avatar is a child
8017 case (int)ScriptBaseClass.PRIM_POSITION: 8019 case (int)ScriptBaseClass.PRIM_POSITION:
8018 case (int)ScriptBaseClass.PRIM_POS_LOCAL: 8020 case (int)ScriptBaseClass.PRIM_POS_LOCAL:
8019 { 8021 {
8020 if (remain < 1) 8022 if (remain < 1)
8021 return; 8023 return;
8022
8023 LSL_Vector v; 8024 LSL_Vector v;
8024 v = rules.GetVector3Item(idx++); 8025 v = rules.GetVector3Item(idx++);
8025 8026
8026 SceneObjectPart part = World.GetSceneObjectPart(av.ParentID); 8027 if (sitpart == null)
8027 if (part == null)
8028 break; 8028 break;
8029 8029
8030 LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; 8030 Vector3 pos = new Vector3((float)v.x, (float)v.y, (float)v.z); // requested absolute position
8031 LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; 8031
8032 if (llGetLinkNumber() > 1) 8032 if (sitpart != sitpart.ParentGroup.RootPart)
8033 { 8033 {
8034 localRot = llGetLocalRot(); 8034 pos -= sitpart.OffsetPosition; // remove sit part offset
8035 localPos = llGetLocalPos(); 8035 Quaternion rot = sitpart.RotationOffset;
8036 pos *= Quaternion.Conjugate(rot); // removed sit part rotation
8036 } 8037 }
8038 Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f * 2.0f);
8039 pos += sitOffset;
8037 8040
8038 v -= localPos; 8041 finalPos = pos;
8039 v /= localRot; 8042 positionChanged = true;
8043 }
8044 break;
8040 8045
8041 LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f); 8046 case (int)ScriptBaseClass.PRIM_ROTATION:
8047 {
8048 if (remain < 1)
8049 return;
8042 8050
8043 v = v + 2 * sitOffset; 8051 if (sitpart == null)
8052 break;
8044 8053
8045 av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z); 8054 LSL_Rotation r = rules.GetQuaternionItem(idx++);
8046 av.SendAvatarDataToAllAgents(); 8055 Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested world rotation
8056
8057 SceneObjectGroup sitgrp = sitpart.ParentGroup;
8058 if (sitgrp != null)
8059 {
8060 // need to replicate SL bug
8061 rot = sitgrp.RootPart.RotationOffset * rot;
8062 if (sitgrp.RootPart != sitpart)
8063 {
8064 Quaternion srot = sitpart.RotationOffset;
8065 rot = Quaternion.Conjugate(srot) * rot; // removed sit part offset rotation
8066 }
8047 8067
8068 av.Rotation = rot;
8069 // av.SendAvatarDataToAllAgents();
8070 av.SendTerseUpdateToAllClients();
8071 }
8048 } 8072 }
8049 break; 8073 break;
8050 8074
8051 case (int)ScriptBaseClass.PRIM_ROT_LOCAL: 8075 case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
8052 case (int)ScriptBaseClass.PRIM_ROTATION:
8053 { 8076 {
8054 if (remain < 1) 8077 if (remain < 1)
8055 return; 8078 return;
8056 8079
8057 LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; 8080 if (sitpart == null)
8058 LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; 8081 break;
8059 8082
8060 if (llGetLinkNumber() > 1) 8083 LSL_Rotation r = rules.GetQuaternionItem(idx++);
8084 Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested offset rotation
8085 if (sitpart != sitpart.ParentGroup.RootPart)
8061 { 8086 {
8062 localRot = llGetLocalRot(); 8087 Quaternion srot = sitpart.RotationOffset;
8063 localPos = llGetLocalPos(); 8088 rot = Quaternion.Conjugate(srot) * rot; // remove sit part offset rotation
8064 } 8089 }
8065 8090 av.Rotation = rot;
8066 LSL_Rotation r; 8091// av.SendAvatarDataToAllAgents();
8067 r = rules.GetQuaternionItem(idx++); 8092 av.SendTerseUpdateToAllClients();
8068 r = r * llGetRootRotation() / localRot;
8069 av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s);
8070 av.SendAvatarDataToAllAgents();
8071 } 8093 }
8072 break; 8094 break;
8073 8095