* Added Rotational Velocity reporting for Client Interpolation to Terse Updates

* Added Angular Velocity reporting for smooth-ish rotations on object collisions
This commit is contained in:
Teravus Ovares
2007-11-08 00:10:40 +00:00
parent 08701ee7fc
commit 9e9dad1cde
10 changed files with 130 additions and 30 deletions

View File

@@ -1062,23 +1062,24 @@ namespace OpenSim.Region.ClientStack
LLQuaternion rotation)
{
LLVector3 velocity = new LLVector3(0f,0f,0f);
LLVector3 rotationalvelocity = new LLVector3(0f,0f,0f);
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
terse.RegionData.RegionHandle = regionHandle;
terse.RegionData.TimeDilation = timeDilation;
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity);
terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity, rotationalvelocity);
OutPacket(terse);
}
public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
LLQuaternion rotation, LLVector3 velocity)
LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity)
{
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
terse.RegionData.RegionHandle = regionHandle;
terse.RegionData.TimeDilation = timeDilation;
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity);
terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity, rotationalvelocity);
OutPacket(terse);
}
@@ -1184,7 +1185,7 @@ namespace OpenSim.Region.ClientStack
/// <returns></returns>
protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID,
LLVector3 position,
LLQuaternion rotation, LLVector3 velocity)
LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity)
{
uint ID = localID;
byte[] bytes = new byte[60];
@@ -1248,12 +1249,24 @@ namespace OpenSim.Region.ClientStack
bytes[i++] = (byte) ((rw >> 8)%256);
//rotation vel
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 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);
dat.Data = bytes;
return dat;