aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin
diff options
context:
space:
mode:
authorVegaslon2014-06-24 10:51:49 -0400
committerRobert Adams2014-07-18 19:07:00 -0700
commit738c60459c0721a2559274f6f6af1f556bda88c2 (patch)
treef8871b297a6cd1d789b64a7d7939212227f07dce /OpenSim/Region/Physics/BulletSPlugin
parentminor: remove long unused RegionInfo.ignoreIncomingConfiguration (diff)
downloadopensim-SC_OLD-738c60459c0721a2559274f6f6af1f556bda88c2.zip
opensim-SC_OLD-738c60459c0721a2559274f6f6af1f556bda88c2.tar.gz
opensim-SC_OLD-738c60459c0721a2559274f6f6af1f556bda88c2.tar.bz2
opensim-SC_OLD-738c60459c0721a2559274f6f6af1f556bda88c2.tar.xz
BulletSim: Modify first and default vehicle vertical attractor to be feature complete with use of the Limit Roll Only Flag.
Signed-off-by: Robert Adams <misterblue@misterblue.com>
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index 05374e8..2bf32e7 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -1438,6 +1438,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1438 // This is only half the distance to the target so it will take 2 seconds to complete the turn. 1438 // This is only half the distance to the target so it will take 2 seconds to complete the turn.
1439 Vector3 torqueVector = Vector3.Cross(predictedUp, Vector3.UnitZ); 1439 Vector3 torqueVector = Vector3.Cross(predictedUp, Vector3.UnitZ);
1440 1440
1441 if ((m_flags & VehicleFlag.LIMIT_ROLL_ONLY) != 0)
1442 {
1443 Vector3 vehicleForwardAxis = Vector3.UnitX * VehicleOrientation;
1444 torqueVector = ProjectVector(torqueVector, vehicleForwardAxis);
1445 }
1446
1441 // Scale vector by our timescale since it is an acceleration it is r/s^2 or radians a timescale squared 1447 // Scale vector by our timescale since it is an acceleration it is r/s^2 or radians a timescale squared
1442 Vector3 vertContributionV = torqueVector * verticalAttractionSpeed * verticalAttractionSpeed; 1448 Vector3 vertContributionV = torqueVector * verticalAttractionSpeed * verticalAttractionSpeed;
1443 1449
@@ -1739,6 +1745,14 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1739 1745
1740 } 1746 }
1741 1747
1748 //Given a Vector and a unit vector will return the amount of the vector is on the same axis as the unit.
1749 private Vector3 ProjectVector(Vector3 vector, Vector3 onNormal)
1750 {
1751 float vectorDot = Vector3.Dot(vector, onNormal);
1752 return onNormal * vectorDot;
1753
1754 }
1755
1742 private float ClampInRange(float low, float val, float high) 1756 private float ClampInRange(float low, float val, float high)
1743 { 1757 {
1744 return Math.Max(low, Math.Min(val, high)); 1758 return Math.Max(low, Math.Min(val, high));