diff options
author | Robert Adams | 2013-01-21 15:55:54 -0800 |
---|---|---|
committer | Robert Adams | 2013-01-21 15:55:54 -0800 |
commit | 95c53ecae708c8f915e02c4f872c931efdd6c29a (patch) | |
tree | df054dedfb362639ad11b54ddab79c81b372229f | |
parent | BulletSim: remove unused MaxTaintsToProcessPerStep parameter (diff) | |
download | opensim-SC_OLD-95c53ecae708c8f915e02c4f872c931efdd6c29a.zip opensim-SC_OLD-95c53ecae708c8f915e02c4f872c931efdd6c29a.tar.gz opensim-SC_OLD-95c53ecae708c8f915e02c4f872c931efdd6c29a.tar.bz2 opensim-SC_OLD-95c53ecae708c8f915e02c4f872c931efdd6c29a.tar.xz |
Have SOP and LSL_Api call the proper GetCenterOfMass and GetGeometricCenter
routines on the physics engine. Won't make a difference for any
existing scripts since ODE always returned Vector3.Zero.
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 44e8fdf..e0ea344 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -1952,6 +1952,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1952 | PhysicsActor pa = PhysActor; | 1952 | PhysicsActor pa = PhysActor; |
1953 | 1953 | ||
1954 | if (pa != null) | 1954 | if (pa != null) |
1955 | return new Vector3(pa.GeometricCenter.X, pa.GeometricCenter.Y, pa.GeometricCenter.Z); | ||
1956 | else | ||
1957 | return new Vector3(0, 0, 0); | ||
1958 | } | ||
1959 | |||
1960 | public Vector3 GetCenterOfMass() | ||
1961 | { | ||
1962 | PhysicsActor pa = PhysActor; | ||
1963 | |||
1964 | if (pa != null) | ||
1955 | return new Vector3(pa.CenterOfMass.X, pa.CenterOfMass.Y, pa.CenterOfMass.Z); | 1965 | return new Vector3(pa.CenterOfMass.X, pa.CenterOfMass.Y, pa.CenterOfMass.Z); |
1956 | else | 1966 | else |
1957 | return new Vector3(0, 0, 0); | 1967 | return new Vector3(0, 0, 0); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index db5add1..507c399 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -4923,7 +4923,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4923 | public LSL_Vector llGetCenterOfMass() | 4923 | public LSL_Vector llGetCenterOfMass() |
4924 | { | 4924 | { |
4925 | m_host.AddScriptLPS(1); | 4925 | m_host.AddScriptLPS(1); |
4926 | Vector3 center = m_host.GetGeometricCenter(); | 4926 | Vector3 center = m_host.GetCenterOfMass(); |
4927 | return new LSL_Vector(center.X,center.Y,center.Z); | 4927 | return new LSL_Vector(center.X,center.Y,center.Z); |
4928 | } | 4928 | } |
4929 | 4929 | ||