From 205001ab8d1a53338c3d98f52f381269124db928 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 27 Jan 2008 03:18:10 +0000 Subject: * 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* --- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 21 +++++++++++---------- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 4 ++-- 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 private float m_mass = 80f; private float m_density = 60f; private bool m_pidControllerActive = true; - private static float PID_D = 3020.0f; - private static float PID_P = 7000.0f; + private float PID_D = 800.0f; + private float PID_P = 900.0f; private static float POSTURE_SERVO = 10000.0f; public static float CAPSULE_RADIUS = 0.37f; public float CAPSULE_LENGTH = 2.140599f; @@ -112,11 +112,11 @@ namespace OpenSim.Region.Physics.OdePlugin if (System.Environment.OSVersion.Platform == PlatformID.Unix) { m_foundDebian = true; - m_tensor = 14000000f; + m_tensor = 1000000f; } else { - m_tensor = 3800000f; + m_tensor = 1000000f; } m_StandUpRotation = @@ -384,7 +384,7 @@ namespace OpenSim.Region.Physics.OdePlugin d.GeomSetBody(Shell, Body); - + // The purpose of the AMotor here is to keep the avatar's physical // surrogate from rotating while moving Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero); @@ -562,6 +562,7 @@ namespace OpenSim.Region.Physics.OdePlugin // If the PID Controller isn't active then we set our force // calculating base velocity to the current position + if (m_pidControllerActive == false) { _zeroPosition = d.BodyGetPosition(Body); @@ -598,11 +599,11 @@ namespace OpenSim.Region.Physics.OdePlugin // Prim to avatar collisions d.Vector3 pos = d.BodyGetPosition(Body); - vec.X = (_target_velocity.X - vel.X)*PID_D + (_zeroPosition.X - pos.X)*PID_P; - vec.Y = (_target_velocity.Y - vel.Y)*PID_D + (_zeroPosition.Y - pos.Y)*PID_P; + vec.X = (_target_velocity.X - vel.X) * (PID_D) + (_zeroPosition.X - pos.X) * PID_P; + vec.Y = (_target_velocity.Y - vel.Y)*(PID_D) + (_zeroPosition.Y - pos.Y)*PID_P; if (flying) { - vec.Z = (_target_velocity.Z - vel.Z)*(PID_D + 5100) + (_zeroPosition.Z - pos.Z)*PID_P; + vec.Z = (_target_velocity.Z - vel.Z) * (PID_D) + (_zeroPosition.Z - pos.Z) * PID_P; } } //PidStatus = true; @@ -650,12 +651,12 @@ namespace OpenSim.Region.Physics.OdePlugin if (flying) { - vec.Z = (_target_velocity.Z - vel.Z)*(PID_D + 5100); + vec.Z = (_target_velocity.Z - vel.Z) * (PID_D); } } if (flying) { - vec.Z += 10.0f; + vec.Z += (9.8f*m_mass); } 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 private const uint m_regionWidth = 256; private const uint m_regionHeight = 256; - private static float ODE_STEPSIZE = 0.004f; + private static float ODE_STEPSIZE = 0.025f; private static bool RENDER_FLAG = false; private static float metersInSpace = 29.9f; private IntPtr contactgroup; @@ -1087,7 +1087,7 @@ namespace OpenSim.Region.Physics.OdePlugin // Figure out the Frames Per Second we're going at. //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size - fps = ((step_time/ODE_STEPSIZE)*(m_physicsiterations*250)); + fps = (step_time/ODE_STEPSIZE) * 1000; while (step_time > 0.0f) -- cgit v1.1