From 412d7e098c424745c0c2ae1a6526c5b5d58b3180 Mon Sep 17 00:00:00 2001 From: gareth Date: Sun, 4 Mar 2007 01:57:52 +0000 Subject: Fixed up bugs from patch in PREV: Slow movement of avatar FIXED Constant TerseObjectUpdates FIXED Moving out of sim FIXED --- src/world/Avatar.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/world/Avatar.cs') diff --git a/src/world/Avatar.cs b/src/world/Avatar.cs index 68606c4..fbd78b7 100644 --- a/src/world/Avatar.cs +++ b/src/world/Avatar.cs @@ -13,7 +13,10 @@ namespace OpenSim.world public string firstname; public string lastname; public OpenSimClient ControllingClient; + public LLVector3 oldvel; + public LLVector3 oldpos; public uint CurrentKeyMask; + public bool walking; private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; @@ -30,18 +33,22 @@ namespace OpenSim.world base.update(); Console.WriteLine("KeyMask: " + this.CurrentKeyMask); - + + oldvel=this.velocity; + oldpos=this.position; if((this.CurrentKeyMask & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) != 0) { Vector3 tmpVelocity = this.rotation * new Vector3(1.0f,0.0f,0.0f); - tmpVelocity.Normalize(); tmpVelocity = tmpVelocity * 0.3f; + tmpVelocity.Normalize(); tmpVelocity = tmpVelocity * 0.5f; this.velocity.X = tmpVelocity.x; this.velocity.Y = tmpVelocity.y; this.velocity.Z = tmpVelocity.z; Console.WriteLine("Walking at "+ this.velocity.ToString()); + this.walking=true; } else { this.velocity.X=0; this.velocity.Y=0; this.velocity.Z=0; + this.walking=false; } } } @@ -238,10 +245,8 @@ namespace OpenSim.world public void HandleAgentUpdate(AgentUpdatePacket update) { lock(this) { - // FIXME: shouldn't update these direction - this.rotation = new Quaternion(update.AgentData.BodyRotation.W, update.AgentData.BodyRotation.X, update.AgentData.BodyRotation.Y, update.AgentData.BodyRotation.Z); - this.CurrentKeyMask = update.AgentData.ControlFlags; + this.rotation = new Quaternion(update.AgentData.BodyRotation.W, update.AgentData.BodyRotation.X, update.AgentData.BodyRotation.Y, update.AgentData.BodyRotation.Z); this.needupdate = true; } } -- cgit v1.1