diff options
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index bf4d60c..77658ef 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -5010,6 +5010,47 @@ namespace OpenSim.Region.Framework.Scenes | |||
5010 | return Ptot; | 5010 | return Ptot; |
5011 | } | 5011 | } |
5012 | 5012 | ||
5013 | public void GetInertiaData(out float TotalMass, out Vector3 CenterOfMass, out Vector3 Inertia, out Vector4 aux ) | ||
5014 | { | ||
5015 | PhysicsActor pa = RootPart.PhysActor; | ||
5016 | |||
5017 | if(((RootPart.Flags & PrimFlags.Physics) !=0) && pa !=null) | ||
5018 | { | ||
5019 | PhysicsInertiaData inertia; | ||
5020 | |||
5021 | inertia = pa.GetInertiaData(); | ||
5022 | |||
5023 | TotalMass = inertia.TotalMass; | ||
5024 | CenterOfMass = inertia.CenterOfMass; | ||
5025 | Inertia = inertia.Inertia; | ||
5026 | aux = inertia.InertiaRotation; | ||
5027 | |||
5028 | return; | ||
5029 | } | ||
5030 | |||
5031 | TotalMass = GetMass(); | ||
5032 | CenterOfMass = GetCenterOfMass() - AbsolutePosition; | ||
5033 | CenterOfMass *= Quaternion.Conjugate(RootPart.RotationOffset); | ||
5034 | Inertia = Vector3.Zero; | ||
5035 | aux = Vector4.Zero; | ||
5036 | } | ||
5037 | |||
5038 | public void SetInertiaData(float TotalMass, Vector3 CenterOfMass, Vector3 Inertia, Vector4 aux ) | ||
5039 | { | ||
5040 | PhysicsActor pa = RootPart.PhysActor; | ||
5041 | |||
5042 | if(pa !=null) | ||
5043 | { | ||
5044 | PhysicsInertiaData inertia = new PhysicsInertiaData(); | ||
5045 | inertia.TotalMass = TotalMass; | ||
5046 | inertia.CenterOfMass = CenterOfMass; | ||
5047 | inertia.Inertia = Inertia; | ||
5048 | inertia.InertiaRotation = aux; | ||
5049 | pa.SetInertiaData(inertia); | ||
5050 | } | ||
5051 | } | ||
5052 | |||
5053 | |||
5013 | /// <summary> | 5054 | /// <summary> |
5014 | /// Set the user group to which this scene object belongs. | 5055 | /// Set the user group to which this scene object belongs. |
5015 | /// </summary> | 5056 | /// </summary> |