diff options
Applying Teravus patch # 557. Some glue code for the updating of prim's velocity.
Diffstat (limited to 'OpenSim/Region/ClientStack/ClientView.API.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.API.cs | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 83b4cbc..b02fcf6 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs | |||
@@ -1049,14 +1049,28 @@ namespace OpenSim.Region.ClientStack | |||
1049 | public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, | 1049 | public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, |
1050 | LLQuaternion rotation) | 1050 | LLQuaternion rotation) |
1051 | { | 1051 | { |
1052 | LLVector3 velocity = new LLVector3(0f,0f,0f); | ||
1052 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | 1053 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); |
1053 | terse.RegionData.RegionHandle = regionHandle; | 1054 | terse.RegionData.RegionHandle = regionHandle; |
1054 | terse.RegionData.TimeDilation = timeDilation; | 1055 | terse.RegionData.TimeDilation = timeDilation; |
1055 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | 1056 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; |
1056 | terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation); | 1057 | terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity); |
1057 | 1058 | ||
1058 | OutPacket(terse); | 1059 | OutPacket(terse); |
1059 | } | 1060 | } |
1061 | public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, | ||
1062 | LLQuaternion rotation, LLVector3 velocity) | ||
1063 | { | ||
1064 | |||
1065 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | ||
1066 | terse.RegionData.RegionHandle = regionHandle; | ||
1067 | terse.RegionData.TimeDilation = timeDilation; | ||
1068 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
1069 | terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity); | ||
1070 | |||
1071 | OutPacket(terse); | ||
1072 | } | ||
1073 | |||
1060 | 1074 | ||
1061 | #endregion | 1075 | #endregion |
1062 | 1076 | ||
@@ -1158,7 +1172,7 @@ namespace OpenSim.Region.ClientStack | |||
1158 | /// <returns></returns> | 1172 | /// <returns></returns> |
1159 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID, | 1173 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID, |
1160 | LLVector3 position, | 1174 | LLVector3 position, |
1161 | LLQuaternion rotation) | 1175 | LLQuaternion rotation, LLVector3 velocity) |
1162 | { | 1176 | { |
1163 | uint ID = localID; | 1177 | uint ID = localID; |
1164 | byte[] bytes = new byte[60]; | 1178 | byte[] bytes = new byte[60]; |
@@ -1178,13 +1192,24 @@ namespace OpenSim.Region.ClientStack | |||
1178 | i += 12; | 1192 | i += 12; |
1179 | ushort ac = 32767; | 1193 | ushort ac = 32767; |
1180 | 1194 | ||
1195 | ushort velx, vely, velz; | ||
1196 | Vector3 vel = new Vector3(velocity.X, velocity.Y, velocity.Z); | ||
1197 | |||
1198 | vel = vel/128.0f; | ||
1199 | vel.x += 1; | ||
1200 | vel.y += 1; | ||
1201 | vel.z += 1; | ||
1181 | //vel | 1202 | //vel |
1182 | bytes[i++] = (byte) (ac%256); | 1203 | velx = (ushort)(32768 * (vel.x)); |
1183 | bytes[i++] = (byte) ((ac >> 8)%256); | 1204 | vely = (ushort)(32768 * (vel.y)); |
1184 | bytes[i++] = (byte) (ac%256); | 1205 | velz = (ushort)(32768 * (vel.z)); |
1185 | bytes[i++] = (byte) ((ac >> 8)%256); | 1206 | |
1186 | bytes[i++] = (byte) (ac%256); | 1207 | bytes[i++] = (byte) (velx % 256); |
1187 | bytes[i++] = (byte) ((ac >> 8)%256); | 1208 | bytes[i++] = (byte) ((velx >> 8) % 256); |
1209 | bytes[i++] = (byte) (vely % 256); | ||
1210 | bytes[i++] = (byte) ((vely >> 8) % 256); | ||
1211 | bytes[i++] = (byte) (velz % 256); | ||
1212 | bytes[i++] = (byte) ((velz >> 8) % 256); | ||
1188 | 1213 | ||
1189 | //accel | 1214 | //accel |
1190 | bytes[i++] = (byte) (ac%256); | 1215 | bytes[i++] = (byte) (ac%256); |
@@ -1372,4 +1397,4 @@ namespace OpenSim.Region.ClientStack | |||
1372 | 1397 | ||
1373 | #endregion | 1398 | #endregion |
1374 | } | 1399 | } |
1375 | } \ No newline at end of file | 1400 | } |