diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 65 |
1 files changed, 47 insertions, 18 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6cbdc43..1942dfe 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2313,15 +2313,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2313 | if (pa != null) | 2313 | if (pa != null) |
2314 | { | 2314 | { |
2315 | if (UsePhysics != pa.IsPhysical) | 2315 | if (UsePhysics != pa.IsPhysical) |
2316 | { | 2316 | ClampScale(UsePhysics); |
2317 | float minsize = UsePhysics ? ParentGroup.Scene.m_minPhys : ParentGroup.Scene.m_minNonphys; | ||
2318 | float maxsize = UsePhysics ? ParentGroup.Scene.m_maxPhys : ParentGroup.Scene.m_maxNonphys; | ||
2319 | Vector3 scale = Scale; | ||
2320 | scale.X = Util.Clamp(scale.X, minsize, maxsize); | ||
2321 | scale.Y = Util.Clamp(scale.Y, minsize, maxsize); | ||
2322 | scale.Z = Util.Clamp(scale.Z, minsize, maxsize); | ||
2323 | Scale = scale; | ||
2324 | } | ||
2325 | 2317 | ||
2326 | if (UsePhysics != pa.IsPhysical || isNew) | 2318 | if (UsePhysics != pa.IsPhysical || isNew) |
2327 | { | 2319 | { |
@@ -3042,6 +3034,51 @@ namespace OpenSim.Region.Framework.Scenes | |||
3042 | Inventory.ResetInventoryIDs(); | 3034 | Inventory.ResetInventoryIDs(); |
3043 | } | 3035 | } |
3044 | 3036 | ||
3037 | |||
3038 | private void ClampScale(bool isPhysical) | ||
3039 | { | ||
3040 | float minsize = isPhysical ? ParentGroup.Scene.m_minPhys : ParentGroup.Scene.m_minNonphys; | ||
3041 | float maxsize = isPhysical ? ParentGroup.Scene.m_maxPhys : ParentGroup.Scene.m_maxNonphys; | ||
3042 | Vector3 scale = Scale; | ||
3043 | bool changed = false; | ||
3044 | |||
3045 | if (scale.X < minsize) | ||
3046 | { | ||
3047 | scale.X = minsize; | ||
3048 | changed = true; | ||
3049 | } | ||
3050 | else if (scale.X > maxsize) | ||
3051 | { | ||
3052 | scale.X = maxsize; | ||
3053 | changed = true; | ||
3054 | } | ||
3055 | |||
3056 | if (scale.Y < minsize) | ||
3057 | { | ||
3058 | scale.Y = minsize; | ||
3059 | changed = true; | ||
3060 | } | ||
3061 | else if (scale.Y > maxsize) | ||
3062 | { | ||
3063 | scale.Y = maxsize; | ||
3064 | changed = true; | ||
3065 | } | ||
3066 | |||
3067 | if (scale.Z < minsize) | ||
3068 | { | ||
3069 | scale.Z = minsize; | ||
3070 | changed = true; | ||
3071 | } | ||
3072 | else if (scale.Z > maxsize) | ||
3073 | { | ||
3074 | scale.Z = maxsize; | ||
3075 | changed = true; | ||
3076 | } | ||
3077 | |||
3078 | if (changed) | ||
3079 | Scale = scale; | ||
3080 | } | ||
3081 | |||
3045 | /// <summary> | 3082 | /// <summary> |
3046 | /// Set the scale of this part. | 3083 | /// Set the scale of this part. |
3047 | /// </summary> | 3084 | /// </summary> |
@@ -4777,15 +4814,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4777 | private void AddToPhysics(bool isPhysical, bool isPhantom, bool building, bool applyDynamics) | 4814 | private void AddToPhysics(bool isPhysical, bool isPhantom, bool building, bool applyDynamics) |
4778 | { | 4815 | { |
4779 | if (ParentGroup.Scene != null) | 4816 | if (ParentGroup.Scene != null) |
4780 | { | 4817 | ClampScale(isPhysical); |
4781 | float minsize = isPhysical ? ParentGroup.Scene.m_minPhys : ParentGroup.Scene.m_minNonphys; | ||
4782 | float maxsize = isPhysical ? ParentGroup.Scene.m_maxPhys : ParentGroup.Scene.m_maxNonphys; | ||
4783 | Vector3 scale = Scale; | ||
4784 | scale.X = Util.Clamp(scale.X, minsize, maxsize); | ||
4785 | scale.Y = Util.Clamp(scale.Y, minsize, maxsize); | ||
4786 | scale.Z = Util.Clamp(scale.Z, minsize, maxsize); | ||
4787 | Scale = scale; | ||
4788 | } | ||
4789 | 4818 | ||
4790 | PhysicsActor pa; | 4819 | PhysicsActor pa; |
4791 | Vector3 velocity = Velocity; | 4820 | Vector3 velocity = Velocity; |