diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7c3875d5f0..3b8cd1ee9f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -135,6 +135,11 @@ namespace OpenSim.Region.Framework.Scenes protected SceneCommunicationService m_sceneGridService; public bool loginsdisabled = true; + public float TimeDilation + { + get { return m_sceneGraph.PhysicsScene.TimeDilation; } + } + public SceneCommunicationService SceneGridService { get { return m_sceneGridService; } @@ -1094,7 +1099,7 @@ namespace OpenSim.Region.Framework.Scenes // if (m_frame%m_update_avatars == 0) // UpdateInWorldTime(); StatsReporter.AddPhysicsFPS(physicsFPS); - StatsReporter.AddTimeDilation(m_timedilation); + StatsReporter.AddTimeDilation(TimeDilation); StatsReporter.AddFPS(1); StatsReporter.AddInPackets(0); StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount()); @@ -1141,18 +1146,6 @@ namespace OpenSim.Region.Framework.Scenes } finally { - //updateLock.ReleaseMutex(); - // Get actual time dilation - float tmpval = (m_timespan / (float)SinceLastFrame.TotalSeconds); - - // If actual time dilation is greater then one, we're catching up, so subtract - // the amount that's greater then 1 from the time dilation - if (tmpval > 1.0) - { - tmpval = tmpval - (tmpval - 1.0f); - } - m_timedilation = tmpval; - m_lastupdate = DateTime.UtcNow; } maintc = Environment.TickCount - maintc; diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 82731d1c58..1547f9a9b6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -106,9 +106,8 @@ namespace OpenSim.Region.Framework.Scenes public float TimeDilation { - get { return m_timedilation; } + get { return 1.0f; } } - protected float m_timedilation = 1.0f; protected ulong m_regionHandle; protected string m_regionName; diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index bb0d18e647..6d515e9eca 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs @@ -75,6 +75,11 @@ namespace OpenSim.Region.Physics.Manager public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation, bool isPhysical); + public virtual float TimeDilation + { + get { return 1.0f; } + } + public virtual bool SupportsNINJAJoints { get { return false; } diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 2f42646c20..9e36020f00 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -159,6 +159,7 @@ namespace OpenSim.Region.Physics.OdePlugin private float ODE_STEPSIZE = 0.020f; private float metersInSpace = 29.9f; + private float m_timeDilation = 1.0f; public float gravityx = 0f; public float gravityy = 0f; @@ -1750,6 +1751,11 @@ namespace OpenSim.Region.Physics.OdePlugin return result; } + public override float TimeDilation + { + get { return m_timeDilation; } + } + public override bool SupportsNINJAJoints { get { return m_NINJA_physics_joints_enabled; } @@ -2657,8 +2663,9 @@ 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) * 1000; + + fps = (step_time / ODE_STEPSIZE) * 1000; + m_timeDilation = (step_time / ODE_STEPSIZE) / (0.09375f / ODE_STEPSIZE); step_time = 0.09375f;