aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2016-08-04 16:24:19 +0100
committerUbitUmarov2016-08-04 16:24:19 +0100
commit3f2291611fcca7859f774976038e0c15168eda57 (patch)
treeb27e491556ce97e51453187310cbdb240d5ad9c5
parentupdate libode for mac osX. Thanks Gavin Hird (mantis 7781) (diff)
downloadopensim-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
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs15
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs8
2 files changed, 15 insertions, 8 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}
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
index aaa2203..ebaa875 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
@@ -81,7 +81,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
81 81
82 private Vector3 _position; 82 private Vector3 _position;
83 private Vector3 _velocity; 83 private Vector3 _velocity;
84 private Vector3 m_torque;
85 private Vector3 m_lastVelocity; 84 private Vector3 m_lastVelocity;
86 private Vector3 m_lastposition; 85 private Vector3 m_lastposition;
87 private Vector3 m_rotationalVelocity; 86 private Vector3 m_rotationalVelocity;
@@ -89,9 +88,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
89 private Vector3 _acceleration; 88 private Vector3 _acceleration;
90 private IntPtr Amotor; 89 private IntPtr Amotor;
91 90
92 private Vector3 m_force; 91 internal Vector3 m_force;
93 private Vector3 m_forceacc; 92 internal Vector3 m_forceacc;
94 private Vector3 m_angularForceacc; 93 internal Vector3 m_torque;
94 internal Vector3 m_angularForceacc;
95 95
96 private float m_invTimeStep; 96 private float m_invTimeStep;
97 private float m_timeStep; 97 private float m_timeStep;