aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
diff options
context:
space:
mode:
authorTeravus Ovares2008-04-24 22:26:26 +0000
committerTeravus Ovares2008-04-24 22:26:26 +0000
commitd023c331f813598c3cabab93927a7ab105d6e7f1 (patch)
treeae7907318751d470c6032a97cd72d5dfe24ad306 /OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
parentdo a max of 3 splits when first processing the nhibernate connect (diff)
downloadopensim-SC_OLD-d023c331f813598c3cabab93927a7ab105d6e7f1.zip
opensim-SC_OLD-d023c331f813598c3cabab93927a7ab105d6e7f1.tar.gz
opensim-SC_OLD-d023c331f813598c3cabab93927a7ab105d6e7f1.tar.bz2
opensim-SC_OLD-d023c331f813598c3cabab93927a7ab105d6e7f1.tar.xz
* Tuned the llMove2Target PID controller to be more reasonable and not overshoot the target.
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/ODEPrim.cs')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs32
1 files changed, 24 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 947466f..5a5cf59 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -1192,12 +1192,27 @@ namespace OpenSim.Region.Physics.OdePlugin
1192 PID_D = 2200.0f; 1192 PID_D = 2200.0f;
1193 //PID_P = 900.0f; 1193 //PID_P = 900.0f;
1194 } 1194 }
1195 PID_D = 1.0f; 1195 PID_D = 35f;
1196 //PID_P = 1.0f;
1197 1196
1198 1197
1198 //PID_P = 1.0f;
1199 float PID_G = 25;
1200
1201 if ((m_PIDTau < 1))
1202 {
1203 PID_G = PID_G / m_PIDTau;
1204 }
1205
1206
1207 if ((PID_G - m_PIDTau) <= 0)
1208 {
1209 PID_G = m_PIDTau + 1;
1210 }
1199 //PidStatus = true; 1211 //PidStatus = true;
1200 1212
1213
1214
1215
1201 PhysicsVector vec = new PhysicsVector(); 1216 PhysicsVector vec = new PhysicsVector();
1202 d.Vector3 vel = d.BodyGetLinearVel(Body); 1217 d.Vector3 vel = d.BodyGetLinearVel(Body);
1203 1218
@@ -1205,9 +1220,9 @@ namespace OpenSim.Region.Physics.OdePlugin
1205 d.Vector3 pos = d.BodyGetPosition(Body); 1220 d.Vector3 pos = d.BodyGetPosition(Body);
1206 _target_velocity = 1221 _target_velocity =
1207 new PhysicsVector( 1222 new PhysicsVector(
1208 (m_PIDTarget.X - pos.X) / m_PIDTau, 1223 (m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep),
1209 (m_PIDTarget.Y - pos.Y) / m_PIDTau, 1224 (m_PIDTarget.Y - pos.Y) * ((PID_G - m_PIDTau) * timestep),
1210 (m_PIDTarget.Z - pos.Z) / m_PIDTau 1225 (m_PIDTarget.Z - pos.Z) * ((PID_G - m_PIDTau) * timestep)
1211 ); 1226 );
1212 1227
1213 1228
@@ -1239,8 +1254,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1239 _zeroFlag = false; 1254 _zeroFlag = false;
1240 1255
1241 // We're flying and colliding with something 1256 // We're flying and colliding with something
1242 fx = ((_target_velocity.X / m_PIDTau) - vel.X) * (PID_D / 6); 1257 fx = ((_target_velocity.X) - vel.X) * (PID_D);
1243 fy = ((_target_velocity.Y / m_PIDTau) - vel.Y) * (PID_D / 6); 1258 fy = ((_target_velocity.Y) - vel.Y) * (PID_D);
1244 1259
1245 1260
1246 1261
@@ -1262,6 +1277,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1262 //m_taintdisable = true; 1277 //m_taintdisable = true;
1263 //base.RaiseOutOfBounds(Position); 1278 //base.RaiseOutOfBounds(Position);
1264 //d.BodySetLinearVel(Body, fx, fy, 0f); 1279 //d.BodySetLinearVel(Body, fx, fy, 0f);
1280 enableBodySoft();
1265 d.BodyAddForce(Body, fx, fy, fz); 1281 d.BodyAddForce(Body, fx, fy, fz);
1266 } 1282 }
1267 } 1283 }
@@ -2146,7 +2162,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2146 } 2162 }
2147 public override PhysicsVector PIDTarget { set { m_PIDTarget = value; ; } } 2163 public override PhysicsVector PIDTarget { set { m_PIDTarget = value; ; } }
2148 public override bool PIDActive { set { m_usePID = value; } } 2164 public override bool PIDActive { set { m_usePID = value; } }
2149 public override float PIDTau { set { m_PIDTau = (value * 0.6f); } } 2165 public override float PIDTau { set { m_PIDTau = value; } }
2150 2166
2151 private void createAMotor(PhysicsVector axis) 2167 private void createAMotor(PhysicsVector axis)
2152 { 2168 {