aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Region/Scenes/Avatar.cs
diff options
context:
space:
mode:
authorMW2007-06-15 13:11:26 +0000
committerMW2007-06-15 13:11:26 +0000
commit95676b298819d6b2d1df74d1f52668e2549a2c2f (patch)
treee3152f0685f262253e72a482a4a3e4b64aae631a /OpenSim/OpenSim.Region/Scenes/Avatar.cs
parentand some more (diff)
downloadopensim-SC_OLD-95676b298819d6b2d1df74d1f52668e2549a2c2f.zip
opensim-SC_OLD-95676b298819d6b2d1df74d1f52668e2549a2c2f.tar.gz
opensim-SC_OLD-95676b298819d6b2d1df74d1f52668e2549a2c2f.tar.bz2
opensim-SC_OLD-95676b298819d6b2d1df74d1f52668e2549a2c2f.tar.xz
Preliminary movement added to sugilite, forwards walking only and no animations.
Diffstat (limited to '')
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Avatar.cs102
1 files changed, 85 insertions, 17 deletions
diff --git a/OpenSim/OpenSim.Region/Scenes/Avatar.cs b/OpenSim/OpenSim.Region/Scenes/Avatar.cs
index 6ae4319..17b2437 100644
--- a/OpenSim/OpenSim.Region/Scenes/Avatar.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Avatar.cs
@@ -61,6 +61,7 @@ namespace OpenSim.Region.Scenes
61 private ulong m_regionHandle; 61 private ulong m_regionHandle;
62 private Dictionary<uint, IClientAPI> m_clientThreads; 62 private Dictionary<uint, IClientAPI> m_clientThreads;
63 private bool childAvatar = false; 63 private bool childAvatar = false;
64 private bool newForce = false;
64 65
65 protected RegionInfo m_regionInfo; 66 protected RegionInfo m_regionInfo;
66 /// <summary> 67 /// <summary>
@@ -78,6 +79,7 @@ namespace OpenSim.Region.Scenes
78 this.uuid = theClient.AgentId; 79 this.uuid = theClient.AgentId;
79 80
80 m_regionInfo = reginfo; 81 m_regionInfo = reginfo;
82 m_regionHandle = reginfo.RegionHandle;
81 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Avatar.cs - Loading details from grid (DUMMY)"); 83 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Avatar.cs - Loading details from grid (DUMMY)");
82 ControllingClient = theClient; 84 ControllingClient = theClient;
83 this.firstname = ControllingClient.FirstName; 85 this.firstname = ControllingClient.FirstName;
@@ -99,8 +101,8 @@ namespace OpenSim.Region.Scenes
99 //ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance); 101 //ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance);
100 ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.CompleteMovement); 102 ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.CompleteMovement);
101 ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.SendInitialPosition); 103 ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.SendInitialPosition);
102 /* ControllingClient.OnAgentUpdate += new GenericCall3(this.HandleAgentUpdate); 104 ControllingClient.OnAgentUpdate += new UpdateAgent(this.HandleAgentUpdate);
103 ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); 105 /* ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
104 ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); 106 ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
105 ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); 107 ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
106 */ 108 */
@@ -135,31 +137,51 @@ namespace OpenSim.Region.Scenes
135 /// </summary> 137 /// </summary>
136 public override void addForces() 138 public override void addForces()
137 { 139 {
138 140 lock (this.forcesList)
141 {
142 newForce = false;
143 if (this.forcesList.Count > 0)
144 {
145 for (int i = 0; i < this.forcesList.Count; i++)
146 {
147 NewForce force = this.forcesList[i];
148 PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z);
149 lock (m_world.SyncRoot)
150 {
151 this._physActor.Velocity = phyVector;
152 }
153 this.updateflag = true;
154 this.velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this
155 // but as we are setting the velocity (rather than using real forces) at the moment it is okay.
156 this.newForce = true;
157 }
158 for (int i = 0; i < this.forcesList.Count; i++)
159 {
160 this.forcesList.RemoveAt(0);
161 }
162 }
163 }
139 } 164 }
140 165
141 /// <summary> 166 public void SendTerseUpdateToClient(IClientAPI RemoteClient)
142 /// likely to removed very soon
143 /// </summary>
144 /// <param name="name"></param>
145 public static void SetupTemplate(string name)
146 { 167 {
147 168 RemoteClient.SendAvatarTerseUpdate(this.m_regionHandle, 64096, this.localid, new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z), new LLVector3(this._physActor.Velocity.X, this._physActor.Velocity.Y, this._physActor.Velocity.Z));
148 } 169 }
149 170
150 /// <summary> 171 /// <summary>
151 /// likely to removed very soon 172 ///
152 /// </summary> 173 /// </summary>
153 /// <param name="objdata"></param> 174 public void SendTerseUpdateToALLClients()
154 protected static void SetDefaultPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata)
155 { 175 {
156 176 List<Avatar> avatars = this.m_world.RequestAvatarList();
157 177 for (int i = 0; i < avatars.Count; i++)
158 178 {
179 this.SendTerseUpdateToClient(avatars[i].ControllingClient);
180 }
159 } 181 }
160 182
161 /// <summary> 183 /// <summary>
162 /// 184 /// Complete Avatar's movement into the region
163 /// </summary> 185 /// </summary>
164 public void CompleteMovement() 186 public void CompleteMovement()
165 { 187 {
@@ -187,9 +209,55 @@ namespace OpenSim.Region.Scenes
187 /// <summary> 209 /// <summary>
188 /// 210 ///
189 /// </summary> 211 /// </summary>
190 public void SendRegionHandshake() 212 /// <param name="pack"></param>
213 public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
191 { 214 {
192 215
216 if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS) != 0)
217 {
218 Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
219 if (((movementflag & 1) == 0) || (q != this.bodyRot))
220 {
221 //we should add a new force to the list
222 // but for now we will deal with velocities
223 NewForce newVelocity = new NewForce();
224 Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0);
225 Axiom.MathLib.Vector3 direc = q * v3;
226 direc.Normalize();
227
228 //work out velocity for sim physics system
229 direc = direc * ((0.03f) * 128f);
230 if (this._physActor.Flying)
231 direc *= 4;
232
233 newVelocity.X = direc.x;
234 newVelocity.Y = direc.y;
235 newVelocity.Z = direc.z;
236 this.forcesList.Add(newVelocity);
237 movementflag = 1;
238 this.bodyRot = q;
239 }
240 }
241 else
242 {
243 if (movementflag == 16)
244 {
245 movementflag = 0;
246 }
247 if ((movementflag) != 0)
248 {
249 NewForce newVelocity = new NewForce();
250 newVelocity.X = 0;
251 newVelocity.Y = 0;
252 newVelocity.Z = 0;
253 this.forcesList.Add(newVelocity);
254 movementflag = 0;
255
256 this.movementflag = 16;
257
258 }
259 }
260
193 } 261 }
194 262
195 /// <summary> 263 /// <summary>