aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
authorMelanie2012-04-13 03:03:44 +0100
committerMelanie2012-04-13 03:03:44 +0100
commit5e3a76361fa097a2c47f6d37884786ec5777590c (patch)
tree85d791855e6e3646194a572fae5f2fb3d7a84110 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
parentMerge branch 'master' into careminster (diff)
parentmake llGetGeometricCenter() work as in current SL. Now this is not real geom ... (diff)
downloadopensim-SC-5e3a76361fa097a2c47f6d37884786ec5777590c.zip
opensim-SC-5e3a76361fa097a2c47f6d37884786ec5777590c.tar.gz
opensim-SC-5e3a76361fa097a2c47f6d37884786ec5777590c.tar.bz2
opensim-SC-5e3a76361fa097a2c47f6d37884786ec5777590c.tar.xz
Merge branch 'master' of ssh://melanie@3dhosting.de/var/git/careminster into careminster
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs30
1 files changed, 29 insertions, 1 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index ced3fb5..6f3a084 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3955,7 +3955,35 @@ namespace OpenSim.Region.Framework.Scenes
3955 } 3955 }
3956 } 3956 }
3957 } 3957 }
3958 3958
3959 public Vector3 GetGeometricCenter()
3960 {
3961 // this is not real geometric center but a average of positions relative to root prim acording to
3962 // http://wiki.secondlife.com/wiki/llGetGeometricCenter
3963 // ignoring tortured prims details since sl also seems to ignore
3964 // so no real use in doing it on physics
3965
3966 Vector3 gc = Vector3.Zero;
3967
3968 int nparts = m_parts.Count;
3969 if (nparts <= 1)
3970 return gc;
3971
3972 SceneObjectPart[] parts = m_parts.GetArray();
3973 nparts = parts.Length; // just in case it changed
3974 if (nparts <= 1)
3975 return gc;
3976
3977 // average all parts positions
3978 for (int i = 0; i < nparts; i++)
3979 gc += parts[i].GetWorldPosition();
3980 gc /= nparts;
3981
3982 // relative to root:
3983 gc -= AbsolutePosition;
3984 return gc;
3985 }
3986
3959 public float GetMass() 3987 public float GetMass()
3960 { 3988 {
3961 float retmass = 0f; 3989 float retmass = 0f;