aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs95
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs6
2 files changed, 61 insertions, 40 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 99d9564..9658e11 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -61,6 +61,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
61 public bool m_jumping = false; // Add for jumping 61 public bool m_jumping = false; // Add for jumping
62 public float m_jumpVelocity = 0f; // Add for jumping 62 public float m_jumpVelocity = 0f; // Add for jumping
63 private int m_landing = 0; // Add for jumping 63 private int m_landing = 0; // Add for jumping
64 public bool m_falling = false; // Add for falling
65 private float m_fallHeight; // Add for falling
64 66
65 /// <value> 67 /// <value>
66 /// The scene presence that this animator applies to 68 /// The scene presence that this animator applies to
@@ -118,7 +120,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation
118 120
119 public void ResetAnimations() 121 public void ResetAnimations()
120 { 122 {
123Console.WriteLine("ResetA.............");
121 m_animations.Clear(); 124 m_animations.Clear();
125TrySetMovementAnimation("STAND");
122 } 126 }
123 127
124 /// <summary> 128 /// <summary>
@@ -145,7 +149,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
145 public string GetMovementAnimation() 149 public string GetMovementAnimation()
146 { 150 {
147//Console.WriteLine("GMA-------"); //## 151//Console.WriteLine("GMA-------"); //##
148 const float FALL_DELAY = 0.33f; 152//#@ const float FALL_DELAY = 0.33f;
153 const float FALL_DELAY = 800f; //## mS
149//rm for jumping const float PREJUMP_DELAY = 0.25f; 154//rm for jumping const float PREJUMP_DELAY = 0.25f;
150 const float PREJUMP_DELAY = 200f; // mS add for jumping 155 const float PREJUMP_DELAY = 200f; // mS add for jumping
151 const float JUMP_PERIOD = 800f; // mS add for jumping 156 const float JUMP_PERIOD = 800f; // mS add for jumping
@@ -191,9 +196,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation
191 { 196 {
192 m_animTickFall = 0; 197 m_animTickFall = 0;
193 m_animTickJump = 0; 198 m_animTickJump = 0;
194 m_jumping = false; //add for jumping flag 199 m_jumping = false; //add for jumping
195 m_jumpVelocity = 0f; //add for jumping flag 200 m_falling = true; //add for falling
201 m_jumpVelocity = 0f; //add for jumping
196 actor.Selected = false; //add for jumping flag 202 actor.Selected = false; //add for jumping flag
203 m_fallHeight = actor.Position.Z; // save latest flying height
197 204
198 if (move.X != 0f || move.Y != 0f) 205 if (move.X != 0f || move.Y != 0f)
199 { 206 {
@@ -205,8 +212,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation
205 } 212 }
206 else if (move.Z < 0f) 213 else if (move.Z < 0f)
207 { 214 {
208 if (actor != null && actor.IsColliding) 215 if (actor != null && actor.IsColliding)
216 { //##
217//Console.WriteLine("LAND FLYING"); // ##
209 return "LAND"; 218 return "LAND";
219 } //#
210 else 220 else
211 return "HOVER_DOWN"; 221 return "HOVER_DOWN";
212 } 222 }
@@ -223,19 +233,25 @@ namespace OpenSim.Region.Framework.Scenes.Animation
223// rm for jumping if (actor == null || !actor.IsColliding) 233// rm for jumping if (actor == null || !actor.IsColliding)
224 if ((actor == null || !actor.IsColliding) && !m_jumping) // add for jumping 234 if ((actor == null || !actor.IsColliding) && !m_jumping) // add for jumping
225 { 235 {
226//Console.WriteLine("FFL"); //## 236// rm float fallElapsed = (float)(Environment.TickCount - m_animTickFall) / 1000f;
227 float fallElapsed = (float)(Environment.TickCount - m_animTickFall) / 1000f; 237 float fallElapsed = (float)(Environment.TickCount - m_animTickFall); // add, in mS
228 float fallVelocity = (actor != null) ? actor.Velocity.Z : 0.0f; 238 float fallVelocity = (actor != null) ? actor.Velocity.Z : 0.0f;
239//Console.WriteLine("falling t={0} v={1}", fallElapsed, fallVelocity); //##
229 240
230 if (m_animTickFall == 0 || (fallElapsed > FALL_DELAY && fallVelocity >= 0.0f)) 241// rm for fall if (m_animTickFall == 0 || (fallElapsed > FALL_DELAY && fallVelocity >= 0.0f))
242 if (!m_jumping && (fallVelocity < -3.0f) ) m_falling = true; // add for falling and jumping
243
244 if (m_animTickFall == 0 || (fallVelocity >= 0.0f)) // add for jumping
245 // not falling yet or going up
231 { 246 {
232 // Just started falling 247 // reset start of fall time
233 m_animTickFall = Environment.TickCount; 248 m_animTickFall = Environment.TickCount;
234 } 249 }
235// else if (!jumping && fallElapsed > FALL_DELAY) 250// else if (!jumping && fallElapsed > FALL_DELAY)
236 else if (!m_jumping && fallElapsed > FALL_DELAY) // add for jumping 251 else if (!m_jumping && (fallElapsed > FALL_DELAY) && (fallVelocity < -3.0f) ) // add for falling and jumping
237 { 252 {
238 // Falling long enough to trigger the animation 253 // Falling long enough to trigger the animation
254//Console.WriteLine("FALLDOWN"); //##
239 return "FALLDOWN"; 255 return "FALLDOWN";
240 } 256 }
241 257
@@ -247,7 +263,6 @@ namespace OpenSim.Region.Framework.Scenes.Animation
247 263
248 #region Jumping // section added for jumping... 264 #region Jumping // section added for jumping...
249 265
250 Vector3 vj = Vector3.Zero;
251 int jumptime; 266 int jumptime;
252 jumptime = Environment.TickCount - m_animTickJump; 267 jumptime = Environment.TickCount - m_animTickJump;
253 268
@@ -258,12 +273,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
258 // Start jumping, prejump 273 // Start jumping, prejump
259 m_animTickFall = 0; 274 m_animTickFall = 0;
260 m_jumping = true; 275 m_jumping = true;
276 m_falling = false;
261 actor.Selected = true; // borrowed for jmping flag 277 actor.Selected = true; // borrowed for jmping flag
262 m_animTickJump = Environment.TickCount; 278 m_animTickJump = Environment.TickCount;
263 vj.Z = 0.35f; 279 m_jumpVelocity = 0.35f;
264m_jumpVelocity = 0.35f;
265 vj += actor.Velocity;
266// #@ actor.Velocity = vj;
267 return "PREJUMP"; 280 return "PREJUMP";
268 } 281 }
269 282
@@ -274,8 +287,9 @@ m_jumpVelocity = 0.35f;
274//Console.WriteLine("LA {0}", jumptime); //## 287//Console.WriteLine("LA {0}", jumptime); //##
275 // end jumping 288 // end jumping
276 m_jumping = false; 289 m_jumping = false;
290 m_falling = false;
277 actor.Selected = false; // borrowed for jumping flag 291 actor.Selected = false; // borrowed for jumping flag
278m_jumpVelocity = 0f; 292 m_jumpVelocity = 0f;
279 m_animTickFall = Environment.TickCount; 293 m_animTickFall = Environment.TickCount;
280 return "LAND"; 294 return "LAND";
281 } 295 }
@@ -283,10 +297,7 @@ m_jumpVelocity = 0f;
283 { 297 {
284//Console.WriteLine("JD {0}", jumptime); //## 298//Console.WriteLine("JD {0}", jumptime); //##
285 // jump down 299 // jump down
286 vj = actor.Velocity; 300 m_jumpVelocity = 0f;
287 vj.Z = 0f;
288m_jumpVelocity = 0f;
289// #@ actor.Velocity = vj;
290 return "JUMP"; 301 return "JUMP";
291 } 302 }
292 else if (jumptime > PREJUMP_DELAY) 303 else if (jumptime > PREJUMP_DELAY)
@@ -294,11 +305,7 @@ m_jumpVelocity = 0f;
294//Console.WriteLine("JU {0}", jumptime); //## 305//Console.WriteLine("JU {0}", jumptime); //##
295 // jump up 306 // jump up
296 m_jumping = true; 307 m_jumping = true;
297 vj.Z = 10f; 308 m_jumpVelocity = 10f;
298m_jumpVelocity = 10f;
299 vj.X = actor.Velocity.X;
300 vj.Y = actor.Velocity.Y;
301// #@ actor.Velocity = vj;
302 return "JUMP"; 309 return "JUMP";
303 } 310 }
304 } 311 }
@@ -309,29 +316,37 @@ m_jumpVelocity = 10f;
309 316
310 if (m_movementAnimation == "FALLDOWN") 317 if (m_movementAnimation == "FALLDOWN")
311 { 318 {
319 m_falling = false;
312 m_animTickFall = Environment.TickCount; 320 m_animTickFall = Environment.TickCount;
313
314 // TODO: SOFT_LAND support 321 // TODO: SOFT_LAND support
315 return "LAND"; 322 float fallHeight = m_fallHeight - actor.Position.Z;
323//Console.WriteLine("Hit from {0}", fallHeight); //##
324 if (fallHeight > 15.0f) // add for falling
325 return "STANDUP";
326 else if (fallHeight > 8.0f) // add for falling
327 return "SOFT_LAND"; // add for falling
328 else // add for falling
329 return "LAND"; // add for falling
316 } 330 }
317 else if (m_movementAnimation == "LAND")
318 {
319// rm jumping float landElapsed = (float)(Environment.TickCount - m_animTickFall) / 1000f; 331// rm jumping float landElapsed = (float)(Environment.TickCount - m_animTickFall) / 1000f;
320 int landElapsed = Environment.TickCount - m_animTickFall; // add for jumping
321// rm jumping if ((m_animTickFall != 0) && (landElapsed <= FALL_DELAY)) 332// rm jumping if ((m_animTickFall != 0) && (landElapsed <= FALL_DELAY))
322/* Try change ## 333// rm for landing return "LAND";
323 if ((m_animTickFall != 0) && (landElapsed <= 500)) // add for jumping 334 else if ((m_movementAnimation == "LAND") || (m_movementAnimation == "SOFT_LAND") || (m_movementAnimation == "STANDUP"))
324 return "LAND"; 335 {
325 */ 336 int landElapsed = Environment.TickCount - m_animTickFall; // add for jumping
326 // NB if this is set too long a weird anim reset from some place prevents STAND from being sent to client 337 int limit = 1000; // add for jumping
327 if ((m_animTickFall != 0) && (landElapsed <= 300)) // add for jumping 338 if(m_movementAnimation == "LAND") limit = 350; // add for jumping
339 // NB if the above is set too long a weird anim reset from some place prevents STAND from being sent to client
340
341 if ((m_animTickFall != 0) && (landElapsed <= limit)) // add for jumping
328 { 342 {
329//Console.WriteLine("LAND"); //## 343//Console.WriteLine("Lelapse {0}", m_movementAnimation); //##
330 return "LAND"; 344 return m_movementAnimation;
331 } 345 }
332 else 346 else
333 { 347 {
334//Console.WriteLine("STAND"); //## 348//Console.WriteLine("end/STAND"); //##
349 m_fallHeight = actor.Position.Z; // save latest flying height
335 return "STAND"; 350 return "STAND";
336 } 351 }
337 } 352 }
@@ -369,6 +384,8 @@ m_jumpVelocity = 10f;
369 // next section moved outside paren. and realigned for jumping 384 // next section moved outside paren. and realigned for jumping
370 if (move.X != 0f || move.Y != 0f) 385 if (move.X != 0f || move.Y != 0f)
371 { 386 {
387 m_fallHeight = actor.Position.Z; // save latest flying height
388 m_falling = false; // Add for falling
372 // Walking / crouchwalking / running 389 // Walking / crouchwalking / running
373 if (move.Z < 0f) 390 if (move.Z < 0f)
374 return "CROUCHWALK"; 391 return "CROUCHWALK";
@@ -380,6 +397,7 @@ m_jumpVelocity = 10f;
380// rm for jumping else 397// rm for jumping else
381 else if (!m_jumping) // add for jumping 398 else if (!m_jumping) // add for jumping
382 { 399 {
400 m_falling = false; // Add for falling
383 // Not walking 401 // Not walking
384 if (move.Z < 0f) 402 if (move.Z < 0f)
385 return "CROUCH"; 403 return "CROUCH";
@@ -389,6 +407,7 @@ m_jumpVelocity = 10f;
389 // end section realign for jumping 407 // end section realign for jumping
390 #endregion Ground Movement 408 #endregion Ground Movement
391 409
410 m_falling = false; // Add for falling
392 return m_movementAnimation; 411 return m_movementAnimation;
393 } 412 }
394 413
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 2ed00a0..faf6354 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2568,9 +2568,11 @@ namespace OpenSim.Region.Framework.Scenes
2568 2568
2569 if (actor != null) 2569 if (actor != null)
2570 { 2570 {
2571 if (actor.Flying) 2571// rm falling if (actor.Flying)
2572 if ((actor.Flying) || Animator.m_falling) // add for falling lateral speed
2572 { 2573 {
2573 direc *= 4.0f; 2574// rm speed mod direc *= 4.0f;
2575 direc *= 5.2f; // for speed mod
2574 //bool controlland = (((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); 2576 //bool controlland = (((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
2575 //bool colliding = (m_physicsActor.IsColliding==true); 2577 //bool colliding = (m_physicsActor.IsColliding==true);
2576 //if (controlland) 2578 //if (controlland)