diff options
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs index 8b57f06..0c168c6 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs | |||
@@ -1,16 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Revised Aug, Sept 2009 by Kitto Flora. ODEDynamics.cs replaces | ||
3 | * ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised: | ||
4 | * ODEPrim.cs contains methods dealing with Prim editing, Prim | ||
5 | * characteristics and Kinetic motion. | ||
6 | * ODEDynamics.cs contains methods dealing with Prim Physical motion | ||
7 | * (dynamics) and the associated settings. Old Linear and angular | ||
8 | * motors for dynamic motion have been replace with MoveLinear() | ||
9 | * and MoveAngular(); 'Physical' is used only to switch ODE dynamic | ||
10 | * simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to | ||
11 | * switch between 'VEHICLE' parameter use and general dynamics | ||
12 | * settings use. | ||
13 | * | ||
14 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
15 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
16 | * | 4 | * |
@@ -35,6 +23,19 @@ | |||
35 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
36 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
37 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | ||
27 | * Revised Aug, Sept 2009 by Kitto Flora. ODEDynamics.cs replaces | ||
28 | * ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised: | ||
29 | * ODEPrim.cs contains methods dealing with Prim editing, Prim | ||
30 | * characteristics and Kinetic motion. | ||
31 | * ODEDynamics.cs contains methods dealing with Prim Physical motion | ||
32 | * (dynamics) and the associated settings. Old Linear and angular | ||
33 | * motors for dynamic motion have been replace with MoveLinear() | ||
34 | * and MoveAngular(); 'Physical' is used only to switch ODE dynamic | ||
35 | * simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to | ||
36 | * switch between 'VEHICLE' parameter use and general dynamics | ||
37 | * settings use. | ||
38 | * | ||
38 | */ | 39 | */ |
39 | 40 | ||
40 | using System; | 41 | using System; |
@@ -66,8 +67,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
66 | 67 | ||
67 | // private OdeScene m_parentScene = null; | 68 | // private OdeScene m_parentScene = null; |
68 | private IntPtr m_body = IntPtr.Zero; | 69 | private IntPtr m_body = IntPtr.Zero; |
69 | private IntPtr m_jointGroup = IntPtr.Zero; | 70 | // private IntPtr m_jointGroup = IntPtr.Zero; |
70 | private IntPtr m_aMotor = IntPtr.Zero; | 71 | // private IntPtr m_aMotor = IntPtr.Zero; |
71 | 72 | ||
72 | 73 | ||
73 | // Vehicle properties | 74 | // Vehicle properties |
@@ -560,6 +561,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
560 | private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular velocity decay rate | 561 | private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular velocity decay rate |
561 | private Vector3 m_lastAngularVelocity = Vector3.Zero; // what was last applied to body | 562 | private Vector3 m_lastAngularVelocity = Vector3.Zero; // what was last applied to body |
562 | */ | 563 | */ |
564 | //if(frcount == 0) Console.WriteLine("MoveAngular "); | ||
563 | 565 | ||
564 | // Get what the body is doing, this includes 'external' influences | 566 | // Get what the body is doing, this includes 'external' influences |
565 | d.Vector3 angularVelocity = d.BodyGetAngularVel(Body); | 567 | d.Vector3 angularVelocity = d.BodyGetAngularVel(Body); |
@@ -614,7 +616,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
614 | // Error is 0 (no error) to +/- 2 (max error) | 616 | // Error is 0 (no error) to +/- 2 (max error) |
615 | // scale it by VAservo | 617 | // scale it by VAservo |
616 | verterr = verterr * VAservo; | 618 | verterr = verterr * VAservo; |
617 | //if(frcount == 0) Console.WriteLine("VAerr=" + verterr); | 619 | if(frcount == 0) Console.WriteLine("VAerr=" + verterr); |
618 | 620 | ||
619 | // As the body rotates around the X axis, then verterr.Y increases; Rotated around Y then .X increases, so | 621 | // As the body rotates around the X axis, then verterr.Y increases; Rotated around Y then .X increases, so |
620 | // Change Body angular velocity X based on Y, and Y based on X. Z is not changed. | 622 | // Change Body angular velocity X based on Y, and Y based on X. Z is not changed. |
@@ -635,7 +637,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
635 | // Deflection section tba | 637 | // Deflection section tba |
636 | 638 | ||
637 | // Sum velocities | 639 | // Sum velocities |
638 | m_lastAngularVelocity = m_angularMotorVelocity + vertattr; // + bank + deflection | 640 | m_lastAngularVelocity = m_angularMotorVelocity + vertattr; // tba: + bank + deflection |
639 | 641 | ||
640 | if (!m_lastAngularVelocity.ApproxEquals(Vector3.Zero, 0.01f)) | 642 | if (!m_lastAngularVelocity.ApproxEquals(Vector3.Zero, 0.01f)) |
641 | { | 643 | { |