aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
authorMW2009-07-13 14:42:46 +0000
committerMW2009-07-13 14:42:46 +0000
commitc4318136ba356a1766d57479ae1814a2606c5c8d (patch)
treea79b88d6fe26976990b14e0c9f67781b71f90285 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
parentAttempt to make it so items rezzed from inventory aren't half in the ground o... (diff)
downloadopensim-SC_OLD-c4318136ba356a1766d57479ae1814a2606c5c8d.zip
opensim-SC_OLD-c4318136ba356a1766d57479ae1814a2606c5c8d.tar.gz
opensim-SC_OLD-c4318136ba356a1766d57479ae1814a2606c5c8d.tar.bz2
opensim-SC_OLD-c4318136ba356a1766d57479ae1814a2606c5c8d.tar.xz
Changed it so that when rezzing prims from inventory, a bounding box containing all the prims in the group is used for working out the rezzing point. So that none of the child prims are underground. Or at least thats what it is meant to do, still needs more testing and there are still some issues with link sets getting rezzed too high above the ground/target prim.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs53
1 files changed, 53 insertions, 0 deletions
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)