diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index e31c3fcb5a..beb546dcb5 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -296,6 +296,11 @@ namespace OpenSim "Change the scale of a named prim", HandleEditScale); + m_console.Commands.AddCommand("Objects", false, "rotate scene", + "rotate scene ", + "Rotates all scene objects around x:128, y:128", + HandleRotateScene); + m_console.Commands.AddCommand("Users", false, "kick user", "kick user [--force] [message]", "Kick a user off the simulator", @@ -505,6 +510,34 @@ namespace OpenSim } } + private void HandleRotateScene(string module, string[] args) + { + string usage = "Usage: rotate scene "; + + if (args.Length != 3) + { + MainConsole.Instance.Output(usage); + return; + } + + float angle = (float)(Convert.ToSingle(args[2]) / 180.0 * Math.PI); + OpenMetaverse.Quaternion rot = OpenMetaverse.Quaternion.CreateFromAxisAngle(0, 0, 1, angle); + + SceneManager.ForEachSelectedScene(delegate(Scene scene) + { + scene.ForEachSOG(delegate(SceneObjectGroup sog) + { + if (sog.AttachmentPoint == 0) + { + sog.RootPart.UpdateRotation(rot * sog.GroupRotation); + Vector3 offset = sog.AbsolutePosition - new Vector3(128.0f, 128.0f, 0.0f); + offset *= rot; + sog.UpdateGroupPosition(new Vector3(128.0f, 128.0f, 0.0f) + offset); + } + }); + }); + } + /// /// Creates a new region based on the parameters specified. This will ask the user questions on the console ///