Partial fix for the "avatars permanently facing east" - now the rotation

is set correctly, but only with the movement of the avatar.
The in-place rotation updates need a little bit of more thought,
and will be in a separate commit.
afrisby
Dalien Talbot 2007-09-08 16:30:39 +00:00
parent d91b1434fe
commit 3433f3814a
5 changed files with 28 additions and 16 deletions

View File

@ -215,7 +215,7 @@ namespace OpenSim.Framework.Interfaces
void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance);
void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry);
void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity);
void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation);
void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint);
void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem, LLQuaternion rotation);

View File

@ -136,7 +136,7 @@ namespace OpenSim.Framework
public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance){}
public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry){}
public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity){}
public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation){}
public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint){}
public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem, LLQuaternion rotation){}

View File

@ -929,9 +929,9 @@ namespace OpenSim.Region.ClientStack
/// <param name="localID"></param>
/// <param name="position"></param>
/// <param name="velocity"></param>
public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity)
public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation)
{
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = this.CreateAvatarImprovedBlock(localID, position, velocity);
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = this.CreateAvatarImprovedBlock(localID, position, velocity, rotation);
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
terse.RegionData.RegionHandle = regionHandle;
terse.RegionData.TimeDilation = timeDilation;
@ -1018,7 +1018,7 @@ namespace OpenSim.Region.ClientStack
#region Helper Methods
protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateAvatarImprovedBlock(uint localID, LLVector3 pos, LLVector3 velocity)
protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateAvatarImprovedBlock(uint localID, LLVector3 pos, LLVector3 velocity, LLQuaternion rotation)
{
byte[] bytes = new byte[60];
int i = 0;
@ -1073,15 +1073,22 @@ namespace OpenSim.Region.ClientStack
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
//rotation
ushort rw, rx, ry, rz;
rw = (ushort)(32768 * (rotation.W + 1));
rx = (ushort)(32768 * (rotation.X + 1));
ry = (ushort)(32768 * (rotation.Y + 1));
rz = (ushort)(32768 * (rotation.Z + 1));
//rot
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);
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
bytes[i++] = (byte)(rx % 256);
bytes[i++] = (byte)((rx >> 8) % 256);
bytes[i++] = (byte)(ry % 256);
bytes[i++] = (byte)((ry >> 8) % 256);
bytes[i++] = (byte)(rz % 256);
bytes[i++] = (byte)((rz >> 8) % 256);
bytes[i++] = (byte)(rw % 256);
bytes[i++] = (byte)((rw >> 8) % 256);
//rotation vel
bytes[i++] = (byte)(ac % 256);

View File

@ -372,7 +372,7 @@ namespace OpenSim.Region.Environment.Scenes
{
this.bodyRot = q;
update_rotation = true;
}
}
foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags)))
{
if ((flags & (uint)DCF) != 0)
@ -495,7 +495,12 @@ namespace OpenSim.Region.Environment.Scenes
{
LLVector3 pos = this.AbsolutePosition;
LLVector3 vel = this.Velocity;
RemoteClient.SendAvatarTerseUpdate(this.m_regionHandle, 64096, this.LocalId, new LLVector3(pos.X, pos.Y, pos.Z), new LLVector3(vel.X, vel.Y, vel.Z));
LLQuaternion rot;
rot.X = this.bodyRot.x;
rot.Y = this.bodyRot.y;
rot.Z = this.bodyRot.z;
rot.W = this.bodyRot.w;
RemoteClient.SendAvatarTerseUpdate(this.m_regionHandle, 64096, this.LocalId, new LLVector3(pos.X, pos.Y, pos.Z), new LLVector3(vel.X, vel.Y, vel.Z), rot);
}
/// <summary>

View File

@ -153,7 +153,7 @@ namespace SimpleApp
public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) { }
public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry) { }
public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity) { }
public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation) { }
public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) { }