diff options
author | MW | 2007-06-28 15:56:24 +0000 |
---|---|---|
committer | MW | 2007-06-28 15:56:24 +0000 |
commit | e1ebfaef637acd6916b519e053c1eb808c98b3c5 (patch) | |
tree | e35be6d930697384e9a35fd4a9ae6f40b6b01759 /OpenSim/Region | |
parent | *User Profile requests on OGS UserServer now uses XMLRPC instead of REST (diff) | |
download | opensim-SC-e1ebfaef637acd6916b519e053c1eb808c98b3c5.zip opensim-SC-e1ebfaef637acd6916b519e053c1eb808c98b3c5.tar.gz opensim-SC-e1ebfaef637acd6916b519e053c1eb808c98b3c5.tar.bz2 opensim-SC-e1ebfaef637acd6916b519e053c1eb808c98b3c5.tar.xz |
Applied ScenePresence movement patch from Darok.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Capabilities/LLSDHelpers.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 81 |
2 files changed, 60 insertions, 33 deletions
diff --git a/OpenSim/Region/Capabilities/LLSDHelpers.cs b/OpenSim/Region/Capabilities/LLSDHelpers.cs index 80916b4..76d9345 100644 --- a/OpenSim/Region/Capabilities/LLSDHelpers.cs +++ b/OpenSim/Region/Capabilities/LLSDHelpers.cs | |||
@@ -73,7 +73,6 @@ namespace OpenSim.Region.Capabilities | |||
73 | } | 73 | } |
74 | else | 74 | else |
75 | { | 75 | { |
76 | //Console.WriteLine("LLSD field name" + fields[i].Name + " , " + fields[i].GetValue(obj).GetType()); | ||
77 | writer.WriteStartElement(String.Empty, "key", String.Empty); | 76 | writer.WriteStartElement(String.Empty, "key", String.Empty); |
78 | writer.WriteString(fields[i].Name); | 77 | writer.WriteString(fields[i].Name); |
79 | writer.WriteEndElement(); | 78 | writer.WriteEndElement(); |
@@ -86,12 +85,15 @@ namespace OpenSim.Region.Capabilities | |||
86 | // LLSDArray arrayObject = obj as LLSDArray; | 85 | // LLSDArray arrayObject = obj as LLSDArray; |
87 | // ArrayList a = arrayObject.Array; | 86 | // ArrayList a = arrayObject.Array; |
88 | ArrayList a = (ArrayList)obj.GetType().GetField("Array").GetValue(obj); | 87 | ArrayList a = (ArrayList)obj.GetType().GetField("Array").GetValue(obj); |
89 | writer.WriteStartElement(String.Empty, "array", String.Empty); | 88 | if (a != null) |
90 | foreach (object item in a) | ||
91 | { | 89 | { |
92 | SerializeLLSDType(writer, item); | 90 | writer.WriteStartElement(String.Empty, "array", String.Empty); |
91 | foreach (object item in a) | ||
92 | { | ||
93 | SerializeLLSDType(writer, item); | ||
94 | } | ||
95 | writer.WriteEndElement(); | ||
93 | } | 96 | } |
94 | writer.WriteEndElement(); | ||
95 | break; | 97 | break; |
96 | } | 98 | } |
97 | } | 99 | } |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 96e5c94..23434a0 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -66,6 +66,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
66 | 66 | ||
67 | protected RegionInfo m_regionInfo; | 67 | protected RegionInfo m_regionInfo; |
68 | 68 | ||
69 | private Vector3[] Dir_Vectors = new Vector3[6]; | ||
70 | private enum Dir_ControlFlags | ||
71 | { | ||
72 | DIR_CONTROL_FLAG_FOWARD = MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS, | ||
73 | DIR_CONTROL_FLAG_BACK = MainAvatar.ControlFlags.AGENT_CONTROL_AT_NEG, | ||
74 | DIR_CONTROL_FLAG_LEFT = MainAvatar.ControlFlags.AGENT_CONTROL_LEFT_POS, | ||
75 | DIR_CONTROL_FLAG_RIGHT = MainAvatar.ControlFlags.AGENT_CONTROL_LEFT_NEG, | ||
76 | DIR_CONTROL_FLAG_UP = MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS, | ||
77 | DIR_CONTROL_FLAG_DOWN = MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG | ||
78 | } | ||
79 | |||
69 | #region Properties | 80 | #region Properties |
70 | /// <summary> | 81 | /// <summary> |
71 | /// | 82 | /// |
@@ -125,6 +136,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
125 | // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); | 136 | // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); |
126 | //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); | 137 | //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); |
127 | 138 | ||
139 | Dir_Vectors[0] = new Vector3(1, 0, 0); //FOWARD | ||
140 | Dir_Vectors[1] = new Vector3(-1, 0, 0); //BACK | ||
141 | Dir_Vectors[2] = new Vector3(0, 1, 0); //LEFT | ||
142 | Dir_Vectors[3] = new Vector3(0, -1, 0); //RIGHT | ||
143 | Dir_Vectors[4] = new Vector3(0, 0, 1); //UP | ||
144 | Dir_Vectors[5] = new Vector3(0, 0, -1); //DOWN | ||
145 | |||
128 | } | 146 | } |
129 | #endregion | 147 | #endregion |
130 | 148 | ||
@@ -216,40 +234,47 @@ namespace OpenSim.Region.Environment.Scenes | |||
216 | /// </summary> | 234 | /// </summary> |
217 | /// <param name="pack"></param> | 235 | /// <param name="pack"></param> |
218 | public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) | 236 | public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) |
219 | { | 237 | { |
220 | if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS) != 0) | 238 | int i = 0; |
239 | bool update_movementflag = false; | ||
240 | bool update_rotation = false; | ||
241 | bool DCFlagKeyPressed = false; | ||
242 | Vector3 agent_control_v3 = new Vector3(0, 0, 0); | ||
243 | Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); | ||
244 | |||
245 | |||
246 | // this.PhysActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); | ||
247 | |||
248 | if (q != this.bodyRot) | ||
221 | { | 249 | { |
222 | Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); | 250 | this.bodyRot = q; |
223 | if (((movementflag & 1) == 0) || (q != this.bodyRot)) | 251 | update_rotation = true; |
224 | { | ||
225 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0); | ||
226 | this.AddNewMovement(v3, q); | ||
227 | movementflag = 1; | ||
228 | this.bodyRot = q; | ||
229 | } | ||
230 | } | 252 | } |
231 | else if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_NEG) != 0) | 253 | foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags))) |
232 | { | 254 | { |
233 | Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); | 255 | if ((flags & (uint)DCF) != 0) |
234 | if (((movementflag & 2) == 0) || (q != this.bodyRot)) | 256 | { |
235 | { | 257 | DCFlagKeyPressed = true; |
236 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(-1, 0, 0); | 258 | agent_control_v3 += Dir_Vectors[i]; |
237 | this.AddNewMovement(v3, q); | 259 | if ((movementflag & (uint)DCF) == 0) |
238 | movementflag = 2; | 260 | { |
239 | this.bodyRot = q; | 261 | movementflag += (byte)(uint)DCF; |
262 | update_movementflag = true; | ||
263 | } | ||
240 | } | 264 | } |
241 | } | 265 | else |
242 | else | ||
243 | { | ||
244 | if ((movementflag) != 0) | ||
245 | { | 266 | { |
246 | NewForce newVelocity = new NewForce(); | 267 | if ((movementflag & (uint)DCF) != 0) |
247 | newVelocity.X = 0; | 268 | { |
248 | newVelocity.Y = 0; | 269 | movementflag -= (byte)(uint)DCF; |
249 | newVelocity.Z = 0; | 270 | update_movementflag = true; |
250 | this.forcesList.Add(newVelocity); | 271 | } |
251 | movementflag = 0; | ||
252 | } | 272 | } |
273 | i++; | ||
274 | } | ||
275 | if ((update_movementflag) || (update_rotation && DCFlagKeyPressed)) | ||
276 | { | ||
277 | this.AddNewMovement(agent_control_v3, q); | ||
253 | } | 278 | } |
254 | 279 | ||
255 | } | 280 | } |