From 99f2a1c347f2c97007a467e76c1455c9a54b3c26 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Fri, 11 Jun 2010 21:46:01 -0400 Subject: * Tweak the StopFlying() method in LLClientView to fabricate a suitable landing collision plane regardless of the actual physics situation. position.Z - AvatarHeight / 6f --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 57 ++++++++++++++-------- 1 file changed, 36 insertions(+), 21 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 85a3133..cdd22de 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -11846,38 +11846,53 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void StopFlying(ISceneEntity p) { - ScenePresence presence = p as ScenePresence; - // It turns out to get the agent to stop flying, you have to feed it stop flying velocities - // 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 + if (p is ScenePresence) + { + ScenePresence presence = p as ScenePresence; + // It turns out to get the agent to stop flying, you have to feed it stop flying velocities + // 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 + // Add 1/6 the avatar's height to it's position so it doesn't shoot into the air + // when the avatar stands up - Vector3 pos = presence.AbsolutePosition; + Vector3 pos = presence.AbsolutePosition; - if (presence.Appearance.AvatarHeight != 127.0f) - pos += new Vector3(0f, 0f, (presence.Appearance.AvatarHeight / 6f)); - else - pos += new Vector3(0f, 0f, (1.56f / 6f)); + if (presence.Appearance.AvatarHeight != 127.0f) + pos += new Vector3(0f, 0f, (presence.Appearance.AvatarHeight/6f)); + else + pos += new Vector3(0f, 0f, (1.56f/6f)); + + presence.AbsolutePosition = pos; + + // attach a suitable collision plane regardless of the actual situation to force the LLClient to land. + // Collision plane below the avatar's position a 6th of the avatar's height is suitable. + // Mind you, that this method doesn't get called if the avatar's velocity magnitude is greater then a + // certain amount.. because the LLClient wouldn't land in that situation anyway. + + // why are we still testing for this really old height value default??? + if (presence.Appearance.AvatarHeight != 127.0f) + presence.CollisionPlane = new Vector4(0, 0, 0, pos.Z - presence.Appearance.AvatarHeight/6f); + else + presence.CollisionPlane = new Vector4(0, 0, 0, pos.Z - (1.56f/6f)); - presence.AbsolutePosition = pos; - ImprovedTerseObjectUpdatePacket.ObjectDataBlock block = + ImprovedTerseObjectUpdatePacket.ObjectDataBlock block = CreateImprovedTerseBlock(p, false); - const float TIME_DILATION = 1.0f; - ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f); + const float TIME_DILATION = 1.0f; + ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f); - ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); - packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; - packet.RegionData.TimeDilation = timeDilation; - packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; + ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); + packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; + packet.RegionData.TimeDilation = timeDilation; + packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; - packet.ObjectData[0] = block; + packet.ObjectData[0] = block; - OutPacket(packet, ThrottleOutPacketType.Task, true); + OutPacket(packet, ThrottleOutPacketType.Task, true); + } //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))); -- cgit v1.1