Applying Teravus patch # 557. Some glue code for the updating of prim's velocity.
parent
039f2c46c0
commit
e50a2e2ce2
|
@ -414,6 +414,8 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
|
void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
|
||||||
LLQuaternion rotation);
|
LLQuaternion rotation);
|
||||||
|
void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
|
||||||
|
LLQuaternion rotation,LLVector3 velocity);
|
||||||
|
|
||||||
void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items);
|
void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items);
|
||||||
void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item);
|
void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item);
|
||||||
|
@ -444,4 +446,4 @@ namespace OpenSim.Framework
|
||||||
event Action<IClientAPI> OnConnectionClosed;
|
event Action<IClientAPI> OnConnectionClosed;
|
||||||
void SendLogoutPacket();
|
void SendLogoutPacket();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1049,14 +1049,28 @@ namespace OpenSim.Region.ClientStack
|
||||||
public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
|
public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
|
||||||
LLQuaternion rotation)
|
LLQuaternion rotation)
|
||||||
{
|
{
|
||||||
|
LLVector3 velocity = new LLVector3(0f,0f,0f);
|
||||||
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
|
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
|
||||||
terse.RegionData.RegionHandle = regionHandle;
|
terse.RegionData.RegionHandle = regionHandle;
|
||||||
terse.RegionData.TimeDilation = timeDilation;
|
terse.RegionData.TimeDilation = timeDilation;
|
||||||
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation);
|
terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity);
|
||||||
|
|
||||||
OutPacket(terse);
|
OutPacket(terse);
|
||||||
}
|
}
|
||||||
|
public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
|
||||||
|
LLQuaternion rotation, LLVector3 velocity)
|
||||||
|
{
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
OutPacket(terse);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -1158,7 +1172,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID,
|
protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID,
|
||||||
LLVector3 position,
|
LLVector3 position,
|
||||||
LLQuaternion rotation)
|
LLQuaternion rotation, LLVector3 velocity)
|
||||||
{
|
{
|
||||||
uint ID = localID;
|
uint ID = localID;
|
||||||
byte[] bytes = new byte[60];
|
byte[] bytes = new byte[60];
|
||||||
|
@ -1178,13 +1192,24 @@ namespace OpenSim.Region.ClientStack
|
||||||
i += 12;
|
i += 12;
|
||||||
ushort ac = 32767;
|
ushort ac = 32767;
|
||||||
|
|
||||||
|
ushort velx, vely, velz;
|
||||||
|
Vector3 vel = new Vector3(velocity.X, velocity.Y, velocity.Z);
|
||||||
|
|
||||||
|
vel = vel/128.0f;
|
||||||
|
vel.x += 1;
|
||||||
|
vel.y += 1;
|
||||||
|
vel.z += 1;
|
||||||
//vel
|
//vel
|
||||||
bytes[i++] = (byte) (ac%256);
|
velx = (ushort)(32768 * (vel.x));
|
||||||
bytes[i++] = (byte) ((ac >> 8)%256);
|
vely = (ushort)(32768 * (vel.y));
|
||||||
bytes[i++] = (byte) (ac%256);
|
velz = (ushort)(32768 * (vel.z));
|
||||||
bytes[i++] = (byte) ((ac >> 8)%256);
|
|
||||||
bytes[i++] = (byte) (ac%256);
|
bytes[i++] = (byte) (velx % 256);
|
||||||
bytes[i++] = (byte) ((ac >> 8)%256);
|
bytes[i++] = (byte) ((velx >> 8) % 256);
|
||||||
|
bytes[i++] = (byte) (vely % 256);
|
||||||
|
bytes[i++] = (byte) ((vely >> 8) % 256);
|
||||||
|
bytes[i++] = (byte) (velz % 256);
|
||||||
|
bytes[i++] = (byte) ((velz >> 8) % 256);
|
||||||
|
|
||||||
//accel
|
//accel
|
||||||
bytes[i++] = (byte) (ac%256);
|
bytes[i++] = (byte) (ac%256);
|
||||||
|
@ -1372,4 +1397,4 @@ namespace OpenSim.Region.ClientStack
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,7 +235,22 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <summary></summary>
|
/// <summary></summary>
|
||||||
public LLVector3 Velocity
|
public LLVector3 Velocity
|
||||||
{
|
{
|
||||||
get { return m_velocity; }
|
get {
|
||||||
|
//if (PhysActor.Velocity.x != 0 || PhysActor.Velocity.y != 0
|
||||||
|
//|| PhysActor.Velocity.z != 0)
|
||||||
|
//{
|
||||||
|
if (PhysActor != null)
|
||||||
|
{
|
||||||
|
if (PhysActor.IsPhysical)
|
||||||
|
{
|
||||||
|
m_velocity.X = PhysActor.Velocity.X;
|
||||||
|
m_velocity.Y = PhysActor.Velocity.Y;
|
||||||
|
m_velocity.Z = PhysActor.Velocity.Z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_velocity;
|
||||||
|
}
|
||||||
set { m_velocity = value; }
|
set { m_velocity = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -995,13 +1010,28 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
LLVector3 lPos;
|
LLVector3 lPos;
|
||||||
lPos = OffsetPosition;
|
lPos = OffsetPosition;
|
||||||
LLQuaternion mRot = RotationOffset;
|
LLQuaternion mRot = RotationOffset;
|
||||||
remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot);
|
if ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) == 0)
|
||||||
|
{
|
||||||
|
remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos)
|
public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos)
|
||||||
{
|
{
|
||||||
LLQuaternion mRot = RotationOffset;
|
LLQuaternion mRot = RotationOffset;
|
||||||
remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot);
|
if ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) == 0)
|
||||||
|
{
|
||||||
|
remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity);
|
||||||
|
//System.Console.WriteLine("Vel:" + Velocity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -1113,4 +1143,4 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,6 +281,10 @@ namespace SimpleApp
|
||||||
LLVector3 position, LLQuaternion rotation)
|
LLVector3 position, LLQuaternion rotation)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID,
|
||||||
|
LLVector3 position, LLQuaternion rotation,LLVector3 velocity)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items)
|
public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items)
|
||||||
{
|
{
|
||||||
|
@ -430,4 +434,4 @@ namespace SimpleApp
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue