mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 09:45:47 +08:00
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.
This commit is contained in:
@@ -54,6 +54,14 @@ public static class BSParam
|
||||
// ===================
|
||||
// From:
|
||||
|
||||
/// <summary>
|
||||
/// Set whether physics is active or not.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Can be enabled and disabled to start and stop physics.
|
||||
/// </remarks>
|
||||
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<bool>("Active", "If 'true', false then physics is not active",
|
||||
false ),
|
||||
new ParameterDefn<bool>("UseSeparatePhysicsThread", "If 'true', the physics engine runs independent from the simulator heartbeat",
|
||||
false ),
|
||||
new ParameterDefn<float>("PhysicsTimeStep", "If separate thread, seconds to simulate each interval",
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user