From 9e9dad1cde362de093d0d7e6c3e247ff00ceac96 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Thu, 8 Nov 2007 00:10:40 +0000 Subject: * Added Rotational Velocity reporting for Client Interpolation to Terse Updates * Added Angular Velocity reporting for smooth-ish rotations on object collisions --- OpenSim/Region/ClientStack/ClientView.API.cs | 33 +++++++++++++++++++--------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/ClientStack/ClientView.API.cs') diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index bbe07d2..14e1b39 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -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 /// 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; -- cgit v1.1