diff options
author | Teravus Ovares | 2009-04-17 04:34:52 +0000 |
---|---|---|
committer | Teravus Ovares | 2009-04-17 04:34:52 +0000 |
commit | 0d00a767bc9d1d6aae20c31131cd2e4e6ed62418 (patch) | |
tree | e72b735905d97e3bcf114bf3ef9febfb587e8b17 /OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |
parent | * minor: Eliminate redundant argument in PreloadUserCache (diff) | |
download | opensim-SC-0d00a767bc9d1d6aae20c31131cd2e4e6ed62418.zip opensim-SC-0d00a767bc9d1d6aae20c31131cd2e4e6ed62418.tar.gz opensim-SC-0d00a767bc9d1d6aae20c31131cd2e4e6ed62418.tar.bz2 opensim-SC-0d00a767bc9d1d6aae20c31131cd2e4e6ed62418.tar.xz |
* Commit a few fixes to the Vehicle settings
* Vertical Attractor servo
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/ODEPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 391f644..adb559a 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -66,6 +66,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
66 | private IntPtr Amotor = IntPtr.Zero; | 66 | private IntPtr Amotor = IntPtr.Zero; |
67 | 67 | ||
68 | private PhysicsVector m_PIDTarget = new PhysicsVector(0, 0, 0); | 68 | private PhysicsVector m_PIDTarget = new PhysicsVector(0, 0, 0); |
69 | private PhysicsVector m_taintPIDTarget = new PhysicsVector(0, 0, 0); | ||
69 | private float m_PIDTau = 0f; | 70 | private float m_PIDTau = 0f; |
70 | private float PID_D = 35f; | 71 | private float PID_D = 35f; |
71 | private float PID_G = 25f; | 72 | private float PID_G = 25f; |
@@ -908,6 +909,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
908 | 909 | ||
909 | if (!m_angularlock.IsIdentical(m_taintAngularLock,0)) | 910 | if (!m_angularlock.IsIdentical(m_taintAngularLock,0)) |
910 | changeAngularLock(timestep); | 911 | changeAngularLock(timestep); |
912 | |||
913 | |||
911 | } | 914 | } |
912 | else | 915 | else |
913 | { | 916 | { |
@@ -915,6 +918,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
915 | } | 918 | } |
916 | } | 919 | } |
917 | 920 | ||
921 | |||
918 | private void changeAngularLock(float timestep) | 922 | private void changeAngularLock(float timestep) |
919 | { | 923 | { |
920 | // do we have a Physical object? | 924 | // do we have a Physical object? |
@@ -1470,6 +1474,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1470 | } | 1474 | } |
1471 | } | 1475 | } |
1472 | d.BodyEnable(Body); | 1476 | d.BodyEnable(Body); |
1477 | if (m_vehicle.Type != Vehicle.TYPE_NONE) | ||
1478 | { | ||
1479 | m_vehicle.Enable(Body, _parent_scene); | ||
1480 | } | ||
1473 | } | 1481 | } |
1474 | else | 1482 | else |
1475 | { | 1483 | { |
@@ -1550,6 +1558,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1550 | 1558 | ||
1551 | if (m_usePID) | 1559 | if (m_usePID) |
1552 | { | 1560 | { |
1561 | |||
1553 | //if (!d.BodyIsEnabled(Body)) | 1562 | //if (!d.BodyIsEnabled(Body)) |
1554 | //d.BodySetForce(Body, 0f, 0f, 0f); | 1563 | //d.BodySetForce(Body, 0f, 0f, 0f); |
1555 | // If we're using the PID controller, then we have no gravity | 1564 | // If we're using the PID controller, then we have no gravity |
@@ -1737,6 +1746,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1737 | fy = nmin; | 1746 | fy = nmin; |
1738 | d.BodyAddForce(Body, fx, fy, fz); | 1747 | d.BodyAddForce(Body, fx, fy, fz); |
1739 | } | 1748 | } |
1749 | if (m_vehicle.Body == IntPtr.Zero && m_vehicle.Type != Vehicle.TYPE_NONE) | ||
1750 | m_vehicle.Enable(Body, _parent_scene); | ||
1740 | 1751 | ||
1741 | m_vehicle.Step(timestep); | 1752 | m_vehicle.Step(timestep); |
1742 | } | 1753 | } |
@@ -1747,6 +1758,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1747 | } | 1758 | } |
1748 | } | 1759 | } |
1749 | 1760 | ||
1761 | |||
1762 | |||
1750 | public void rotate(float timestep) | 1763 | public void rotate(float timestep) |
1751 | { | 1764 | { |
1752 | d.Quaternion myrot = new d.Quaternion(); | 1765 | d.Quaternion myrot = new d.Quaternion(); |
@@ -2701,8 +2714,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2701 | set | 2714 | set |
2702 | { | 2715 | { |
2703 | if (PhysicsVector.isFinite(value)) | 2716 | if (PhysicsVector.isFinite(value)) |
2704 | m_PIDTarget = value; | 2717 | { |
2705 | else | 2718 | m_PIDTarget = value; |
2719 | } | ||
2720 | else | ||
2706 | m_log.Warn("[PHYSICS]: Got NaN PIDTarget from Scene on Object"); | 2721 | m_log.Warn("[PHYSICS]: Got NaN PIDTarget from Scene on Object"); |
2707 | } | 2722 | } |
2708 | } | 2723 | } |
@@ -3062,15 +3077,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3062 | return det; | 3077 | return det; |
3063 | 3078 | ||
3064 | } | 3079 | } |
3065 | private static float Determinant(Matrix4 matrix) | 3080 | |
3066 | { | ||
3067 | float det = 0; | ||
3068 | |||
3069 | for (int j = 0; j < 4; j++) | ||
3070 | det += (matrix[0, j] * Determinant(Minor(matrix, 0, j)) * (int)System.Math.Pow(-1, 0 + j)); | ||
3071 | return det; | ||
3072 | } | ||
3073 | |||
3074 | private static void DMassCopy(ref d.Mass src, ref d.Mass dst) | 3081 | private static void DMassCopy(ref d.Mass src, ref d.Mass dst) |
3075 | { | 3082 | { |
3076 | dst.c.W = src.c.W; | 3083 | dst.c.W = src.c.W; |