diff options
author | UbitUmarov | 2016-08-04 16:24:19 +0100 |
---|---|---|
committer | UbitUmarov | 2016-08-04 16:24:19 +0100 |
commit | 3f2291611fcca7859f774976038e0c15168eda57 (patch) | |
tree | b27e491556ce97e51453187310cbdb240d5ad9c5 /OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs | |
parent | update libode for mac osX. Thanks Gavin Hird (mantis 7781) (diff) | |
download | opensim-SC-3f2291611fcca7859f774976038e0c15168eda57.zip opensim-SC-3f2291611fcca7859f774976038e0c15168eda57.tar.gz opensim-SC-3f2291611fcca7859f774976038e0c15168eda57.tar.bz2 opensim-SC-3f2291611fcca7859f774976038e0c15168eda57.tar.xz |
apply external forces and torque to vehicles also, as other engines do
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs index c3b4dd8..d8a2272 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs | |||
@@ -935,8 +935,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
935 | float roll; | 935 | float roll; |
936 | float pitch; | 936 | float pitch; |
937 | 937 | ||
938 | |||
939 | |||
940 | float ftmp = m_invtimestep / m_verticalAttractionTimescale / m_verticalAttractionTimescale; | 938 | float ftmp = m_invtimestep / m_verticalAttractionTimescale / m_verticalAttractionTimescale; |
941 | 939 | ||
942 | float ftmp2; | 940 | float ftmp2; |
@@ -957,7 +955,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
957 | effroll = 1 - effroll; | 955 | effroll = 1 - effroll; |
958 | effroll *= roll; | 956 | effroll *= roll; |
959 | 957 | ||
960 | |||
961 | torque.X += effroll * ftmp; | 958 | torque.X += effroll * ftmp; |
962 | 959 | ||
963 | if ((m_flags & VehicleFlag.LIMIT_ROLL_ONLY) == 0) | 960 | if ((m_flags & VehicleFlag.LIMIT_ROLL_ONLY) == 0) |
@@ -1074,10 +1071,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1074 | torque.Z -= curLocalAngVel.Z * m_amdampZ; | 1071 | torque.Z -= curLocalAngVel.Z * m_amdampZ; |
1075 | } | 1072 | } |
1076 | 1073 | ||
1074 | force *= dmass.mass; | ||
1075 | |||
1076 | force += rootPrim.m_force; | ||
1077 | force += rootPrim.m_forceacc; | ||
1078 | rootPrim.m_forceacc = Vector3.Zero; | ||
1077 | 1079 | ||
1078 | if (force.X != 0 || force.Y != 0 || force.Z != 0) | 1080 | if (force.X != 0 || force.Y != 0 || force.Z != 0) |
1079 | { | 1081 | { |
1080 | force *= dmass.mass; | ||
1081 | d.BodyAddForce(Body, force.X, force.Y, force.Z); | 1082 | d.BodyAddForce(Body, force.X, force.Y, force.Z); |
1082 | } | 1083 | } |
1083 | 1084 | ||
@@ -1091,6 +1092,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1091 | d.MultiplyM3V3(out dvtmp, ref dmass.I, ref dtorque); | 1092 | d.MultiplyM3V3(out dvtmp, ref dmass.I, ref dtorque); |
1092 | d.BodyAddRelTorque(Body, dvtmp.X, dvtmp.Y, dvtmp.Z); // add torque in object frame | 1093 | d.BodyAddRelTorque(Body, dvtmp.X, dvtmp.Y, dvtmp.Z); // add torque in object frame |
1093 | } | 1094 | } |
1095 | |||
1096 | torque = rootPrim.m_torque; | ||
1097 | torque += rootPrim.m_angularForceacc; | ||
1098 | rootPrim.m_angularForceacc = Vector3.Zero; | ||
1099 | if (torque.X != 0 || torque.Y != 0 || torque.Z != 0) | ||
1100 | d.BodyAddTorque(Body,torque.X, torque.Y, torque.Z); | ||
1094 | } | 1101 | } |
1095 | } | 1102 | } |
1096 | } | 1103 | } |