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.
user_profiles
Robert Adams 2013-01-21 15:55:54 -08:00
parent 3f6698a595
commit 95c53ecae7
2 changed files with 11 additions and 1 deletions

View File

@ -1951,6 +1951,16 @@ namespace OpenSim.Region.Framework.Scenes
{
PhysicsActor pa = PhysActor;
if (pa != null)
return new Vector3(pa.GeometricCenter.X, pa.GeometricCenter.Y, pa.GeometricCenter.Z);
else
return new Vector3(0, 0, 0);
}
public Vector3 GetCenterOfMass()
{
PhysicsActor pa = PhysActor;
if (pa != null)
return new Vector3(pa.CenterOfMass.X, pa.CenterOfMass.Y, pa.CenterOfMass.Z);
else

View File

@ -4923,7 +4923,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGetCenterOfMass()
{
m_host.AddScriptLPS(1);
Vector3 center = m_host.GetGeometricCenter();
Vector3 center = m_host.GetCenterOfMass();
return new LSL_Vector(center.X,center.Y,center.Z);
}