From 4999b00294219ebdda7afd29b6d54ba2056cc161 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Wed, 7 May 2008 14:41:59 +0000 Subject: [PATCH] attempted fix of http://opensimulator.org/mantis/view.php?id=1166. This is currently untested and may result in weirdness. Beware this changeset. --- .../ClientStack/LindenUDP/LLClientView.cs | 105 +++++++++++------- 1 file changed, 62 insertions(+), 43 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index d183f4aa21..95801b9b3e 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -2601,37 +2601,50 @@ namespace OpenSim.Region.ClientStack.LindenUDP bytes[i++] = state; bytes[i++] = 0; - byte[] pb = position.GetBytes(); - Array.Copy(pb, 0, bytes, i, pb.Length); + byte[] buff = position.GetBytes(); + Array.Copy(buff, 0, bytes, i, buff.Length); i += 12; - ushort ac = 32767; - ushort velx, vely, velz; - Vector3 vel = new Vector3(velocity.X, velocity.Y, velocity.Z); + buff = velocity.GetBytes(); + Array.Copy(buff, 0, bytes, i, buff.Length); + i += 12; + + // this should be real value + LLVector3 accel = new LLVector3(0, 0 ,0); + buff = accel.GetBytes(); + Array.Copy(buff, 0, bytes, i, buff.Length); + i += 12; - vel = vel / 128.0f; - vel.x += 1; - vel.y += 1; - vel.z += 1; - //vel - velx = (ushort)(32768 * (vel.x)); - vely = (ushort)(32768 * (vel.y)); - velz = (ushort)(32768 * (vel.z)); + - bytes[i++] = (byte)(velx % 256); - bytes[i++] = (byte)((velx >> 8) % 256); - bytes[i++] = (byte)(vely % 256); - bytes[i++] = (byte)((vely >> 8) % 256); - bytes[i++] = (byte)(velz % 256); - bytes[i++] = (byte)((velz >> 8) % 256); + // ushort ac = 32767; - //accel - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); + // ushort velx, vely, velz; + // Vector3 vel = new Vector3(velocity.X, velocity.Y, velocity.Z); + + // vel = vel / 128.0f; + // vel.x += 1; + // vel.y += 1; + // vel.z += 1; + // //vel + // velx = (ushort)(32768 * (vel.x)); + // vely = (ushort)(32768 * (vel.y)); + // velz = (ushort)(32768 * (vel.z)); + + // bytes[i++] = (byte)(velx % 256); + // bytes[i++] = (byte)((velx >> 8) % 256); + // bytes[i++] = (byte)(vely % 256); + // bytes[i++] = (byte)((vely >> 8) % 256); + // bytes[i++] = (byte)(velz % 256); + // bytes[i++] = (byte)((velz >> 8) % 256); + + // //accel + // bytes[i++] = (byte)(ac % 256); + // bytes[i++] = (byte)((ac >> 8) % 256); + // bytes[i++] = (byte)(ac % 256); + // bytes[i++] = (byte)((ac >> 8) % 256); + // bytes[i++] = (byte)(ac % 256); + // bytes[i++] = (byte)((ac >> 8) % 256); ushort rw, rx, ry, rz; rw = (ushort)(32768 * (rotation.W + 1)); @@ -2649,25 +2662,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP bytes[i++] = (byte)(rw % 256); bytes[i++] = (byte)((rw >> 8) % 256); - //rotation vel - ushort rvelx, rvely, rvelz; - Vector3 rvel = new Vector3(rotationalvelocity.X, rotationalvelocity.Y, rotationalvelocity.Z); + // //rotation vel + // ushort rvelx, rvely, rvelz; + // Vector3 rvel = new Vector3(rotationalvelocity.X, rotationalvelocity.Y, rotationalvelocity.Z); + + // rvel = rvel / 128.0f; + // rvel.x += 1; + // rvel.y += 1; + // rvel.z += 1; + // //vel + // rvelx = (ushort)(32768 * (rvel.x)); + // rvely = (ushort)(32768 * (rvel.y)); + // rvelz = (ushort)(32768 * (rvel.z)); + + // bytes[i++] = (byte)(rvelx % 256); + // bytes[i++] = (byte)((rvelx >> 8) % 256); + // bytes[i++] = (byte)(rvely % 256); + // bytes[i++] = (byte)((rvely >> 8) % 256); + // bytes[i++] = (byte)(rvelz % 256); + // bytes[i++] = (byte)((rvelz >> 8) % 256); + + buff = rotationalvelocity.GetBytes(); + Array.Copy(buff, 0, bytes, i, buff.Length); + i += 12; - rvel = rvel / 128.0f; - rvel.x += 1; - rvel.y += 1; - rvel.z += 1; - //vel - rvelx = (ushort)(32768 * (rvel.x)); - rvely = (ushort)(32768 * (rvel.y)); - rvelz = (ushort)(32768 * (rvel.z)); - bytes[i++] = (byte)(rvelx % 256); - bytes[i++] = (byte)((rvelx >> 8) % 256); - bytes[i++] = (byte)(rvely % 256); - bytes[i++] = (byte)((rvely >> 8) % 256); - bytes[i++] = (byte)(rvelz % 256); - bytes[i++] = (byte)((rvelz >> 8) % 256); dat.Data = bytes;