diff options
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 53 |
3 files changed, 55 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 3fe879a..3a5107d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -2318,7 +2318,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2318 | { | 2318 | { |
2319 | pos = GetNewRezLocation( | 2319 | pos = GetNewRezLocation( |
2320 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, | 2320 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, |
2321 | BypassRayCast, bRayEndIsIntersection, true, group.GroupScale(), false); | 2321 | BypassRayCast, bRayEndIsIntersection, true, group.GetAxisAlignedBoundingBox(), false); |
2322 | group.AbsolutePosition = pos; | 2322 | group.AbsolutePosition = pos; |
2323 | } | 2323 | } |
2324 | else | 2324 | else |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ac2d02e..660ee8d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1386,8 +1386,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1386 | 1386 | ||
1387 | //increase height so its above the ground. | 1387 | //increase height so its above the ground. |
1388 | //should be getting the normal of the ground at the rez point and using that? | 1388 | //should be getting the normal of the ground at the rez point and using that? |
1389 | float ScaleOffset = Math.Abs(scale.Z); | 1389 | pos.Z += scale.Z / 2f; |
1390 | pos.Z += ScaleOffset / 2f; | ||
1391 | return pos; | 1390 | return pos; |
1392 | } | 1391 | } |
1393 | } | 1392 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 55ee460..a403030 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -581,6 +581,59 @@ namespace OpenSim.Region.Framework.Scenes | |||
581 | return returnresult; | 581 | return returnresult; |
582 | } | 582 | } |
583 | 583 | ||
584 | |||
585 | |||
586 | /// <summary> | ||
587 | /// Gets a vector representing the size of the bounding box containing all the prims in the group | ||
588 | /// Treats all prims as rectangular, so no shape (cut etc) is taken into account | ||
589 | /// </summary> | ||
590 | /// <returns></returns> | ||
591 | public Vector3 GetAxisAlignedBoundingBox() | ||
592 | { | ||
593 | //int count = 0; | ||
594 | float maxX = 0f, maxY = 0f, maxZ = 0f, minX = 256f, minY = 256f, minZ = 256f; | ||
595 | lock (m_parts) | ||
596 | { | ||
597 | foreach (SceneObjectPart part in m_parts.Values) | ||
598 | { | ||
599 | Vector3 worldPos = part.GetWorldPosition(); | ||
600 | Quaternion worldRot = part.GetWorldRotation(); | ||
601 | |||
602 | Vector3 size = part.Scale * worldRot; | ||
603 | |||
604 | // m_log.InfoFormat("prim {0} , world pos is {1} , {2} , {3} , and size is {4} , {5} , {6}", count, worldPos.X, worldPos.Y, worldPos.Z, size.X, size.Y, size.Z); | ||
605 | // count++; | ||
606 | |||
607 | float tx= worldPos.X +( size.X/2); | ||
608 | float bx = worldPos.X - (size.X/2); | ||
609 | if (tx > maxX) | ||
610 | maxX = tx; | ||
611 | if (bx < minX) | ||
612 | minX = bx; | ||
613 | |||
614 | float ty = worldPos.Y + (size.Y / 2); | ||
615 | float by = worldPos.Y - (size.Y / 2); | ||
616 | if (ty > maxY) | ||
617 | maxY = ty; | ||
618 | if (by < minY) | ||
619 | minY = by; | ||
620 | |||
621 | float tz = worldPos.Z + (size.Z / 2); | ||
622 | float bz = worldPos.Z - (size.Z / 2); | ||
623 | if (tz > maxZ) | ||
624 | maxZ = tz; | ||
625 | if (bz < minZ) | ||
626 | minZ = bz; | ||
627 | |||
628 | } | ||
629 | |||
630 | } | ||
631 | |||
632 | Vector3 boundingBox = new Vector3(maxX - minX, maxY - minY, maxZ - minZ); | ||
633 | //m_log.InfoFormat("BoundingBox is {0} , {1} , {2} ", boundingBox.X, boundingBox.Y, boundingBox.Z); | ||
634 | return boundingBox; | ||
635 | } | ||
636 | |||
584 | #endregion | 637 | #endregion |
585 | 638 | ||
586 | public void SaveScriptedState(XmlTextWriter writer) | 639 | public void SaveScriptedState(XmlTextWriter writer) |