normalise physics plugins to return fps as (simulated time / requested simulation time). improved a bit old ode simulations per call math
parent
1434cb88fd
commit
ac4b2b2f50
|
@ -175,7 +175,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
actor.Velocity = actorVelocity;
|
actor.Velocity = actorVelocity;
|
||||||
}
|
}
|
||||||
|
|
||||||
return fps;
|
return 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void GetResults()
|
public override void GetResults()
|
||||||
|
|
|
@ -710,7 +710,8 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
// The physics engine returns the number of milliseconds it simulated this call.
|
// The physics engine returns the number of milliseconds it simulated this call.
|
||||||
// These are summed and normalized to one second and divided by 1000 to give the reported physics FPS.
|
// These are summed and normalized to one second and divided by 1000 to give the reported physics FPS.
|
||||||
// Multiply by a fixed nominal frame rate to give a rate similar to the simulator (usually 55).
|
// Multiply by a fixed nominal frame rate to give a rate similar to the simulator (usually 55).
|
||||||
m_simulatedTime += (float)numSubSteps * m_fixedTimeStep * 1000f * NominalFrameRate;
|
// m_simulatedTime += (float)numSubSteps * m_fixedTimeStep * 1000f * NominalFrameRate;
|
||||||
|
m_simulatedTime += (float)numSubSteps * m_fixedTimeStep * 1000f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called by a BSPhysObject to note that it has changed properties and this information
|
// Called by a BSPhysObject to note that it has changed properties and this information
|
||||||
|
@ -797,7 +798,8 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
|
|
||||||
// Return the framerate simulated to give the above returned results.
|
// Return the framerate simulated to give the above returned results.
|
||||||
// (Race condition here but this is just bookkeeping so rare mistakes do not merit a lock).
|
// (Race condition here but this is just bookkeeping so rare mistakes do not merit a lock).
|
||||||
float simTime = m_simulatedTime;
|
// undo math above
|
||||||
|
float simTime = m_simulatedTime / timeStep;
|
||||||
m_simulatedTime = 0f;
|
m_simulatedTime = 0f;
|
||||||
return simTime;
|
return simTime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1668,11 +1668,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
#region Add/Remove Entities
|
#region Add/Remove Entities
|
||||||
|
|
||||||
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
|
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
|
||||||
{
|
|
||||||
return AddAvatar(avName, position, size, isFlying);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
|
|
||||||
{
|
{
|
||||||
Vector3 pos;
|
Vector3 pos;
|
||||||
pos.X = position.X;
|
pos.X = position.X;
|
||||||
|
@ -3163,7 +3158,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
} // end lock OdeLock
|
} // end lock OdeLock
|
||||||
|
|
||||||
return fps * 1000.0f; //NB This is a FRAME COUNT, not a time! AND is divide by 1000 in SimStatusReporter!
|
return fps * (float)ODE_STEPSIZE * 1000.0f / timeStep;
|
||||||
} // end Simulate
|
} // end Simulate
|
||||||
|
|
||||||
public override void GetResults()
|
public override void GetResults()
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -238,7 +238,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
character._velocity.Z = (character.Position.Z - oldposZ)/timeStep;
|
character._velocity.Z = (character.Position.Z - oldposZ)/timeStep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fps;
|
return 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void GetResults()
|
public override void GetResults()
|
||||||
|
|
|
@ -1224,16 +1224,13 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
|
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
|
||||||
{
|
{
|
||||||
return AddAvatar(avName, position, size, isFlying);
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 size, float feetOffset, bool isFlying)
|
public override PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 size, float feetOffset, bool isFlying)
|
||||||
{
|
{
|
||||||
Vector3 pos;
|
OdeCharacter newAv = new OdeCharacter(localID, avName, this, position,
|
||||||
pos.X = position.X;
|
size, feetOffset, avDensity, avMovementDivisorWalk, avMovementDivisorRun);
|
||||||
pos.Y = position.Y;
|
|
||||||
pos.Z = position.Z;
|
|
||||||
OdeCharacter newAv = new OdeCharacter(localID,avName, this, pos, size, feetOffset, avDensity, avMovementDivisorWalk, avMovementDivisorRun);
|
|
||||||
newAv.Flying = isFlying;
|
newAv.Flying = isFlying;
|
||||||
newAv.MinimumGroundFlightOffset = minimumGroundFlightOffset;
|
newAv.MinimumGroundFlightOffset = minimumGroundFlightOffset;
|
||||||
|
|
||||||
|
@ -1863,9 +1860,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
m_lastframe = DateTime.UtcNow; // skip also the time lost
|
m_lastframe = DateTime.UtcNow; // skip also the time lost
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return (float)nodeframes * ODE_STEPSIZE / timeStep * 1000.0f;
|
||||||
// return nodeframes * ODE_STEPSIZE; // return real simulated time
|
|
||||||
return 1000 * nodeframes; // return steps for now * 1000 to keep core happy
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue