From ea28985d05160127a96184c2c9ac0ed94101a20b Mon Sep 17 00:00:00 2001 From: gareth Date: Sun, 4 Mar 2007 19:12:07 +0000 Subject: Added MW's fix for smooth movement --- src/world/Avatar.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/world/Avatar.cs b/src/world/Avatar.cs index fbd78b7..6dcc1dd 100644 --- a/src/world/Avatar.cs +++ b/src/world/Avatar.cs @@ -145,13 +145,17 @@ namespace OpenSim.world Array.Copy(pb, 0, bytes, i, pb.Length); i += 12; + ushort ac = 32767; - bytes[i++] = (byte)(ac % 256); // avatar.InternVelocityX - bytes[i++] = (byte)((ac>> 8) % 256); - bytes[i++] = (byte)(ac % 256); // avatar.InternVelocityY - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); // avatar.InternVelocityZ - bytes[i++] = (byte)((ac >> 8) % 256); + bytes[i++] = (byte)((ushort)(((this.velocity.X/128f)+1)*32767) % 256 ); + bytes[i++] = (byte)(((ushort)(((this.velocity.X/128f)+1)*32767) >> 8) % 256); + bytes[i++] = (byte)((ushort)(((this.velocity.Y/128f)+1)*32767) % 256); + bytes[i++] = (byte)(((ushort)(((this.velocity.Y/128f)+1)*32767) >> 8) % 256); + bytes[i++] = (byte)((ushort)(((this.velocity.Z/128f)+1)*32767) % 256); + bytes[i++] = (byte)(((ushort)(((this.velocity.Z/128f)+1)*32767) >> 8) % 256); + + + //accel bytes[i++] = (byte)(ac % 256); -- cgit v1.1