From 86bdc4eca44cc86b105fcd76e6d44b8cc3121398 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 2 Apr 2013 23:48:55 +0100 Subject: [PATCH] Fix minor race condition where SOP.GetGeometricCenter() and GetCenterOfMass() could return results which were never the case if these values were changed whilst the method was running No need to create new Vector3s since these are structs. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index bca0c9df9d..34c66d9558 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1950,9 +1950,9 @@ namespace OpenSim.Region.Framework.Scenes PhysicsActor pa = PhysActor; if (pa != null) - return new Vector3(pa.GeometricCenter.X, pa.GeometricCenter.Y, pa.GeometricCenter.Z); + return pa.GeometricCenter; else - return new Vector3(0, 0, 0); + return Vector3.Zero; } public Vector3 GetCenterOfMass() @@ -1960,9 +1960,9 @@ namespace OpenSim.Region.Framework.Scenes PhysicsActor pa = PhysActor; if (pa != null) - return new Vector3(pa.CenterOfMass.X, pa.CenterOfMass.Y, pa.CenterOfMass.Z); + return pa.CenterOfMass; else - return new Vector3(0, 0, 0); + return Vector3.Zero; } public float GetMass()