aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs89
1 files changed, 85 insertions, 4 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 6fe5cc9..580b983 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -2069,7 +2069,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2069 2069
2070 public void SendPrimitiveToClient( 2070 public void SendPrimitiveToClient(
2071 ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, 2071 ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape,
2072 LLVector3 pos, LLVector3 vel, LLVector3 acc, LLQuaternion rotation, LLVector3 rvel, 2072 LLVector3 pos, LLVector3 velocity, LLVector3 acceleration, LLQuaternion rotation, LLVector3 rotationalvelocity,
2073 uint flags, 2073 uint flags,
2074 LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, 2074 LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem,
2075 byte clickAction, byte[] textureanim, bool attachment, uint AttachPoint, LLUUID AssetId) 2075 byte clickAction, byte[] textureanim, bool attachment, uint AttachPoint, LLUUID AssetId)
@@ -2118,11 +2118,92 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2118 // Sound Radius 2118 // Sound Radius
2119 outPacket.ObjectData[0].Radius = 20; 2119 outPacket.ObjectData[0].Radius = 20;
2120 2120
2121 int i = 0;
2122 byte[] bytes = new byte[60];
2121 byte[] pb = pos.GetBytes(); 2123 byte[] pb = pos.GetBytes();
2122 Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); 2124 Array.Copy(pb, 0, bytes, i, pb.Length);
2125 i += 12;
2126 // TODO: this code sucks, and also exists in TerseUpdate.
2127 // Someone should clean it up.
2128
2129 ushort velx, vely, velz;
2130 Vector3 vel = new Vector3(velocity.X, velocity.Y, velocity.Z);
2131
2132 vel = vel / 128.0f;
2133 vel.x += 1;
2134 vel.y += 1;
2135 vel.z += 1;
2136 //vel
2137 velx = (ushort)(32768 * (vel.x));
2138 vely = (ushort)(32768 * (vel.y));
2139 velz = (ushort)(32768 * (vel.z));
2140
2141 bytes[i++] = (byte)(velx % 256);
2142 bytes[i++] = (byte)((velx >> 8) % 256);
2143 bytes[i++] = (byte)(vely % 256);
2144 bytes[i++] = (byte)((vely >> 8) % 256);
2145 bytes[i++] = (byte)(velz % 256);
2146 bytes[i++] = (byte)((velz >> 8) % 256);
2147
2148 //accel
2149 ushort accx, accy, accz;
2150 Vector3 acc = new Vector3(acceleration.X, acceleration.Y, acceleration.Z);
2151 acc = acc / 128.0f;
2152 acc.x += 1;
2153 acc.y += 1;
2154 acc.z += 1;
2155 accx = (ushort)(32768 * (acc.x));
2156 accy = (ushort)(32768 * (acc.y));
2157 accz = (ushort)(32768 * (acc.z));
2158
2159 bytes[i++] = (byte)(accx % 256);
2160 bytes[i++] = (byte)((accx >> 8) % 256);
2161 bytes[i++] = (byte)(accy % 256);
2162 bytes[i++] = (byte)((accy >> 8) % 256);
2163 bytes[i++] = (byte)(accz % 256);
2164 bytes[i++] = (byte)((accz >> 8) % 256);
2165
2166 ushort rw, rx, ry, rz;
2167 rw = (ushort)(32768 * (rotation.W + 1));
2168 rx = (ushort)(32768 * (rotation.X + 1));
2169 ry = (ushort)(32768 * (rotation.Y + 1));
2170 rz = (ushort)(32768 * (rotation.Z + 1));
2171
2172 //rot
2173 bytes[i++] = (byte)(rx % 256);
2174 bytes[i++] = (byte)((rx >> 8) % 256);
2175 bytes[i++] = (byte)(ry % 256);
2176 bytes[i++] = (byte)((ry >> 8) % 256);
2177 bytes[i++] = (byte)(rz % 256);
2178 bytes[i++] = (byte)((rz >> 8) % 256);
2179 bytes[i++] = (byte)(rw % 256);
2180 bytes[i++] = (byte)((rw >> 8) % 256);
2181
2182 //rotation vel
2183 ushort rvelx, rvely, rvelz;
2184 Vector3 rvel = new Vector3(rotationalvelocity.X, rotationalvelocity.Y, rotationalvelocity.Z);
2185
2186 rvel = rvel / 128.0f;
2187 rvel.x += 1;
2188 rvel.y += 1;
2189 rvel.z += 1;
2190 //vel
2191 rvelx = (ushort)(32768 * (rvel.x));
2192 rvely = (ushort)(32768 * (rvel.y));
2193 rvelz = (ushort)(32768 * (rvel.z));
2194
2195 bytes[i++] = (byte)(rvelx % 256);
2196 bytes[i++] = (byte)((rvelx >> 8) % 256);
2197 bytes[i++] = (byte)(rvely % 256);
2198 bytes[i++] = (byte)((rvely >> 8) % 256);
2199 bytes[i++] = (byte)(rvelz % 256);
2200 bytes[i++] = (byte)((rvelz >> 8) % 256);
2201
2202
2203 // byte[] rot = rotation.GetBytes();
2204 // Array.Copy(rot, 0, outPacket.ObjectData[0].ObjectData, 36, rot.Length);
2123 2205
2124 byte[] rot = rotation.GetBytes(); 2206 outPacket.ObjectData[0].ObjectData = bytes;
2125 Array.Copy(rot, 0, outPacket.ObjectData[0].ObjectData, 36, rot.Length);
2126 2207
2127 if (textureanim.Length > 0) 2208 if (textureanim.Length > 0)
2128 { 2209 {