From 3654ae8d8cea0bf0455974efe18ff99e484d2893 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 29 Jul 2014 01:21:15 +0100 Subject: Allow the "debug scene set physics false|true" command to work when bulletsim physics is running in a separate thread. This will also allow the "disable physics" setting in the region debug viewer dialog to work in this circumstance. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 10 ++++++++++ OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 8b4df05..867d6ff 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -54,6 +54,14 @@ public static class BSParam // =================== // From: + /// + /// Set whether physics is active or not. + /// + /// + /// Can be enabled and disabled to start and stop physics. + /// + public static bool Active { get; private set; } + public static bool UseSeparatePhysicsThread { get; private set; } public static float PhysicsTimeStep { get; private set; } @@ -373,6 +381,8 @@ public static class BSParam // v = value (appropriate type) private static ParameterDefnBase[] ParameterDefinitions = { + new ParameterDefn("Active", "If 'true', false then physics is not active", + false ), new ParameterDefn("UseSeparatePhysicsThread", "If 'true', the physics engine runs independent from the simulator heartbeat", false ), new ParameterDefn("PhysicsTimeStep", "If separate thread, seconds to simulate each interval", diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 17d26a9..e517389 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -821,7 +821,10 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters while (m_initialized) { int beginSimulationRealtimeMS = Util.EnvironmentTickCount(); - DoPhysicsStep(BSParam.PhysicsTimeStep); + + if (BSParam.Active) + DoPhysicsStep(BSParam.PhysicsTimeStep); + int simulationRealtimeMS = Util.EnvironmentTickCountSubtract(beginSimulationRealtimeMS); int simulationTimeVsRealtimeDifferenceMS = ((int)(BSParam.PhysicsTimeStep*1000f)) - simulationRealtimeMS; -- cgit v1.1