diff options
author | Robert Adams | 2013-03-16 15:34:07 -0700 |
---|---|---|
committer | Robert Adams | 2013-03-16 15:34:07 -0700 |
commit | 464201b41d5f5fdd7c88ab5e95dd7b6fbae6d766 (patch) | |
tree | ac5c22979a2dfeeb1d940223abddb2a8160aec74 /OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |
parent | BulletSim: Working Implementation of Angular Banking for Vehicles (Not SL Gra... (diff) | |
download | opensim-SC-464201b41d5f5fdd7c88ab5e95dd7b6fbae6d766.zip opensim-SC-464201b41d5f5fdd7c88ab5e95dd7b6fbae6d766.tar.gz opensim-SC-464201b41d5f5fdd7c88ab5e95dd7b6fbae6d766.tar.bz2 opensim-SC-464201b41d5f5fdd7c88ab5e95dd7b6fbae6d766.tar.xz |
BulletSim: add INI parameter for angular banking timescale fudge parameter.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 96eaa6b..38596fa 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -1437,21 +1437,21 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1437 | // As the vehicle rolls to the right or left, the Y value will increase from | 1437 | // As the vehicle rolls to the right or left, the Y value will increase from |
1438 | // zero (straight up) to 1 or -1 (full tilt right or left) | 1438 | // zero (straight up) to 1 or -1 (full tilt right or left) |
1439 | Vector3 rollComponents = Vector3.UnitZ * VehicleOrientation; | 1439 | Vector3 rollComponents = Vector3.UnitZ * VehicleOrientation; |
1440 | |||
1440 | // Figure out the yaw value for this much roll. | 1441 | // Figure out the yaw value for this much roll. |
1441 | // Squared because that seems to give a good value | ||
1442 | // float yawAngle = (float)Math.Asin(rollComponents.X * rollComponents.X) * m_bankingEfficiency; | ||
1443 | float yawAngle = m_angularMotorDirection.X * m_bankingEfficiency; | 1442 | float yawAngle = m_angularMotorDirection.X * m_bankingEfficiency; |
1444 | // actual error = static turn error + dynamic turn error | 1443 | // actual error = static turn error + dynamic turn error |
1445 | float mixedYawAngle =(yawAngle * (1f - m_bankingMix)) + ((yawAngle * m_bankingMix) * VehicleForwardSpeed); | 1444 | float mixedYawAngle =(yawAngle * (1f - m_bankingMix)) + ((yawAngle * m_bankingMix) * VehicleForwardSpeed); |
1446 | // TODO: the banking effect should not go to infinity but what to limit it to? and what should happen when this is | 1445 | |
1447 | // being added to a user defined yaw that is already PI*4? | 1446 | // TODO: the banking effect should not go to infinity but what to limit it to? |
1447 | // And what should happen when this is being added to a user defined yaw that is already PI*4? | ||
1448 | mixedYawAngle = ClampInRange(-12, mixedYawAngle, 12); | 1448 | mixedYawAngle = ClampInRange(-12, mixedYawAngle, 12); |
1449 | 1449 | ||
1450 | // Build the force vector to change rotation from what it is to what it should be | 1450 | // Build the force vector to change rotation from what it is to what it should be |
1451 | bankingContributionV.Z = -mixedYawAngle; | 1451 | bankingContributionV.Z = -mixedYawAngle; |
1452 | 1452 | ||
1453 | // Don't do it all at once. 60 becouse 1 second is too fast with most user defined roll as PI*4 | 1453 | // Don't do it all at once. Fudge because 1 second is too fast with most user defined roll as PI*4. |
1454 | bankingContributionV /= m_bankingTimescale*60; | 1454 | bankingContributionV /= m_bankingTimescale * BSParam.VehicleAngularBankingTimescaleFudge; |
1455 | 1455 | ||
1456 | //VehicleRotationalVelocity += bankingContributionV * VehicleOrientation; | 1456 | //VehicleRotationalVelocity += bankingContributionV * VehicleOrientation; |
1457 | VehicleRotationalVelocity += bankingContributionV; | 1457 | VehicleRotationalVelocity += bankingContributionV; |