aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2012-07-16 22:30:54 +0100
committerUbitUmarov2012-07-16 22:30:54 +0100
commit40c6aef2e577c695b2851686d0e76652b9ea15f6 (patch)
treebc38561bfcb72ffd8260c28e06f31dcf9fbefae3 /OpenSim
parent ** TEST ** put back corrected SetPrimParams for avatars, referenced to (diff)
parentAllow setting linked avatar positions from within a prim not the one sat on (diff)
downloadopensim-SC-40c6aef2e577c695b2851686d0e76652b9ea15f6.zip
opensim-SC-40c6aef2e577c695b2851686d0e76652b9ea15f6.tar.gz
opensim-SC-40c6aef2e577c695b2851686d0e76652b9ea15f6.tar.bz2
opensim-SC-40c6aef2e577c695b2851686d0e76652b9ea15f6.tar.xz
Merge branch 'avination' into ubitwork
Conflicts: OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs85
1 files changed, 35 insertions, 50 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 5cbcfec..595dd8a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2470,8 +2470,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2470 2470
2471 public LSL_Rotation llGetLocalRot() 2471 public LSL_Rotation llGetLocalRot()
2472 { 2472 {
2473 return GetPartLocalRot(m_host);
2474 }
2475
2476 private LSL_Rotation GetPartLocalRot(SceneObjectPart part)
2477 {
2473 m_host.AddScriptLPS(1); 2478 m_host.AddScriptLPS(1);
2474 Quaternion rot = m_host.RotationOffset; 2479 Quaternion rot = part.RotationOffset;
2475 return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W); 2480 return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W);
2476 } 2481 }
2477 2482
@@ -8000,7 +8005,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8000 //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. 8005 //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset.
8001 8006
8002 int idx = 0; 8007 int idx = 0;
8003 SceneObjectPart sitpart = World.GetSceneObjectPart(av.ParentID); // betting this will be used
8004 8008
8005 bool positionChanged = false; 8009 bool positionChanged = false;
8006 Vector3 finalPos = Vector3.Zero; 8010 Vector3 finalPos = Vector3.Zero;
@@ -8015,81 +8019,62 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8015 8019
8016 switch (code) 8020 switch (code)
8017 { 8021 {
8018 // a avatar is a child
8019 case (int)ScriptBaseClass.PRIM_POSITION: 8022 case (int)ScriptBaseClass.PRIM_POSITION:
8020 case (int)ScriptBaseClass.PRIM_POS_LOCAL: 8023 case (int)ScriptBaseClass.PRIM_POS_LOCAL:
8021 { 8024 {
8022 if (remain < 1) 8025 if (remain < 1)
8023 return; 8026 return;
8027
8024 LSL_Vector v; 8028 LSL_Vector v;
8025 v = rules.GetVector3Item(idx++); 8029 v = rules.GetVector3Item(idx++);
8026 8030
8027 if (sitpart == null) 8031 SceneObjectPart part = World.GetSceneObjectPart(av.ParentID);
8032 if (part == null)
8028 break; 8033 break;
8029 8034
8030 Vector3 pos = new Vector3((float)v.x, (float)v.y, (float)v.z); // requested absolute position 8035 LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION;
8031 8036 LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR;
8032 if (sitpart != sitpart.ParentGroup.RootPart) 8037 if (part.LinkNum > 1)
8033 { 8038 {
8034 pos -= sitpart.OffsetPosition; // remove sit part offset 8039 localRot = GetPartLocalRot(part);
8035 Quaternion rot = sitpart.RotationOffset; 8040 localPos = GetPartLocalPos(part);
8036 pos *= Quaternion.Conjugate(rot); // removed sit part rotation
8037 } 8041 }
8038 Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f * 2.0f);
8039 pos += sitOffset;
8040 8042
8041 finalPos = pos; 8043 v -= localPos;
8042 positionChanged = true; 8044 v /= localRot;
8043 }
8044 break;
8045 8045
8046 case (int)ScriptBaseClass.PRIM_ROTATION: 8046 LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f);
8047 {
8048 if (remain < 1)
8049 return;
8050 8047
8051 if (sitpart == null) 8048 v = v + 2 * sitOffset;
8052 break;
8053 8049
8054 LSL_Rotation r = rules.GetQuaternionItem(idx++); 8050 av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z);
8055 Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested world rotation 8051 av.SendAvatarDataToAllAgents();
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 }
8067 8052
8068 av.Rotation = rot;
8069 // av.SendAvatarDataToAllAgents();
8070 av.SendTerseUpdateToAllClients();
8071 }
8072 } 8053 }
8073 break; 8054 break;
8074 8055
8075 case (int)ScriptBaseClass.PRIM_ROT_LOCAL: 8056 case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
8057 case (int)ScriptBaseClass.PRIM_ROTATION:
8076 { 8058 {
8077 if (remain < 1) 8059 if (remain < 1)
8078 return; 8060 return;
8079 8061
8080 if (sitpart == null) 8062 LSL_Rotation r;
8063 r = rules.GetQuaternionItem(idx++);
8064
8065 SceneObjectPart part = World.GetSceneObjectPart(av.ParentID);
8066 if (part == null)
8081 break; 8067 break;
8082 8068
8083 LSL_Rotation r = rules.GetQuaternionItem(idx++); 8069 LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION;
8084 Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested offset rotation 8070 LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR;
8085 if (sitpart != sitpart.ParentGroup.RootPart) 8071
8086 { 8072 if (part.LinkNum > 1)
8087 Quaternion srot = sitpart.RotationOffset; 8073 localRot = GetPartLocalRot(part);
8088 rot = Quaternion.Conjugate(srot) * rot; // remove sit part offset rotation 8074
8089 } 8075 r = r * llGetRootRotation() / localRot;
8090 av.Rotation = rot; 8076 av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s);
8091// av.SendAvatarDataToAllAgents(); 8077 av.SendAvatarDataToAllAgents();
8092 av.SendTerseUpdateToAllClients();
8093 } 8078 }
8094 break; 8079 break;
8095 8080