Make it possible to change avatar position update, rotation and velocity tolerances on the fly.

This is done via "debug scene set client-pos-upd, client-rot-upd, client-vel-upd".
For testing purposes.
bullet-2.82
Justin Clark-Casey (justincc) 2014-07-29 03:13:10 +01:00
parent 3654ae8d8c
commit f54fccba1e
3 changed files with 79 additions and 29 deletions

View File

@ -232,6 +232,21 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public bool SendPeriodicAppearanceUpdates { get; set; } public bool SendPeriodicAppearanceUpdates { get; set; }
/// <summary>
/// How much a client has to change position before updates are sent to viewers.
/// </summary>
public float ClientPositionUpdateTolerance { get; set; }
/// <summary>
/// How much a client has to rotate before updates are sent to viewers.
/// </summary>
public float ClientRotationUpdateTolerance { get; set; }
/// <summary>
/// How much a client has to change velocity before updates are sent to viewers.
/// </summary>
public float ClientVelocityUpdateTolerance { get; set; }
protected float m_defaultDrawDistance = 255.0f; protected float m_defaultDrawDistance = 255.0f;
public float DefaultDrawDistance public float DefaultDrawDistance
{ {
@ -1046,6 +1061,9 @@ namespace OpenSim.Region.Framework.Scenes
PeriodicBackup = true; PeriodicBackup = true;
UseBackup = true; UseBackup = true;
ClientRotationUpdateTolerance = 0.01f;
ClientVelocityUpdateTolerance = 0.001f;
ClientPositionUpdateTolerance = 0.05f;
ChildReprioritizationDistance = 20.0; ChildReprioritizationDistance = 20.0;
m_eventManager = new EventManager(); m_eventManager = new EventManager();

View File

@ -3182,10 +3182,6 @@ namespace OpenSim.Region.Framework.Scenes
public override void Update() public override void Update()
{ {
const float ROTATION_TOLERANCE = 0.01f;
const float VELOCITY_TOLERANCE = 0.001f;
const float POSITION_TOLERANCE = 0.05f;
if (IsChildAgent == false) if (IsChildAgent == false)
{ {
// NOTE: Velocity is not the same as m_velocity. Velocity will attempt to // NOTE: Velocity is not the same as m_velocity. Velocity will attempt to
@ -3202,9 +3198,9 @@ namespace OpenSim.Region.Framework.Scenes
if (!updateClients) if (!updateClients)
updateClients updateClients
= !Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) = !Rotation.ApproxEquals(m_lastRotation, Scene.ClientRotationUpdateTolerance)
|| !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || !Velocity.ApproxEquals(m_lastVelocity, Scene.ClientVelocityUpdateTolerance)
|| !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE); || !m_pos.ApproxEquals(m_lastPosition, Scene.ClientPositionUpdateTolerance);
if (updateClients) if (updateClients)
{ {

View File

@ -96,6 +96,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
"active - if false then main scene update and maintenance loops are suspended.\n" "active - if false then main scene update and maintenance loops are suspended.\n"
+ "animations - if true then extra animations debug information is logged.\n" + "animations - if true then extra animations debug information is logged.\n"
+ "child-repri - how far an avatar must move in meters before we update the position of its child agents in neighbouring regions.\n" + "child-repri - how far an avatar must move in meters before we update the position of its child agents in neighbouring regions.\n"
+ "client-pos-upd - the tolerance before clients are updated with new rotation information for an avatar.\n"
+ "client-rot-upd - the tolerance before clients are updated with new rotation information for an avatar.\n"
+ "client-vel-upd - the tolerance before clients are updated with new velocity information for an avatar.\n"
+ "collisions - if false then collisions with other objects are turned off.\n" + "collisions - if false then collisions with other objects are turned off.\n"
+ "pbackup - if false then periodic scene backup is turned off.\n" + "pbackup - if false then periodic scene backup is turned off.\n"
+ "physics - if false then all physics objects are non-physical.\n" + "physics - if false then all physics objects are non-physical.\n"
@ -111,6 +114,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
"active - if false then main scene update and maintenance loops are suspended.\n" "active - if false then main scene update and maintenance loops are suspended.\n"
+ "animations - if true then extra animations debug information is logged.\n" + "animations - if true then extra animations debug information is logged.\n"
+ "child-repri - how far an avatar must move in meters before we update the position of its child agents in neighbouring regions.\n" + "child-repri - how far an avatar must move in meters before we update the position of its child agents in neighbouring regions.\n"
+ "client-pos-upd - the tolerance before clients are updated with new rotation information for an avatar.\n"
+ "client-rot-upd - the tolerance before clients are updated with new rotation information for an avatar.\n"
+ "client-vel-upd - the tolerance before clients are updated with new velocity information for an avatar.\n"
+ "collisions - if false then collisions with other objects are turned off.\n" + "collisions - if false then collisions with other objects are turned off.\n"
+ "pbackup - if false then periodic scene backup is turned off.\n" + "pbackup - if false then periodic scene backup is turned off.\n"
+ "physics - if false then all physics objects are non-physical.\n" + "physics - if false then all physics objects are non-physical.\n"
@ -141,6 +147,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
cdl.AddRow("active", m_scene.Active); cdl.AddRow("active", m_scene.Active);
cdl.AddRow("animations", m_scene.DebugAnimations); cdl.AddRow("animations", m_scene.DebugAnimations);
cdl.AddRow("child-repri", m_scene.ChildReprioritizationDistance); cdl.AddRow("child-repri", m_scene.ChildReprioritizationDistance);
cdl.AddRow("client-pos-upd", m_scene.ClientPositionUpdateTolerance);
cdl.AddRow("client-rot-upd", m_scene.ClientRotationUpdateTolerance);
cdl.AddRow("client-vel-upd", m_scene.ClientVelocityUpdateTolerance);
cdl.AddRow("pbackup", m_scene.PeriodicBackup); cdl.AddRow("pbackup", m_scene.PeriodicBackup);
cdl.AddRow("physics", m_scene.PhysicsEnabled); cdl.AddRow("physics", m_scene.PhysicsEnabled);
cdl.AddRow("scripting", m_scene.ScriptsEnabled); cdl.AddRow("scripting", m_scene.ScriptsEnabled);
@ -190,11 +199,38 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
if (options.ContainsKey("child-repri")) if (options.ContainsKey("child-repri"))
{ {
double childRepriDistance; double newValue;
// FIXME: This can only come from the console at the moment but might not always be true. // FIXME: This can only come from the console at the moment but might not always be true.
if (ConsoleUtil.TryParseConsoleDouble(MainConsole.Instance, options["child-repri"], out childRepriDistance)) if (ConsoleUtil.TryParseConsoleDouble(MainConsole.Instance, options["child-repri"], out newValue))
m_scene.ChildReprioritizationDistance = childRepriDistance; m_scene.ChildReprioritizationDistance = newValue;
}
if (options.ContainsKey("client-pos-upd"))
{
float newValue;
// FIXME: This can only come from the console at the moment but might not always be true.
if (ConsoleUtil.TryParseConsoleFloat(MainConsole.Instance, options["client-pos-upd"], out newValue))
m_scene.ClientPositionUpdateTolerance = newValue;
}
if (options.ContainsKey("client-rot-upd"))
{
float newValue;
// FIXME: This can only come from the console at the moment but might not always be true.
if (ConsoleUtil.TryParseConsoleFloat(MainConsole.Instance, options["client-rot-upd"], out newValue))
m_scene.ClientRotationUpdateTolerance = newValue;
}
if (options.ContainsKey("client-vel-upd"))
{
float newValue;
// FIXME: This can only come from the console at the moment but might not always be true.
if (ConsoleUtil.TryParseConsoleFloat(MainConsole.Instance, options["client-vel-upd"], out newValue))
m_scene.ClientVelocityUpdateTolerance = newValue;
} }
if (options.ContainsKey("pbackup")) if (options.ContainsKey("pbackup"))