diff options
author | Melanie | 2013-04-10 13:20:55 +0100 |
---|---|---|
committer | Melanie | 2013-04-10 13:20:55 +0100 |
commit | 7cf377fff02de4504965420baaabd56b9a5379ee (patch) | |
tree | 5dde9202c352446232e53af9ce85efad4735a572 /OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |
parent | Merge branch 'master' into careminster (diff) | |
parent | BulletSim: fixing problems with llMoveToTarget. Not all fixed yet. (diff) | |
download | opensim-SC-7cf377fff02de4504965420baaabd56b9a5379ee.zip opensim-SC-7cf377fff02de4504965420baaabd56b9a5379ee.tar.gz opensim-SC-7cf377fff02de4504965420baaabd56b9a5379ee.tar.bz2 opensim-SC-7cf377fff02de4504965420baaabd56b9a5379ee.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Data/MySQL/MySQLAssetData.cs
OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 0fd1f73..612c68b 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -1358,6 +1358,35 @@ 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 | |||
1364 | Vector3 VehicleUpAxis = Vector3.UnitZ * VehicleOrientation; | ||
1365 | |||
1366 | // Flipping what was originally a timescale into a speed variable and then multiplying it by 2 | ||
1367 | // since only computing half the distance between the angles. | ||
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. | ||
1372 | Vector3 predictedUp = VehicleUpAxis * Quaternion.CreateFromAxisAngle(VehicleRotationalVelocity, 0f); | ||
1373 | |||
1374 | // This is only half the distance to the target so it will take 2 seconds to complete the turn. | ||
1375 | Vector3 torqueVector = Vector3.Cross(predictedUp, Vector3.UnitZ); | ||
1376 | |||
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 | |||
1380 | VehicleRotationalVelocity += vertContributionV; | ||
1381 | |||
1382 | VDetailLog("{0}, MoveAngular,verticalAttraction,UpAxis={1},PredictedUp={2},torqueVector={3},contrib={4}", | ||
1383 | ControllingPrim.LocalID, | ||
1384 | VehicleUpAxis, | ||
1385 | predictedUp, | ||
1386 | torqueVector, | ||
1387 | vertContributionV); | ||
1388 | //===================================================================== | ||
1389 | /* | ||
1361 | // Possible solution derived from a discussion at: | 1390 | // Possible solution derived from a discussion at: |
1362 | // http://stackoverflow.com/questions/14939657/computing-vector-from-quaternion-works-computing-quaternion-from-vector-does-no | 1391 | // http://stackoverflow.com/questions/14939657/computing-vector-from-quaternion-works-computing-quaternion-from-vector-does-no |
1363 | 1392 | ||
@@ -1392,6 +1421,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1392 | differenceAngle, | 1421 | differenceAngle, |
1393 | correctionRotation, | 1422 | correctionRotation, |
1394 | vertContributionV); | 1423 | vertContributionV); |
1424 | */ | ||
1395 | 1425 | ||
1396 | // =================================================================== | 1426 | // =================================================================== |
1397 | /* | 1427 | /* |