aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
diff options
context:
space:
mode:
authorTeravus Ovares2007-11-08 00:10:40 +0000
committerTeravus Ovares2007-11-08 00:10:40 +0000
commit9e9dad1cde362de093d0d7e6c3e247ff00ceac96 (patch)
tree72b364a18532ee152cfbd72df0158b8a2e001464 /OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
parentset svn:eol-style (diff)
downloadopensim-SC_OLD-9e9dad1cde362de093d0d7e6c3e247ff00ceac96.zip
opensim-SC_OLD-9e9dad1cde362de093d0d7e6c3e247ff00ceac96.tar.gz
opensim-SC_OLD-9e9dad1cde362de093d0d7e6c3e247ff00ceac96.tar.bz2
opensim-SC_OLD-9e9dad1cde362de093d0d7e6c3e247ff00ceac96.tar.xz
* Added Rotational Velocity reporting for Client Interpolation to Terse Updates
* Added Angular Velocity reporting for smooth-ish rotations on object collisions
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/OdePlugin.cs')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs54
1 files changed, 44 insertions, 10 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 8b8aac6..512b96e 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -617,6 +617,7 @@ namespace OpenSim.Region.Physics.OdePlugin
617 private PhysicsVector _velocity; 617 private PhysicsVector _velocity;
618 private PhysicsVector _target_velocity; 618 private PhysicsVector _target_velocity;
619 private PhysicsVector _acceleration; 619 private PhysicsVector _acceleration;
620 private PhysicsVector m_rotationalVelocity;
620 private static float PID_D = 4000.0f; 621 private static float PID_D = 4000.0f;
621 private static float PID_P = 7000.0f; 622 private static float PID_P = 7000.0f;
622 private static float POSTURE_SERVO = 10000.0f; 623 private static float POSTURE_SERVO = 10000.0f;
@@ -682,7 +683,11 @@ namespace OpenSim.Region.Physics.OdePlugin
682 } 683 }
683 } 684 }
684 } 685 }
685 686 public override PhysicsVector RotationalVelocity
687 {
688 get { return m_rotationalVelocity; }
689 set { m_rotationalVelocity = value; }
690 }
686 public override PhysicsVector Size 691 public override PhysicsVector Size
687 { 692 {
688 get { return new PhysicsVector(CAPSULE_RADIUS*2, CAPSULE_RADIUS*2, CAPSULE_LENGTH); } 693 get { return new PhysicsVector(CAPSULE_RADIUS*2, CAPSULE_RADIUS*2, CAPSULE_LENGTH); }
@@ -858,6 +863,7 @@ namespace OpenSim.Region.Physics.OdePlugin
858 private PhysicsVector _velocity; 863 private PhysicsVector _velocity;
859 private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f,0.0f,0.0f); 864 private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f,0.0f,0.0f);
860 private PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f); 865 private PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f);
866 private PhysicsVector m_rotationalVelocity;
861 private PhysicsVector _size; 867 private PhysicsVector _size;
862 private PhysicsVector _acceleration; 868 private PhysicsVector _acceleration;
863 public Quaternion _orientation; 869 public Quaternion _orientation;
@@ -887,6 +893,7 @@ namespace OpenSim.Region.Physics.OdePlugin
887 _position = pos; 893 _position = pos;
888 _size = size; 894 _size = size;
889 _acceleration = new PhysicsVector(); 895 _acceleration = new PhysicsVector();
896 m_rotationalVelocity = PhysicsVector.Zero;
890 _orientation = rotation; 897 _orientation = rotation;
891 _mesh = mesh; 898 _mesh = mesh;
892 _pbs = pbs; 899 _pbs = pbs;
@@ -1224,7 +1231,12 @@ namespace OpenSim.Region.Physics.OdePlugin
1224 } 1231 }
1225 public void Move(float timestep) 1232 public void Move(float timestep)
1226 { 1233 {
1227 1234
1235 }
1236 public override PhysicsVector RotationalVelocity
1237 {
1238 get{ return m_rotationalVelocity;}
1239 set { m_rotationalVelocity = value; }
1228 } 1240 }
1229 1241
1230 public void UpdatePositionAndVelocity() { 1242 public void UpdatePositionAndVelocity() {
@@ -1234,6 +1246,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1234 d.Vector3 vec = d.BodyGetPosition(Body); 1246 d.Vector3 vec = d.BodyGetPosition(Body);
1235 d.Quaternion ori = d.BodyGetQuaternion(Body); 1247 d.Quaternion ori = d.BodyGetQuaternion(Body);
1236 d.Vector3 vel = d.BodyGetLinearVel(Body); 1248 d.Vector3 vel = d.BodyGetLinearVel(Body);
1249 d.Vector3 rotvel = d.BodyGetAngularVel(Body);
1250
1237 PhysicsVector l_position = new PhysicsVector(); 1251 PhysicsVector l_position = new PhysicsVector();
1238 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) 1252 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
1239 if (vec.X < 0.0f) vec.X = 0.0f; 1253 if (vec.X < 0.0f) vec.X = 0.0f;
@@ -1256,7 +1270,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1256 try 1270 try
1257 { 1271 {
1258 disableBody(); 1272 disableBody();
1259 1273
1260 } 1274 }
1261 catch (System.Exception e) 1275 catch (System.Exception e)
1262 { 1276 {
@@ -1264,13 +1278,16 @@ namespace OpenSim.Region.Physics.OdePlugin
1264 { 1278 {
1265 d.BodyDestroy(Body); 1279 d.BodyDestroy(Body);
1266 Body = (IntPtr)0; 1280 Body = (IntPtr)0;
1267 1281
1268 } 1282 }
1269 } 1283 }
1270 IsPhysical = false; 1284 IsPhysical = false;
1271 _velocity.X = 0; 1285 _velocity.X = 0;
1272 _velocity.Y = 0; 1286 _velocity.Y = 0;
1273 _velocity.Z = 0; 1287 _velocity.Z = 0;
1288 m_rotationalVelocity.X = 0;
1289 m_rotationalVelocity.Y = 0;
1290 m_rotationalVelocity.Z = 0;
1274 _zeroFlag = true; 1291 _zeroFlag = true;
1275 } 1292 }
1276 1293
@@ -1293,11 +1310,13 @@ namespace OpenSim.Region.Physics.OdePlugin
1293 _velocity.X = 0.0f; 1310 _velocity.X = 0.0f;
1294 _velocity.Y = 0.0f; 1311 _velocity.Y = 0.0f;
1295 _velocity.Z = 0.0f; 1312 _velocity.Z = 0.0f;
1296 _orientation.w = 0f; 1313 //_orientation.w = 0f;
1297 _orientation.x = 0f; 1314 //_orientation.x = 0f;
1298 _orientation.y = 0f; 1315 //_orientation.y = 0f;
1299 _orientation.z = 0f; 1316 //_orientation.z = 0f;
1300 1317 m_rotationalVelocity.X = 0;
1318 m_rotationalVelocity.Y = 0;
1319 m_rotationalVelocity.Z = 0;
1301 1320
1302 } 1321 }
1303 else 1322 else
@@ -1310,6 +1329,10 @@ namespace OpenSim.Region.Physics.OdePlugin
1310 _velocity.Y = vel.Y; 1329 _velocity.Y = vel.Y;
1311 _velocity.Z = vel.Z; 1330 _velocity.Z = vel.Z;
1312 1331
1332 m_rotationalVelocity.X = rotvel.X;
1333 m_rotationalVelocity.Y = rotvel.Y;
1334 m_rotationalVelocity.Z = rotvel.Z;
1335 //System.Console.WriteLine("ODE: " + m_rotationalVelocity.ToString());
1313 _orientation.w = ori.W; 1336 _orientation.w = ori.W;
1314 _orientation.x = ori.X; 1337 _orientation.x = ori.X;
1315 _orientation.y = ori.Y; 1338 _orientation.y = ori.Y;
@@ -1317,6 +1340,17 @@ namespace OpenSim.Region.Physics.OdePlugin
1317 } 1340 }
1318 1341
1319 } 1342 }
1343 else
1344 {
1345 // Not a body.. so Make sure the client isn't interpolating
1346 _velocity.X = 0;
1347 _velocity.Y = 0;
1348 _velocity.Z = 0;
1349 m_rotationalVelocity.X = 0;
1350 m_rotationalVelocity.Y = 0;
1351 m_rotationalVelocity.Z = 0;
1352 _zeroFlag = true;
1353 }
1320 1354
1321 } 1355 }
1322 public override void SetMomentum(PhysicsVector momentum) 1356 public override void SetMomentum(PhysicsVector momentum)