diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 58f3b61ec4..785b4c3adb 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -951,18 +951,25 @@ namespace OpenSim.Region.Framework.Scenes { m_minNonphys = RegionInfo.NonphysPrimMin; } + // don't allow nonsense values + if(m_minNonphys < 0.001f) + m_minNonphys = 0.001f; m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); if (RegionInfo.NonphysPrimMax > 0) { m_maxNonphys = RegionInfo.NonphysPrimMax; } + if (m_maxNonphys > 2048) + m_maxNonphys = 2048; m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); if (RegionInfo.PhysPrimMin > 0) { m_minPhys = RegionInfo.PhysPrimMin; } + if(m_minPhys < 0.01f) + m_minPhys = 0.01f; m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); @@ -970,6 +977,8 @@ namespace OpenSim.Region.Framework.Scenes { m_maxPhys = RegionInfo.PhysPrimMax; } + if (m_maxPhys > 2048) + m_maxPhys = 2048; m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); if (RegionInfo.LinksetCapacity > 0) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a7d1809321..a23ebbfa46 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2319,6 +2319,17 @@ namespace OpenSim.Region.Framework.Scenes if (pa != null) { + if (UsePhysics != pa.IsPhysical) + { + float minsize = UsePhysics ? ParentGroup.Scene.m_minPhys : ParentGroup.Scene.m_minNonphys; + float maxsize = UsePhysics ? ParentGroup.Scene.m_maxPhys : ParentGroup.Scene.m_maxNonphys; + Vector3 scale = Scale; + scale.X = Util.Clamp(scale.X, minsize, maxsize); + scale.Y = Util.Clamp(scale.Y, minsize, maxsize); + scale.Z = Util.Clamp(scale.Z, minsize, maxsize); + Scale = scale; + } + if (UsePhysics != pa.IsPhysical || isNew) { if (pa.IsPhysical) // implies UsePhysics==false for this block @@ -4776,10 +4787,20 @@ namespace OpenSim.Region.Framework.Scenes /// applies velocities, force and torque private void AddToPhysics(bool isPhysical, bool isPhantom, bool building, bool applyDynamics) { - PhysicsActor pa; + if (ParentGroup.Scene != null) + { + float minsize = isPhysical ? ParentGroup.Scene.m_minPhys : ParentGroup.Scene.m_minNonphys; + float maxsize = isPhysical ? ParentGroup.Scene.m_maxPhys : ParentGroup.Scene.m_maxNonphys; + Vector3 scale = Scale; + scale.X = Util.Clamp(scale.X, minsize, maxsize); + scale.Y = Util.Clamp(scale.Y, minsize, maxsize); + scale.Z = Util.Clamp(scale.Z, minsize, maxsize); + Scale = scale; + } + PhysicsActor pa; Vector3 velocity = Velocity; - Vector3 rotationalVelocity = AngularVelocity;; + Vector3 rotationalVelocity = AngularVelocity; ; try {