aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs')
-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));