aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorRobert Adams2013-04-09 17:14:15 -0700
committerRobert Adams2013-04-09 18:00:27 -0700
commitb53713cdda3c4e49913a6a82239da35d62f74e68 (patch)
treeaa97905f4b934dc198e198f728458652f8b93830 /OpenSim/Region
parentAnother algorithm for AngularVerticalAttraction. This one Takes into account ... (diff)
downloadopensim-SC_OLD-b53713cdda3c4e49913a6a82239da35d62f74e68.zip
opensim-SC_OLD-b53713cdda3c4e49913a6a82239da35d62f74e68.tar.gz
opensim-SC_OLD-b53713cdda3c4e49913a6a82239da35d62f74e68.tar.bz2
opensim-SC_OLD-b53713cdda3c4e49913a6a82239da35d62f74e68.tar.xz
BulletSim: some formatting changes.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs27
1 files changed, 17 insertions, 10 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index 723be0b..612c68b 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -1360,19 +1360,26 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1360 { 1360 {
1361 //Another formula to try got from : 1361 //Another formula to try got from :
1362 //http://answers.unity3d.com/questions/10425/how-to-stabilize-angular-motion-alignment-of-hover.html 1362 //http://answers.unity3d.com/questions/10425/how-to-stabilize-angular-motion-alignment-of-hover.html
1363 Vector3 VehicleUpAxis = Vector3.UnitZ *VehicleOrientation; 1363
1364 //Flipping what was originally a timescale into a speed variable and then multiplying it by 2 since only computing half 1364 Vector3 VehicleUpAxis = Vector3.UnitZ * VehicleOrientation;
1365 //the distance between the angles. 1365
1366 float VerticalAttractionSpeed=(1/m_verticalAttractionTimescale)*2.0f; 1366 // Flipping what was originally a timescale into a speed variable and then multiplying it by 2
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 1367 // since only computing half the distance between the angles.
1368 //adjustment and less fighting between the various forces 1368 float VerticalAttractionSpeed = (1 / m_verticalAttractionTimescale) * 2.0f;
1369
1370 // Make a prediction of where the up axis will be when this is applied rather then where it is now as
1371 // this makes for a smoother adjustment and less fighting between the various forces.
1369 Vector3 predictedUp = VehicleUpAxis * Quaternion.CreateFromAxisAngle(VehicleRotationalVelocity, 0f); 1372 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. 1373
1374 // 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); 1375 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 1376
1373 Vector3 vertContributionV=torqueVector * VerticalAttractionSpeed *VerticalAttractionSpeed; 1377 // Scale vector by our timescale since it is an acceleration it is r/s^2 or radians a timescale squared
1378 Vector3 vertContributionV = torqueVector * VerticalAttractionSpeed * VerticalAttractionSpeed;
1379
1374 VehicleRotationalVelocity += vertContributionV; 1380 VehicleRotationalVelocity += vertContributionV;
1375 VDetailLog("{0}, MoveAngular,verticalAttraction,UpAxis={1},PredictedUp={2},torqueVector={3},contrib={4}", 1381
1382 VDetailLog("{0}, MoveAngular,verticalAttraction,UpAxis={1},PredictedUp={2},torqueVector={3},contrib={4}",
1376 ControllingPrim.LocalID, 1383 ControllingPrim.LocalID,
1377 VehicleUpAxis, 1384 VehicleUpAxis,
1378 predictedUp, 1385 predictedUp,