From c155099faf9db4a8dd438be2ddd8a2272b85477a Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Sun, 22 Nov 2009 19:26:00 -0500 Subject: * The client prevents the avatar from landing if the avatar is going above an unknown certain speed, so, add a speed check on the server. * This addresses the 'hump the prim' animation playing while you're moving forward full speed and pressing page down over a prim to land. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 0d1133f..d23d303 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -152,6 +152,8 @@ namespace OpenSim.Region.Framework.Scenes private Quaternion m_bodyRot= Quaternion.Identity; + private const int LAND_VELOCITYMAG_MAX = 12; + public bool IsRestrictedToRegion; public string JID = String.Empty; @@ -978,8 +980,8 @@ namespace OpenSim.Region.Framework.Scenes public void StopFlying() { // It turns out to get the agent to stop flying, you have to feed it stop flying velocities - // and send a full object update. - // There's no message to send the client to tell it to stop flying + // There's no explicit message to send the client to tell it to stop flying.. it relies on the + // velocity, collision plane and avatar height // Add 1/6 the avatar's height to it's position so it doesn't shoot into the air // when the avatar stands up @@ -993,8 +995,6 @@ namespace OpenSim.Region.Framework.Scenes AbsolutePosition = AbsolutePosition + new Vector3(0f, 0f, (1.56f / 6f)); } - Animator.TrySetMovementAnimation("LAND"); - //SendFullUpdateToAllClients(); ControllingClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, AbsolutePosition, Velocity, Vector3.Zero, m_bodyRot, new Vector4(0,0,1,AbsolutePosition.Z - 0.5f), m_uuid, null, GetUpdatePriority(ControllingClient))); } @@ -1431,6 +1431,8 @@ namespace OpenSim.Region.Framework.Scenes // Only do this if we're flying if (m_physicsActor != null && m_physicsActor.Flying && !m_forceFly) { + // Landing detection code + // Are the landing controls requirements filled? bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); @@ -1440,7 +1442,10 @@ namespace OpenSim.Region.Framework.Scenes if (m_physicsActor.Flying && colliding && controlland) { - StopFlying(); + // nesting this check because LengthSquared() is expensive and we don't + // want to do it every step when flying. + if ((Velocity.LengthSquared() <= LAND_VELOCITYMAG_MAX)) + StopFlying(); } } -- cgit v1.1