aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorDalien Talbot2007-09-08 16:30:39 +0000
committerDalien Talbot2007-09-08 16:30:39 +0000
commit3433f3814acbed69b60f177576602a6cb6a3677c (patch)
tree2978745e09e36716b5948f2d956647b71803c75a /OpenSim/Region
parentAnother attempt at an i386 version of libode. If this doesn't test out for pe... (diff)
downloadopensim-SC_OLD-3433f3814acbed69b60f177576602a6cb6a3677c.zip
opensim-SC_OLD-3433f3814acbed69b60f177576602a6cb6a3677c.tar.gz
opensim-SC_OLD-3433f3814acbed69b60f177576602a6cb6a3677c.tar.bz2
opensim-SC_OLD-3433f3814acbed69b60f177576602a6cb6a3677c.tar.xz
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.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/ClientView.API.cs29
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs9
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs2
3 files changed, 26 insertions, 14 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs
index edc1268..c5a2284 100644
--- a/OpenSim/Region/ClientStack/ClientView.API.cs
+++ b/OpenSim/Region/ClientStack/ClientView.API.cs
@@ -929,9 +929,9 @@ namespace OpenSim.Region.ClientStack
929 /// <param name="localID"></param> 929 /// <param name="localID"></param>
930 /// <param name="position"></param> 930 /// <param name="position"></param>
931 /// <param name="velocity"></param> 931 /// <param name="velocity"></param>
932 public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity) 932 public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation)
933 { 933 {
934 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = this.CreateAvatarImprovedBlock(localID, position, velocity); 934 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = this.CreateAvatarImprovedBlock(localID, position, velocity, rotation);
935 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); 935 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
936 terse.RegionData.RegionHandle = regionHandle; 936 terse.RegionData.RegionHandle = regionHandle;
937 terse.RegionData.TimeDilation = timeDilation; 937 terse.RegionData.TimeDilation = timeDilation;
@@ -1018,7 +1018,7 @@ namespace OpenSim.Region.ClientStack
1018 1018
1019 #region Helper Methods 1019 #region Helper Methods
1020 1020
1021 protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateAvatarImprovedBlock(uint localID, LLVector3 pos, LLVector3 velocity) 1021 protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateAvatarImprovedBlock(uint localID, LLVector3 pos, LLVector3 velocity, LLQuaternion rotation)
1022 { 1022 {
1023 byte[] bytes = new byte[60]; 1023 byte[] bytes = new byte[60];
1024 int i = 0; 1024 int i = 0;
@@ -1073,15 +1073,22 @@ namespace OpenSim.Region.ClientStack
1073 bytes[i++] = (byte)(ac % 256); 1073 bytes[i++] = (byte)(ac % 256);
1074 bytes[i++] = (byte)((ac >> 8) % 256); 1074 bytes[i++] = (byte)((ac >> 8) % 256);
1075 1075
1076 //rotation
1077 ushort rw, rx, ry, rz;
1078 rw = (ushort)(32768 * (rotation.W + 1));
1079 rx = (ushort)(32768 * (rotation.X + 1));
1080 ry = (ushort)(32768 * (rotation.Y + 1));
1081 rz = (ushort)(32768 * (rotation.Z + 1));
1082
1076 //rot 1083 //rot
1077 bytes[i++] = (byte)(ac % 256); 1084 bytes[i++] = (byte)(rx % 256);
1078 bytes[i++] = (byte)((ac >> 8) % 256); 1085 bytes[i++] = (byte)((rx >> 8) % 256);
1079 bytes[i++] = (byte)(ac % 256); 1086 bytes[i++] = (byte)(ry % 256);
1080 bytes[i++] = (byte)((ac >> 8) % 256); 1087 bytes[i++] = (byte)((ry >> 8) % 256);
1081 bytes[i++] = (byte)(ac % 256); 1088 bytes[i++] = (byte)(rz % 256);
1082 bytes[i++] = (byte)((ac >> 8) % 256); 1089 bytes[i++] = (byte)((rz >> 8) % 256);
1083 bytes[i++] = (byte)(ac % 256); 1090 bytes[i++] = (byte)(rw % 256);
1084 bytes[i++] = (byte)((ac >> 8) % 256); 1091 bytes[i++] = (byte)((rw >> 8) % 256);
1085 1092
1086 //rotation vel 1093 //rotation vel
1087 bytes[i++] = (byte)(ac % 256); 1094 bytes[i++] = (byte)(ac % 256);
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 1f8e5bb..c96d575 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -372,7 +372,7 @@ namespace OpenSim.Region.Environment.Scenes
372 { 372 {
373 this.bodyRot = q; 373 this.bodyRot = q;
374 update_rotation = true; 374 update_rotation = true;
375 } 375 }
376 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags))) 376 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags)))
377 { 377 {
378 if ((flags & (uint)DCF) != 0) 378 if ((flags & (uint)DCF) != 0)
@@ -495,7 +495,12 @@ namespace OpenSim.Region.Environment.Scenes
495 { 495 {
496 LLVector3 pos = this.AbsolutePosition; 496 LLVector3 pos = this.AbsolutePosition;
497 LLVector3 vel = this.Velocity; 497 LLVector3 vel = this.Velocity;
498 RemoteClient.SendAvatarTerseUpdate(this.m_regionHandle, 64096, this.LocalId, new LLVector3(pos.X, pos.Y, pos.Z), new LLVector3(vel.X, vel.Y, vel.Z)); 498 LLQuaternion rot;
499 rot.X = this.bodyRot.x;
500 rot.Y = this.bodyRot.y;
501 rot.Z = this.bodyRot.z;
502 rot.W = this.bodyRot.w;
503 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);
499 } 504 }
500 505
501 /// <summary> 506 /// <summary>
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index 4b05287..7e1f5c1 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -153,7 +153,7 @@ namespace SimpleApp
153 public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) { } 153 public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) { }
154 154
155 public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry) { } 155 public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry) { }
156 public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity) { } 156 public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation) { }
157 157
158 public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) { } 158 public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) { }
159 159