aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin
diff options
context:
space:
mode:
authorTeravus Ovares2008-01-27 03:18:10 +0000
committerTeravus Ovares2008-01-27 03:18:10 +0000
commit205001ab8d1a53338c3d98f52f381269124db928 (patch)
treebaf7106595cb580f4069276186d9a45a20c250b1 /OpenSim/Region/Physics/OdePlugin
parent* Shifted strategy of detecting specific *nix distributions to detecting *nix. (diff)
downloadopensim-SC_OLD-205001ab8d1a53338c3d98f52f381269124db928.zip
opensim-SC_OLD-205001ab8d1a53338c3d98f52f381269124db928.tar.gz
opensim-SC_OLD-205001ab8d1a53338c3d98f52f381269124db928.tar.bz2
opensim-SC_OLD-205001ab8d1a53338c3d98f52f381269124db928.tar.xz
* Highly experimental ODE_STEPSIZE = 0.025f - 1000 / 25 = 40fps - 10 substeps with fallback to 5 substeps when things get slow
* Just to give you an idea of the difference .. previous ODE_STEPSIZE was 0.005f - 1000/5 = 200fps - 10 substeps with fallback to 5 substeps when things get slow * *nix avatar may fall over again, *sorry*
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs21
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs4
2 files changed, 13 insertions, 12 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 097e2aa..6bd2706 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -68,8 +68,8 @@ namespace OpenSim.Region.Physics.OdePlugin
68 private float m_mass = 80f; 68 private float m_mass = 80f;
69 private float m_density = 60f; 69 private float m_density = 60f;
70 private bool m_pidControllerActive = true; 70 private bool m_pidControllerActive = true;
71 private static float PID_D = 3020.0f; 71 private float PID_D = 800.0f;
72 private static float PID_P = 7000.0f; 72 private float PID_P = 900.0f;
73 private static float POSTURE_SERVO = 10000.0f; 73 private static float POSTURE_SERVO = 10000.0f;
74 public static float CAPSULE_RADIUS = 0.37f; 74 public static float CAPSULE_RADIUS = 0.37f;
75 public float CAPSULE_LENGTH = 2.140599f; 75 public float CAPSULE_LENGTH = 2.140599f;
@@ -112,11 +112,11 @@ namespace OpenSim.Region.Physics.OdePlugin
112 if (System.Environment.OSVersion.Platform == PlatformID.Unix) 112 if (System.Environment.OSVersion.Platform == PlatformID.Unix)
113 { 113 {
114 m_foundDebian = true; 114 m_foundDebian = true;
115 m_tensor = 14000000f; 115 m_tensor = 1000000f;
116 } 116 }
117 else 117 else
118 { 118 {
119 m_tensor = 3800000f; 119 m_tensor = 1000000f;
120 } 120 }
121 121
122 m_StandUpRotation = 122 m_StandUpRotation =
@@ -384,7 +384,7 @@ namespace OpenSim.Region.Physics.OdePlugin
384 384
385 d.GeomSetBody(Shell, Body); 385 d.GeomSetBody(Shell, Body);
386 386
387 387
388 // The purpose of the AMotor here is to keep the avatar's physical 388 // The purpose of the AMotor here is to keep the avatar's physical
389 // surrogate from rotating while moving 389 // surrogate from rotating while moving
390 Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero); 390 Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero);
@@ -562,6 +562,7 @@ namespace OpenSim.Region.Physics.OdePlugin
562 // If the PID Controller isn't active then we set our force 562 // If the PID Controller isn't active then we set our force
563 // calculating base velocity to the current position 563 // calculating base velocity to the current position
564 564
565
565 if (m_pidControllerActive == false) 566 if (m_pidControllerActive == false)
566 { 567 {
567 _zeroPosition = d.BodyGetPosition(Body); 568 _zeroPosition = d.BodyGetPosition(Body);
@@ -598,11 +599,11 @@ namespace OpenSim.Region.Physics.OdePlugin
598 // Prim to avatar collisions 599 // Prim to avatar collisions
599 600
600 d.Vector3 pos = d.BodyGetPosition(Body); 601 d.Vector3 pos = d.BodyGetPosition(Body);
601 vec.X = (_target_velocity.X - vel.X)*PID_D + (_zeroPosition.X - pos.X)*PID_P; 602 vec.X = (_target_velocity.X - vel.X) * (PID_D) + (_zeroPosition.X - pos.X) * PID_P;
602 vec.Y = (_target_velocity.Y - vel.Y)*PID_D + (_zeroPosition.Y - pos.Y)*PID_P; 603 vec.Y = (_target_velocity.Y - vel.Y)*(PID_D) + (_zeroPosition.Y - pos.Y)*PID_P;
603 if (flying) 604 if (flying)
604 { 605 {
605 vec.Z = (_target_velocity.Z - vel.Z)*(PID_D + 5100) + (_zeroPosition.Z - pos.Z)*PID_P; 606 vec.Z = (_target_velocity.Z - vel.Z) * (PID_D) + (_zeroPosition.Z - pos.Z) * PID_P;
606 } 607 }
607 } 608 }
608 //PidStatus = true; 609 //PidStatus = true;
@@ -650,12 +651,12 @@ namespace OpenSim.Region.Physics.OdePlugin
650 651
651 if (flying) 652 if (flying)
652 { 653 {
653 vec.Z = (_target_velocity.Z - vel.Z)*(PID_D + 5100); 654 vec.Z = (_target_velocity.Z - vel.Z) * (PID_D);
654 } 655 }
655 } 656 }
656 if (flying) 657 if (flying)
657 { 658 {
658 vec.Z += 10.0f; 659 vec.Z += (9.8f*m_mass);
659 } 660 }
660 661
661 662
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 0563992..e22b2a1 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Region.Physics.OdePlugin
80 private const uint m_regionWidth = 256; 80 private const uint m_regionWidth = 256;
81 private const uint m_regionHeight = 256; 81 private const uint m_regionHeight = 256;
82 82
83 private static float ODE_STEPSIZE = 0.004f; 83 private static float ODE_STEPSIZE = 0.025f;
84 private static bool RENDER_FLAG = false; 84 private static bool RENDER_FLAG = false;
85 private static float metersInSpace = 29.9f; 85 private static float metersInSpace = 29.9f;
86 private IntPtr contactgroup; 86 private IntPtr contactgroup;
@@ -1087,7 +1087,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1087 1087
1088 // Figure out the Frames Per Second we're going at. 1088 // Figure out the Frames Per Second we're going at.
1089 //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size 1089 //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size
1090 fps = ((step_time/ODE_STEPSIZE)*(m_physicsiterations*250)); 1090 fps = (step_time/ODE_STEPSIZE) * 1000;
1091 1091
1092 1092
1093 while (step_time > 0.0f) 1093 while (step_time > 0.0f)