From 4e97237460028281871d989a1fb833706366301c Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 13 Jul 2012 00:01:01 +0200 Subject: Revert " lltargetomega efective spinrate now multiplied by gain ( need check )" Undo figuring gain into spinrate in llTargetOmega. In SL, gain has null effect on nonphysical spinning objects. This reverts commit df55de5b3d88e241f35217d5c08d02b921991513. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ca62bac..d2dab6f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3822,7 +3822,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected void TargetOmega(SceneObjectPart part, LSL_Vector axis, double spinrate, double gain) { - spinrate *= gain; part.UpdateAngularVelocity(new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate))); } -- cgit v1.1 From 47f7cc9457bfc5c909290ac189b34dd3eceebe7f Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 20:41:10 +0200 Subject: Fix a sit rotation issue --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d2dab6f..952d5da 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8062,7 +8062,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } Quaternion srot = sitpart.RotationOffset; - rot = Quaternion.Conjugate(srot) * rot; // removed sit part offset rotation + rot = srot * rot; // removed sit part offset rotation av.Rotation = rot; // av.SendAvatarDataToAllAgents(); av.SendTerseUpdateToAllClients(); -- cgit v1.1 From ec40c545091c8df70eea0e79e2878b69c0a649d9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 20:48:32 +0200 Subject: Revert "Fix a sit rotation issue" This reverts commit 47f7cc9457bfc5c909290ac189b34dd3eceebe7f. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 952d5da..d2dab6f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8062,7 +8062,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } Quaternion srot = sitpart.RotationOffset; - rot = srot * rot; // removed sit part offset rotation + rot = Quaternion.Conjugate(srot) * rot; // removed sit part offset rotation av.Rotation = rot; // av.SendAvatarDataToAllAgents(); av.SendTerseUpdateToAllClients(); -- cgit v1.1 From a2d19b97030e2249372e8635b67276ff676460aa Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 20:48:47 +0200 Subject: Replace sit position and rotation code with older, working version --- .../Shared/Api/Implementation/LSL_Api.cs | 54 +++++++++++----------- 1 file changed, 28 insertions(+), 26 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') 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 switch (code) { - // a avatar is a child case (int)ScriptBaseClass.PRIM_POSITION: case (int)ScriptBaseClass.PRIM_POS_LOCAL: { if (remain < 1) return; + LSL_Vector v; v = rules.GetVector3Item(idx++); - if (sitpart == null) + SceneObjectPart part = World.GetSceneObjectPart(av.ParentID); + if (part == null) break; - Vector3 pos = new Vector3((float)v.x, (float)v.y, (float)v.z); // requested absolute position - - if (sitpart != sitpart.ParentGroup.RootPart) + LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; + LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; + if (llGetLinkNumber() > 1) { - pos -= sitpart.OffsetPosition; // remove sit part offset - Quaternion rot = sitpart.RotationOffset; - pos *= Quaternion.Conjugate(rot); // removed sit part rotation + localRot = llGetLocalRot(); + localPos = llGetLocalPos(); } - Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f * 2.0f); - pos += sitOffset; - finalPos = pos; - positionChanged = true; + v -= localPos; + v /= localRot; + + LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f); + + v = v + 2 * sitOffset; + + av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z); + av.SendAvatarDataToAllAgents(); + } break; @@ -8048,24 +8054,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 1) return; - if (sitpart == null) - break; - - LSL_Rotation r = rules.GetQuaternionItem(idx++); - Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested world rotation + LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; + LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; -// need to replicate SL bug - SceneObjectGroup sitgrp = sitpart.ParentGroup; - if (sitgrp != null && sitgrp.RootPart != sitpart) + if (llGetLinkNumber() > 1) { - rot = sitgrp.RootPart.RotationOffset * rot; + localRot = llGetLocalRot(); + localPos = llGetLocalPos(); } - Quaternion srot = sitpart.RotationOffset; - rot = Quaternion.Conjugate(srot) * rot; // removed sit part offset rotation - av.Rotation = rot; -// av.SendAvatarDataToAllAgents(); - av.SendTerseUpdateToAllClients(); + LSL_Rotation r; + r = rules.GetQuaternionItem(idx++); + r = r * llGetRootRotation() / localRot; + av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); + av.SendAvatarDataToAllAgents(); } break; -- cgit v1.1 From 8baf4dcc786b91a427e60dca9f0d0eeb05ddae19 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 20:55:54 +0200 Subject: Reinstate older set rotation code for avatars since it works in all cases --- .../Shared/Api/Implementation/LSL_Api.cs | 23 +--------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b20ca6d..5bade25 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8000,7 +8000,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. int idx = 0; - SceneObjectPart sitpart = World.GetSceneObjectPart(av.ParentID); // betting this will be used bool positionChanged = false; Vector3 finalPos = Vector3.Zero; @@ -8049,6 +8048,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } break; + case (int)ScriptBaseClass.PRIM_ROT_LOCAL: case (int)ScriptBaseClass.PRIM_ROTATION: { if (remain < 1) @@ -8071,27 +8071,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } break; - case (int)ScriptBaseClass.PRIM_ROT_LOCAL: - { - if (remain < 1) - return; - - if (sitpart == null) - break; - - LSL_Rotation r = rules.GetQuaternionItem(idx++); - Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested offset rotation - if (sitpart != sitpart.ParentGroup.RootPart) - { - Quaternion srot = sitpart.RotationOffset; - rot = Quaternion.Conjugate(srot) * rot; // remove sit part offset rotation - } - av.Rotation = rot; -// av.SendAvatarDataToAllAgents(); - av.SendTerseUpdateToAllClients(); - } - break; - // parse rest doing nothing but number of parameters error check case (int)ScriptBaseClass.PRIM_SIZE: case (int)ScriptBaseClass.PRIM_MATERIAL: -- cgit v1.1 From 12049e1120559a36ea5fd0453a36210808d04363 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 16 Jul 2012 11:03:12 +0200 Subject: Allow setting linked avatar positions from within a prim not the one sat on --- .../Shared/Api/Implementation/LSL_Api.cs | 29 ++++++++++++++-------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5bade25..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 public LSL_Rotation llGetLocalRot() { + return GetPartLocalRot(m_host); + } + + private LSL_Rotation GetPartLocalRot(SceneObjectPart part) + { m_host.AddScriptLPS(1); - Quaternion rot = m_host.RotationOffset; + Quaternion rot = part.RotationOffset; return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W); } @@ -8029,10 +8034,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; - if (llGetLinkNumber() > 1) + if (part.LinkNum > 1) { - localRot = llGetLocalRot(); - localPos = llGetLocalPos(); + localRot = GetPartLocalRot(part); + localPos = GetPartLocalPos(part); } v -= localPos; @@ -8054,17 +8059,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 1) return; + LSL_Rotation r; + r = rules.GetQuaternionItem(idx++); + + SceneObjectPart part = World.GetSceneObjectPart(av.ParentID); + if (part == null) + break; + LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; - if (llGetLinkNumber() > 1) - { - localRot = llGetLocalRot(); - localPos = llGetLocalPos(); - } + if (part.LinkNum > 1) + localRot = GetPartLocalRot(part); - LSL_Rotation r; - r = rules.GetQuaternionItem(idx++); r = r * llGetRootRotation() / localRot; av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); av.SendAvatarDataToAllAgents(); -- cgit v1.1