diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index f638386071..4ea283f653 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1620,8 +1620,24 @@ namespace OpenSim.Region.Framework.Scenes { UUID assetID = UUID.Zero; + Vector3 inventoryStoredPosition = new Vector3 + (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) + ? 250 + : objectGroup.AbsolutePosition.X) + , + (objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) + ? 250 + : objectGroup.AbsolutePosition.X, + objectGroup.AbsolutePosition.Z); + + Vector3 originalPosition = objectGroup.AbsolutePosition; + + objectGroup.AbsolutePosition = inventoryStoredPosition; + string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); + objectGroup.AbsolutePosition = originalPosition; + // Get the user info of the item destination // UUID userID = UUID.Zero; @@ -1683,6 +1699,8 @@ namespace OpenSim.Region.Framework.Scenes { // Deleting someone else's item // + + if (remoteClient == null || objectGroup.OwnerID != remoteClient.AgentId) { @@ -1857,8 +1875,24 @@ namespace OpenSim.Region.Framework.Scenes itemID = UUID.Zero; if (grp != null) { + Vector3 inventoryStoredPosition = new Vector3 + (((grp.AbsolutePosition.X > (int)Constants.RegionSize) + ? 250 + : grp.AbsolutePosition.X) + , + (grp.AbsolutePosition.X > (int)Constants.RegionSize) + ? 250 + : grp.AbsolutePosition.X, + grp.AbsolutePosition.Z); + + Vector3 originalPosition = grp.AbsolutePosition; + + grp.AbsolutePosition = inventoryStoredPosition; + string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); - + + grp.AbsolutePosition = originalPosition; + AssetBase asset = CreateAsset( grp.GetPartName(grp.LocalId), grp.GetPartDescription(grp.LocalId), diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 3b91dd0b8f..d43a7e22e6 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4256,7 +4256,24 @@ namespace OpenSim.Region.Framework.Scenes break; case 2: // Sell a copy + + + Vector3 inventoryStoredPosition = new Vector3 + (((group.AbsolutePosition.X > (int)Constants.RegionSize) + ? 250 + : group.AbsolutePosition.X) + , + (group.AbsolutePosition.X > (int)Constants.RegionSize) + ? 250 + : group.AbsolutePosition.X, + group.AbsolutePosition.Z); + + Vector3 originalPosition = group.AbsolutePosition; + + group.AbsolutePosition = inventoryStoredPosition; + string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group); + group.AbsolutePosition = originalPosition; uint perms=group.GetEffectivePermissions(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 16dd8341c5..f261c16d32 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -476,9 +476,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // normalize an angle between -PI and PI (-180 to +180 degrees) protected double NormalizeAngle(double angle) { - angle = angle % (Math.PI * 2); - // if (angle < 0) angle = angle + Math.PI * 2; - return angle; + if (angle > -Math.PI && angle < Math.PI) + return angle; + + int numPis = (int)(Math.PI / angle); + double remainder = angle - Math.PI * numPis; + if (numPis % 2 == 1) + return Math.PI - angle; + return remainder; } // Old implementation of llRot2Euler, now normalized @@ -497,9 +502,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api NormalizeAngle(Math.Atan2(n, Math.Sqrt(p))), NormalizeAngle(Math.Atan2(2.0 * (r.z * r.s - r.x * r.y), (t.x - t.y - t.z + t.s)))); else if (n > 0) - return new LSL_Vector(0.0, Math.PI / 2, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); + return new LSL_Vector(0.0, Math.PI * 0.5, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); else - return new LSL_Vector(0.0, -Math.PI / 2, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); + return new LSL_Vector(0.0, -Math.PI * 0.5, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); } /* From wiki: @@ -553,12 +558,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api double x,y,z,s; - double c1 = Math.Cos(v.x/2.0); - double c2 = Math.Cos(v.y/2.0); - double c3 = Math.Cos(v.z/2.0); - double s1 = Math.Sin(v.x/2.0); - double s2 = Math.Sin(v.y/2.0); - double s3 = Math.Sin(v.z/2.0); + double c1 = Math.Cos(v.x * 0.5); + double c2 = Math.Cos(v.y * 0.5); + double c3 = Math.Cos(v.z * 0.5); + double s1 = Math.Sin(v.x * 0.5); + double s2 = Math.Sin(v.y * 0.5); + double s3 = Math.Sin(v.z * 0.5); x = s1*c2*c3+c1*s2*s3; y = c1*s2*c3-s1*c2*s3;