diff options
author | UbitUmarov | 2012-05-13 01:28:20 +0100 |
---|---|---|
committer | UbitUmarov | 2012-05-13 01:28:20 +0100 |
commit | 9870d7e4e787ca64011ef817ea2ab40310f4cf26 (patch) | |
tree | a4c20f59c329249bc361014b254f4a77b17ae0ae /OpenSim/Region | |
parent | display a sleep time of zero if forced spare time to zero, when sim fps is l... (diff) | |
download | opensim-SC_OLD-9870d7e4e787ca64011ef817ea2ab40310f4cf26.zip opensim-SC_OLD-9870d7e4e787ca64011ef817ea2ab40310f4cf26.tar.gz opensim-SC_OLD-9870d7e4e787ca64011ef817ea2ab40310f4cf26.tar.bz2 opensim-SC_OLD-9870d7e4e787ca64011ef817ea2ab40310f4cf26.tar.xz |
ubitODE fix force in case of mlinear motor offset present
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs index 56d0f1a..e27be1e 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs | |||
@@ -750,6 +750,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
750 | { | 750 | { |
751 | IntPtr Body = rootPrim.Body; | 751 | IntPtr Body = rootPrim.Body; |
752 | 752 | ||
753 | d.Mass dmass; | ||
754 | d.BodyGetMass(Body, out dmass); | ||
755 | |||
753 | d.Quaternion rot = d.BodyGetQuaternion(Body); | 756 | d.Quaternion rot = d.BodyGetQuaternion(Body); |
754 | Quaternion objrotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); // rotq = rotation of object | 757 | Quaternion objrotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); // rotq = rotation of object |
755 | Quaternion rotq = objrotq; // rotq = rotation of object | 758 | Quaternion rotq = objrotq; // rotq = rotation of object |
@@ -791,7 +794,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
791 | if (m_linearMotorOffset.X != 0 || m_linearMotorOffset.Y != 0 || m_linearMotorOffset.Z != 0) | 794 | if (m_linearMotorOffset.X != 0 || m_linearMotorOffset.Y != 0 || m_linearMotorOffset.Z != 0) |
792 | { | 795 | { |
793 | // have offset, do it now | 796 | // have offset, do it now |
794 | tmpV *= rootPrim.Mass; | 797 | tmpV *= dmass.mass; |
795 | d.BodyAddForceAtRelPos(Body, tmpV.X, tmpV.Y, tmpV.Z, m_linearMotorOffset.X, m_linearMotorOffset.Y, m_linearMotorOffset.Z); | 798 | d.BodyAddForceAtRelPos(Body, tmpV.X, tmpV.Y, tmpV.Z, m_linearMotorOffset.X, m_linearMotorOffset.Y, m_linearMotorOffset.Z); |
796 | } | 799 | } |
797 | else | 800 | else |
@@ -1058,13 +1061,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1058 | } | 1061 | } |
1059 | 1062 | ||
1060 | 1063 | ||
1061 | d.Mass dmass; | ||
1062 | d.BodyGetMass(Body,out dmass); | ||
1063 | 1064 | ||
1064 | if (force.X != 0 || force.Y != 0 || force.Z != 0) | 1065 | if (force.X != 0 || force.Y != 0 || force.Z != 0) |
1065 | { | 1066 | { |
1066 | force *= dmass.mass; | 1067 | force *= dmass.mass; |
1067 | d.BodySetForce(Body, force.X, force.Y, force.Z); | 1068 | d.BodyAddForce(Body, force.X, force.Y, force.Z); |
1068 | } | 1069 | } |
1069 | 1070 | ||
1070 | if (torque.X != 0 || torque.Y != 0 || torque.Z != 0) | 1071 | if (torque.X != 0 || torque.Y != 0 || torque.Z != 0) |