diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index d3dd5d7..d4a563f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1712,7 +1712,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1712 | m_rootPart.SetParentLocalId(0); | 1712 | m_rootPart.SetParentLocalId(0); |
1713 | AttachmentPoint = (byte)0; | 1713 | AttachmentPoint = (byte)0; |
1714 | // must check if buildind should be true or false here | 1714 | // must check if buildind should be true or false here |
1715 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive,false); | 1715 | // m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive,false); |
1716 | ApplyPhysics(); | ||
1717 | |||
1716 | HasGroupChanged = true; | 1718 | HasGroupChanged = true; |
1717 | RootPart.Rezzed = DateTime.Now; | 1719 | RootPart.Rezzed = DateTime.Now; |
1718 | RootPart.RemFlag(PrimFlags.TemporaryOnRez); | 1720 | RootPart.RemFlag(PrimFlags.TemporaryOnRez); |
@@ -2879,6 +2881,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
2879 | return; | 2881 | return; |
2880 | } | 2882 | } |
2881 | 2883 | ||
2884 | // physical prims count limit | ||
2885 | // not very eficient :( | ||
2886 | |||
2887 | if (UsesPhysics && m_scene.m_linksetPhysCapacity > 0 && (PrimCount + objectGroup.PrimCount) > | ||
2888 | m_scene.m_linksetPhysCapacity) | ||
2889 | { | ||
2890 | int cntr = 0; | ||
2891 | foreach (SceneObjectPart part in Parts) | ||
2892 | { | ||
2893 | if (part.PhysicsShapeType != (byte)PhysicsShapeType.None) | ||
2894 | cntr++; | ||
2895 | } | ||
2896 | foreach (SceneObjectPart part in objectGroup.Parts) | ||
2897 | { | ||
2898 | if (part.PhysicsShapeType != (byte)PhysicsShapeType.None) | ||
2899 | cntr++; | ||
2900 | } | ||
2901 | |||
2902 | if (cntr > m_scene.m_linksetPhysCapacity) | ||
2903 | { | ||
2904 | // cancel physics | ||
2905 | RootPart.Flags &= ~PrimFlags.Physics; | ||
2906 | ApplyPhysics(); | ||
2907 | } | ||
2908 | } | ||
2909 | |||
2910 | |||
2882 | // 'linkPart' == the root of the group being linked into this group | 2911 | // 'linkPart' == the root of the group being linked into this group |
2883 | SceneObjectPart linkPart = objectGroup.m_rootPart; | 2912 | SceneObjectPart linkPart = objectGroup.m_rootPart; |
2884 | 2913 | ||
@@ -3477,8 +3506,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3477 | { | 3506 | { |
3478 | SceneObjectPart[] parts = m_parts.GetArray(); | 3507 | SceneObjectPart[] parts = m_parts.GetArray(); |
3479 | 3508 | ||
3480 | if (Scene != null) | 3509 | if (Scene != null && UsePhysics) |
3481 | { | 3510 | { |
3511 | int maxprims = m_scene.m_linksetPhysCapacity; | ||
3512 | bool checkShape = (maxprims > 0 && | ||
3513 | parts.Length > maxprims); | ||
3514 | |||
3482 | for (int i = 0; i < parts.Length; i++) | 3515 | for (int i = 0; i < parts.Length; i++) |
3483 | { | 3516 | { |
3484 | SceneObjectPart part = parts[i]; | 3517 | SceneObjectPart part = parts[i]; |
@@ -3489,6 +3522,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3489 | UsePhysics = false; // Reset physics | 3522 | UsePhysics = false; // Reset physics |
3490 | break; | 3523 | break; |
3491 | } | 3524 | } |
3525 | |||
3526 | if (checkShape && part.PhysicsShapeType != (byte)PhysicsShapeType.None) | ||
3527 | { | ||
3528 | if (--maxprims < 0) | ||
3529 | { | ||
3530 | UsePhysics = false; | ||
3531 | break; | ||
3532 | } | ||
3533 | } | ||
3492 | } | 3534 | } |
3493 | } | 3535 | } |
3494 | 3536 | ||