diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.API.cs | 43 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 38 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | 6 |
3 files changed, 73 insertions, 14 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 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 535e765..1852ba7 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -235,7 +235,22 @@ namespace OpenSim.Region.Environment.Scenes | |||
235 | /// <summary></summary> | 235 | /// <summary></summary> |
236 | public LLVector3 Velocity | 236 | public LLVector3 Velocity |
237 | { | 237 | { |
238 | get { return m_velocity; } | 238 | get { |
239 | //if (PhysActor.Velocity.x != 0 || PhysActor.Velocity.y != 0 | ||
240 | //|| PhysActor.Velocity.z != 0) | ||
241 | //{ | ||
242 | if (PhysActor != null) | ||
243 | { | ||
244 | if (PhysActor.IsPhysical) | ||
245 | { | ||
246 | m_velocity.X = PhysActor.Velocity.X; | ||
247 | m_velocity.Y = PhysActor.Velocity.Y; | ||
248 | m_velocity.Z = PhysActor.Velocity.Z; | ||
249 | } | ||
250 | } | ||
251 | |||
252 | return m_velocity; | ||
253 | } | ||
239 | set { m_velocity = value; } | 254 | set { m_velocity = value; } |
240 | } | 255 | } |
241 | 256 | ||
@@ -995,13 +1010,28 @@ namespace OpenSim.Region.Environment.Scenes | |||
995 | LLVector3 lPos; | 1010 | LLVector3 lPos; |
996 | lPos = OffsetPosition; | 1011 | lPos = OffsetPosition; |
997 | LLQuaternion mRot = RotationOffset; | 1012 | LLQuaternion mRot = RotationOffset; |
998 | remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); | 1013 | if ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) == 0) |
1014 | { | ||
1015 | remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); | ||
1016 | } | ||
1017 | else | ||
1018 | { | ||
1019 | remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity); | ||
1020 | } | ||
999 | } | 1021 | } |
1000 | 1022 | ||
1001 | public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos) | 1023 | public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos) |
1002 | { | 1024 | { |
1003 | LLQuaternion mRot = RotationOffset; | 1025 | LLQuaternion mRot = RotationOffset; |
1004 | remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); | 1026 | if ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) == 0) |
1027 | { | ||
1028 | remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); | ||
1029 | } | ||
1030 | else | ||
1031 | { | ||
1032 | remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity); | ||
1033 | //System.Console.WriteLine("Vel:" + Velocity); | ||
1034 | } | ||
1005 | } | 1035 | } |
1006 | 1036 | ||
1007 | #endregion | 1037 | #endregion |
@@ -1113,4 +1143,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
1113 | } | 1143 | } |
1114 | } | 1144 | } |
1115 | } | 1145 | } |
1116 | } \ No newline at end of file | 1146 | } |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 9ed1f35..e7a09ac 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -281,6 +281,10 @@ namespace SimpleApp | |||
281 | LLVector3 position, LLQuaternion rotation) | 281 | LLVector3 position, LLQuaternion rotation) |
282 | { | 282 | { |
283 | } | 283 | } |
284 | public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, | ||
285 | LLVector3 position, LLQuaternion rotation,LLVector3 velocity) | ||
286 | { | ||
287 | } | ||
284 | 288 | ||
285 | public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items) | 289 | public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items) |
286 | { | 290 | { |
@@ -430,4 +434,4 @@ namespace SimpleApp | |||
430 | { | 434 | { |
431 | } | 435 | } |
432 | } | 436 | } |
433 | } \ No newline at end of file | 437 | } |