aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
diff options
context:
space:
mode:
authorVegaslon2013-04-09 17:23:50 -0400
committerRobert Adams2013-04-09 18:00:25 -0700
commit9cc41d511872fcd74a074ab484db2b981f3f5676 (patch)
tree7f9f72f3d86a4190dfdb34dbc51e5a049165b67d /OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
parentBulletSim: add Bullet HACD library invocation. Turned off by default as not (diff)
downloadopensim-SC-9cc41d511872fcd74a074ab484db2b981f3f5676.zip
opensim-SC-9cc41d511872fcd74a074ab484db2b981f3f5676.tar.gz
opensim-SC-9cc41d511872fcd74a074ab484db2b981f3f5676.tar.bz2
opensim-SC-9cc41d511872fcd74a074ab484db2b981f3f5676.tar.xz
Another algorithm for AngularVerticalAttraction. This one Takes into account all rotations before it and makes the corrections more close to the time that sl does.
Signed-off-by: Robert Adams <Robert.Adams@intel.com>
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs23
1 files changed, 23 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index 0fd1f73..723be0b 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -1358,6 +1358,28 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1358 // If vertical attaction timescale is reasonable 1358 // If vertical attaction timescale is reasonable
1359 if (enableAngularVerticalAttraction && m_verticalAttractionTimescale < m_verticalAttractionCutoff) 1359 if (enableAngularVerticalAttraction && m_verticalAttractionTimescale < m_verticalAttractionCutoff)
1360 { 1360 {
1361 //Another formula to try got from :
1362 //http://answers.unity3d.com/questions/10425/how-to-stabilize-angular-motion-alignment-of-hover.html
1363 Vector3 VehicleUpAxis = Vector3.UnitZ *VehicleOrientation;
1364 //Flipping what was originally a timescale into a speed variable and then multiplying it by 2 since only computing half
1365 //the distance between the angles.
1366 float VerticalAttractionSpeed=(1/m_verticalAttractionTimescale)*2.0f;
1367 //making a prediction of where the up axis will be when this is applied rather then where it is now this makes for a smoother
1368 //adjustment and less fighting between the various forces
1369 Vector3 predictedUp = VehicleUpAxis * Quaternion.CreateFromAxisAngle(VehicleRotationalVelocity, 0f);
1370 //this is only half the distance to the target so it will take 2 seconds to complete the turn.
1371 Vector3 torqueVector = Vector3.Cross(predictedUp, Vector3.UnitZ);
1372 //Scaling vector by our timescale since it is an acceleration it is r/s^2 or radians a timescale squared
1373 Vector3 vertContributionV=torqueVector * VerticalAttractionSpeed *VerticalAttractionSpeed;
1374 VehicleRotationalVelocity += vertContributionV;
1375 VDetailLog("{0}, MoveAngular,verticalAttraction,UpAxis={1},PredictedUp={2},torqueVector={3},contrib={4}",
1376 ControllingPrim.LocalID,
1377 VehicleUpAxis,
1378 predictedUp,
1379 torqueVector,
1380 vertContributionV);
1381 //=====================================================================
1382 /*
1361 // Possible solution derived from a discussion at: 1383 // Possible solution derived from a discussion at:
1362 // http://stackoverflow.com/questions/14939657/computing-vector-from-quaternion-works-computing-quaternion-from-vector-does-no 1384 // http://stackoverflow.com/questions/14939657/computing-vector-from-quaternion-works-computing-quaternion-from-vector-does-no
1363 1385
@@ -1392,6 +1414,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1392 differenceAngle, 1414 differenceAngle,
1393 correctionRotation, 1415 correctionRotation,
1394 vertContributionV); 1416 vertContributionV);
1417 */
1395 1418
1396 // =================================================================== 1419 // ===================================================================
1397 /* 1420 /*