aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
authorMelanie2012-02-22 20:40:44 +0100
committerMelanie2012-02-22 20:40:44 +0100
commit1e1270166f6d574916ada7b2bd5923115bd07052 (patch)
treeedd8ba7a8ed5629675943e5295a38d08078e95c8 /OpenSim/Region/ScriptEngine/Shared
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC-1e1270166f6d574916ada7b2bd5923115bd07052.zip
opensim-SC-1e1270166f6d574916ada7b2bd5923115bd07052.tar.gz
opensim-SC-1e1270166f6d574916ada7b2bd5923115bd07052.tar.bz2
opensim-SC-1e1270166f6d574916ada7b2bd5923115bd07052.tar.xz
Adjust sit target and the llSetLinkPrimitiveParams sit position hack
to match SL.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs60
1 files changed, 46 insertions, 14 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 2a23c59..84792c0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7542,27 +7542,59 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7542 7542
7543 int remain = rules.Length - idx; 7543 int remain = rules.Length - idx;
7544 7544
7545
7546
7547 switch (code) 7545 switch (code)
7548 { 7546 {
7549 case (int)ScriptBaseClass.PRIM_POSITION: 7547 case (int)ScriptBaseClass.PRIM_POSITION:
7550 if (remain < 1) 7548 {
7551 return; 7549 if (remain < 1)
7552 LSL_Vector v; 7550 return;
7553 v = rules.GetVector3Item(idx++); 7551 LSL_Vector v;
7554 av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z); 7552 v = rules.GetVector3Item(idx++);
7555 av.SendAvatarDataToAllAgents(); 7553
7554 SceneObjectPart part = World.GetSceneObjectPart(av.ParentID);
7555 if (part == null)
7556 break;
7557
7558 LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION;
7559 LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR;
7560 if (llGetLinkNumber() > 1)
7561 {
7562 localRot = llGetLocalRot();
7563 localPos = llGetLocalPos();
7564 }
7565
7566 v -= localPos;
7567 v /= localRot;
7556 7568
7569 LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f);
7570
7571 v = v + 2 * sitOffset;
7572
7573 av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z);
7574 av.SendAvatarDataToAllAgents();
7575
7576 }
7557 break; 7577 break;
7558 7578
7559 case (int)ScriptBaseClass.PRIM_ROTATION: 7579 case (int)ScriptBaseClass.PRIM_ROTATION:
7560 if (remain < 1) 7580 {
7561 return; 7581 if (remain < 1)
7562 LSL_Rotation r; 7582 return;
7563 r = rules.GetQuaternionItem(idx++); 7583
7564 av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); 7584 LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION;
7565 av.SendAvatarDataToAllAgents(); 7585 LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR;
7586 if (llGetLinkNumber() > 1)
7587 {
7588 localRot = llGetLocalRot();
7589 localPos = llGetLocalPos();
7590 }
7591
7592 LSL_Rotation r;
7593 r = rules.GetQuaternionItem(idx++);
7594 r = r * llGetRootRotation() / localRot;
7595 av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s);
7596 av.SendAvatarDataToAllAgents();
7597 }
7566 break; 7598 break;
7567 } 7599 }
7568 } 7600 }