diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ddff39f1a3..733eac40cd 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -161,13 +161,6 @@ namespace OpenSim.Region.Framework.Scenes } private bool m_scripts_enabled; - public bool ClampNegativeZ - { - get { return m_clampNegativeZ; } - } - - private readonly bool m_clampNegativeZ = false; - /// /// Used to prevent simultaneous calls to code that adds and removes agents. /// @@ -997,8 +990,6 @@ namespace OpenSim.Region.Framework.Scenes m_clampPrimSize = true; } - m_clampNegativeZ = startupConfig.GetBoolean("ClampNegativeZ", m_clampNegativeZ); - m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); @@ -1907,7 +1898,7 @@ namespace OpenSim.Region.Framework.Scenes StatsReporter.AddFrameStats(TimeDilation, physicsFPS, agentMS, physicsMS + physicsMS2, otherMS , sleepMS, frameMS, scriptTimeMS); - // Optionally warn if a frame takes double the amount of time that it should. + // Optionally warn if a frame takes double the amount of time that it should. if (DebugUpdates && Util.EnvironmentTickCountSubtract( m_lastFrameTick, previousFrameTick) > (int)(FrameTime * 1000 * 2)) @@ -2382,7 +2373,7 @@ namespace OpenSim.Region.Framework.Scenes Vector3 dir = RayEnd - RayStart; float wheight = (float)RegionInfo.RegionSettings.WaterHeight; - Vector3 wpos = Vector3.Zero; + Vector3 wpos = new(0.0f, 0.0f, Constants.MinSimulationHeight); // Check for water surface intersection from above if ((RayStart.Z > wheight) && (RayEnd.Z < wheight)) { @@ -2558,9 +2549,6 @@ namespace OpenSim.Region.Framework.Scenes if (Permissions.CanRezObject(1, ownerID, pos)) { - // rez ON the ground, not IN the ground - // pos.Z += 0.25F; The rez point should now be correct so that its not in the ground - AddNewPrim(ownerID, groupID, pos, rot, shape, addFlags); } else diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 62c5404a64..dd3f2e16dc 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -301,29 +301,51 @@ namespace OpenSim.Region.Framework.Scenes // KF: Check for out-of-region, move inside and make static. Vector3 npos = sceneObject.RootPart.GroupPosition; - bool clampZ = m_parentScene.ClampNegativeZ; - if (!((sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) && (sceneObject.RootPart.Shape.State != 0)) && (npos.X < 0.0 || npos.Y < 0.0 || (npos.Z < 0.0 && clampZ) || - npos.X > regionSizeX || npos.Y > regionSizeY)) + if (!((sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) && sceneObject.RootPart.Shape.State != 0)) { - if (npos.X < 0.0) npos.X = 1.0f; - if (npos.Y < 0.0) npos.Y = 1.0f; - if (npos.Z < 0.0 && clampZ) npos.Z = 0.0f; - if (npos.X > regionSizeX) npos.X = regionSizeX - 1.0f; - if (npos.Y > regionSizeY) npos.Y = regionSizeY - 1.0f; - - SceneObjectPart rootpart = sceneObject.RootPart; - rootpart.GroupPosition = npos; - - foreach (SceneObjectPart part in sceneObject.Parts) - { - if (part == rootpart) - continue; - part.GroupPosition = npos; + bool clamped = false; + if (npos.X < 0.0f) + { + npos.X = 1.0f; + clamped = true; + } + else if (npos.X > regionSizeX) + { + npos.X = regionSizeX - 1.0f; + clamped = true; + } + if (npos.Y < 0.0f) + { + npos.Y = 1.0f; + clamped = true; + } + else if (npos.Y > regionSizeY) + { + npos.Y = regionSizeY - 1.0f; + clamped = true; + } + if (npos.Z < Constants.MinSimulationHeight) + { + npos.Z = Constants.MinSimulationHeight; + clamped = true; + } + + if(clamped) + { + SceneObjectPart rootpart = sceneObject.RootPart; + rootpart.GroupPosition = npos; + + foreach (SceneObjectPart part in sceneObject.Parts) + { + if (part == rootpart) + continue; + part.GroupPosition = npos; + } + rootpart.Velocity = Vector3.Zero; + rootpart.AngularVelocity = Vector3.Zero; + rootpart.Acceleration = Vector3.Zero; } - rootpart.Velocity = Vector3.Zero; - rootpart.AngularVelocity = Vector3.Zero; - rootpart.Acceleration = Vector3.Zero; } bool ret = AddSceneObject(sceneObject, attachToBackup, sendClientUpdates); diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 0419b4018f..61a60dc08d 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -140,9 +140,6 @@ ; This can be overridden in the region config file. ClampPrimSize = false - ; If a prim is loaded from an external source, clamp it to Z = 0 if Z is negative. - ClampNegativeZ = false - ; Maximum number of prims allowable in a linkset. Affects creating new linksets. Ignored if less than or equal to zero. ; This can be overridden in the region config file. LinksetPrims = 0