From b81c829576dd916c0a7bf141919f5e13f025d818 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 28 Oct 2009 14:13:17 -0700 Subject: * Standalone logins will now go through the sequence of "requested region, default region, any region" before giving up * Hip offset should have been added not subtracted (it's a negative offset). This puts avatar feet closer to the ground * Improved duplicate checking for terse updates. This should reduce bandwidth and walking through walls --- .../Hypergrid/HGStandaloneLoginModule.cs | 6 +++++- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 15 ++++++++------- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 21 ++++++++++++--------- 3 files changed, 25 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs index 4199c98..46ee3c0 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs @@ -193,6 +193,10 @@ namespace OpenSim.Region.CoreModules.Hypergrid { return scene.RegionInfo; } + else if (m_scenes.Count > 0) + { + return m_scenes[0].RegionInfo; + } return null; } @@ -248,7 +252,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid { foreach (Scene nextScene in m_scenes) { - if (nextScene.RegionInfo.RegionName == regionName) + if (nextScene.RegionInfo.RegionName.Equals(regionName, StringComparison.InvariantCultureIgnoreCase)) { scene = nextScene; return true; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a99a802..c16c4fe 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2394,18 +2394,19 @@ if (m_shape != null) { /// public void SendScheduledUpdates() { - const float VELOCITY_TOLERANCE = 0.0001f; - const float POSITION_TOLERANCE = 0.1f; + const float ROTATION_TOLERANCE = 0.01f; + const float VELOCITY_TOLERANCE = 0.001f; + const float POSITION_TOLERANCE = 0.05f; const int TIME_MS_TOLERANCE = 3000; if (m_updateFlag == 1) { // Throw away duplicate or insignificant updates - if (RotationOffset != m_lastRotation || - Acceleration != m_lastAcceleration || - (Velocity - m_lastVelocity).Length() > VELOCITY_TOLERANCE || - (RotationalVelocity - m_lastAngularVelocity).Length() > VELOCITY_TOLERANCE || - (OffsetPosition - m_lastPosition).Length() > POSITION_TOLERANCE || + if (!RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || + !Acceleration.Equals(m_lastAcceleration) || + !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || + !RotationalVelocity.ApproxEquals(m_lastAngularVelocity, VELOCITY_TOLERANCE) || + !OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) { AddTerseUpdateToAllAvatars(); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9ba19d3..63c979f 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2362,8 +2362,9 @@ namespace OpenSim.Region.Framework.Scenes public override void Update() { - const float VELOCITY_TOLERANCE = 0.0001f; - const float POSITION_TOLERANCE = 10.0f; + const float ROTATION_TOLERANCE = 0.01f; + const float VELOCITY_TOLERANCE = 0.001f; + const float POSITION_TOLERANCE = 0.05f; const int TIME_MS_TOLERANCE = 3000; SendPrimUpdates(); @@ -2377,9 +2378,9 @@ namespace OpenSim.Region.Framework.Scenes if (m_isChildAgent == false) { // Throw away duplicate or insignificant updates - if (m_bodyRot != m_lastRotation || - (m_velocity - m_lastVelocity).Length() > VELOCITY_TOLERANCE || - (m_pos - m_lastPosition).Length() > POSITION_TOLERANCE || + if (!m_bodyRot.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || + !m_velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || + !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) { SendTerseUpdateToAllClients(); @@ -2415,7 +2416,9 @@ namespace OpenSim.Region.Framework.Scenes m_perfMonMS = Environment.TickCount; Vector3 pos = m_pos; - pos.Z -= m_appearance.HipOffset; + pos.Z += m_appearance.HipOffset; + + //m_log.DebugFormat("[SCENEPRESENCE]: TerseUpdate: Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity); remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, pos, m_velocity, Vector3.Zero, m_bodyRot, Vector4.UnitW, m_uuid, null, GetUpdatePriority(remoteClient))); @@ -2514,7 +2517,7 @@ namespace OpenSim.Region.Framework.Scenes return; Vector3 pos = m_pos; - pos.Z -= m_appearance.HipOffset; + pos.Z += m_appearance.HipOffset; remoteAvatar.m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId, pos, m_appearance.Texture.GetBytes(), @@ -2585,7 +2588,7 @@ namespace OpenSim.Region.Framework.Scenes // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); Vector3 pos = m_pos; - pos.Z -= m_appearance.HipOffset; + pos.Z += m_appearance.HipOffset; m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId, pos, m_appearance.Texture.GetBytes(), m_parentID, m_bodyRot)); @@ -2694,7 +2697,7 @@ namespace OpenSim.Region.Framework.Scenes } Vector3 pos = m_pos; - pos.Z -= m_appearance.HipOffset; + pos.Z += m_appearance.HipOffset; m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId, pos, m_appearance.Texture.GetBytes(), m_parentID, m_bodyRot)); -- cgit v1.1