aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
authorUbitUmarov2012-04-09 23:33:42 +0100
committerUbitUmarov2012-04-09 23:33:42 +0100
commitc4a9eae961030280473f6df77e59cb53865535b6 (patch)
tree0c067ce26208b6e578f9ab40f0f5d77b9f25b9a8 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
parentchODE and ubitODE always return prim mass (they where returning object mass o... (diff)
downloadopensim-SC-c4a9eae961030280473f6df77e59cb53865535b6.zip
opensim-SC-c4a9eae961030280473f6df77e59cb53865535b6.tar.gz
opensim-SC-c4a9eae961030280473f6df77e59cb53865535b6.tar.bz2
opensim-SC-c4a9eae961030280473f6df77e59cb53865535b6.tar.xz
make llGetGeometricCenter() work as in current SL. Now this is not real geom center but a average of positions relative to root prim ignoring prims details, so no need to use physics engine.
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 107d9b6..3fd1f5e 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;