mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 03:45:35 +08:00
add Util.GetTimeStamp() that returns the stamp in seconds; use it on ubOde; separed land collsions dispatch from the others...
This commit is contained in:
@@ -1240,7 +1240,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
SentEmptyCollisionsEvent = true;
|
||||
// _parent_scene.RemoveCollisionEventReporting(this);
|
||||
}
|
||||
else if(Body == IntPtr.Zero || d.BodyIsEnabled(Body))
|
||||
else if(Body == IntPtr.Zero || (d.BodyIsEnabled(Body) && m_bodydisablecontrol >= 0 ))
|
||||
{
|
||||
SentEmptyCollisionsEvent = false;
|
||||
CollisionEventsThisFrame.Clear();
|
||||
@@ -3595,7 +3595,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
_zeroFlag = true;
|
||||
d.BodySetAutoDisableSteps(Body, 1);
|
||||
d.BodyEnable(Body);
|
||||
m_bodydisablecontrol = -4;
|
||||
m_bodydisablecontrol = -3;
|
||||
}
|
||||
|
||||
if(m_bodydisablecontrol < 0)
|
||||
|
||||
@@ -203,8 +203,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
private float metersInSpace = 25.6f;
|
||||
private float m_timeDilation = 1.0f;
|
||||
|
||||
private DateTime m_lastframe;
|
||||
private DateTime m_lastMeshExpire;
|
||||
private double m_lastframe;
|
||||
private double m_lastMeshExpire;
|
||||
|
||||
public float gravityx = 0f;
|
||||
public float gravityy = 0f;
|
||||
@@ -629,8 +629,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
staticPrimspaceOffRegion[i] = newspace;
|
||||
}
|
||||
|
||||
m_lastframe = DateTime.UtcNow;
|
||||
m_lastframe = Util.GetTimeStamp();
|
||||
m_lastMeshExpire = m_lastframe;
|
||||
step_time = -1;
|
||||
}
|
||||
|
||||
internal void waitForSpaceUnlock(IntPtr space)
|
||||
@@ -1625,6 +1626,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
}
|
||||
m_log.InfoFormat("[ubOde] {0} prim actors loaded",_prims.Count);
|
||||
}
|
||||
m_lastframe = Util.GetTimeStamp() + 0.5;
|
||||
step_time = -0.5f;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1638,13 +1641,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
/// <returns></returns>
|
||||
public override float Simulate(float reqTimeStep)
|
||||
{
|
||||
DateTime now = DateTime.UtcNow;
|
||||
TimeSpan timedif = now - m_lastframe;
|
||||
float timeStep = (float)timedif.TotalSeconds;
|
||||
double now = Util.GetTimeStamp();
|
||||
double timeStep = now - m_lastframe;
|
||||
m_lastframe = now;
|
||||
|
||||
// acumulate time so we can reduce error
|
||||
step_time += timeStep;
|
||||
step_time += (float)timeStep;
|
||||
|
||||
if (step_time < HalfOdeStep)
|
||||
return 0;
|
||||
@@ -1853,14 +1855,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
}
|
||||
}
|
||||
|
||||
timedif = now - m_lastMeshExpire;
|
||||
|
||||
if (timedif.Seconds > 10)
|
||||
{
|
||||
mesher.ExpireReleaseMeshs();
|
||||
m_lastMeshExpire = now;
|
||||
}
|
||||
|
||||
// information block for in debug breakpoint only
|
||||
/*
|
||||
int ntopactivegeoms = d.SpaceGetNumGeoms(ActiveSpace);
|
||||
@@ -1940,7 +1934,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
// if we lag too much skip frames
|
||||
m_timeDilation = 0.0f;
|
||||
step_time = 0;
|
||||
m_lastframe = DateTime.UtcNow; // skip also the time lost
|
||||
m_lastframe = Util.GetTimeStamp(); // skip also the time lost
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1948,6 +1942,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
if (m_timeDilation > 1)
|
||||
m_timeDilation = 1;
|
||||
}
|
||||
|
||||
if (m_timeDilation == 1 && now - m_lastMeshExpire > 30)
|
||||
{
|
||||
mesher.ExpireReleaseMeshs();
|
||||
m_lastMeshExpire = now;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return fps;
|
||||
|
||||
Reference in New Issue
Block a user