diff options
author | UbitUmarov | 2017-03-31 20:55:48 +0100 |
---|---|---|
committer | UbitUmarov | 2017-03-31 20:55:48 +0100 |
commit | 6a35a965ff7085b5962745437a10d798c0fb611d (patch) | |
tree | 029843113cec9fe04e733049c6232d2d36c2a106 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |
parent | Adapt to a variable name that has changed in core (diff) | |
download | opensim-SC_OLD-6a35a965ff7085b5962745437a10d798c0fb611d.zip opensim-SC_OLD-6a35a965ff7085b5962745437a10d798c0fb611d.tar.gz opensim-SC_OLD-6a35a965ff7085b5962745437a10d798c0fb611d.tar.bz2 opensim-SC_OLD-6a35a965ff7085b5962745437a10d798c0fb611d.tar.xz |
add OSSL functions to override linksets total mass, center of mass and inertia. replacing the crude automatic estimation based on prims known to physics and density. Changed parameters are still not saved, and are lost on region crossings. only suported by UbODE. EXPERIMENTAL feature, only test it for now.. don't try to use in products.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-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> |