aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs95
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs6
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs21
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs18
4 files changed, 90 insertions, 50 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)
diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs
index 0c79aa6..ae63cfa 100644
--- a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs
@@ -269,7 +269,10 @@ namespace OpenSim.Region.Physics.OdePlugin
269 /// </summary> 269 /// </summary>
270 public override bool IsColliding 270 public override bool IsColliding
271 { 271 {
272 get { return m_iscolliding; } 272//#@ get { return m_iscolliding; }
273 get { //##
274//Console.WriteLine(">>>>>>>>>>>> IC get = {0}", m_iscolliding); //##
275 return m_iscolliding; } //##
273 set 276 set
274 { 277 {
275 int i; 278 int i;
@@ -307,6 +310,7 @@ namespace OpenSim.Region.Physics.OdePlugin
307 { 310 {
308 m_iscolliding = true; 311 m_iscolliding = true;
309 } 312 }
313// ## Console.WriteLine("IC SET = {0} t{1} f{2} i {3}", value, truecount, falsecount, m_iscolliding);
310 if (m_wascolliding != m_iscolliding) 314 if (m_wascolliding != m_iscolliding)
311 { 315 {
312 //base.SendCollisionUpdate(new CollisionEventUpdate()); 316 //base.SendCollisionUpdate(new CollisionEventUpdate());
@@ -589,7 +593,7 @@ namespace OpenSim.Region.Physics.OdePlugin
589 Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); 593 Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH);
590 _parent_scene.geom_name_map[Shell] = m_name; 594 _parent_scene.geom_name_map[Shell] = m_name;
591 _parent_scene.actor_name_map[Shell] = (PhysicsActor)this; 595 _parent_scene.actor_name_map[Shell] = (PhysicsActor)this;
592//Console.WriteLine("**** Create {2} Dicts: actor={0} name={1}", _parent_scene.actor_name_map.Count, _parent_scene.geom_name_map.Count, m_name); 596Console.WriteLine("**** Create {2} Dicts: actor={0} name={1} height={3} rad={4}", _parent_scene.actor_name_map.Count, _parent_scene.geom_name_map.Count, m_name, CAPSULE_LENGTH, CAPSULE_RADIUS);
593 597
594 d.GeomSetCategoryBits(Shell, (int)m_collisionCategories); 598 d.GeomSetCategoryBits(Shell, (int)m_collisionCategories);
595 d.GeomSetCollideBits(Shell, (int)m_collisionFlags); 599 d.GeomSetCollideBits(Shell, (int)m_collisionFlags);
@@ -857,7 +861,9 @@ namespace OpenSim.Region.Physics.OdePlugin
857 { 861 {
858 m_pidControllerActive = false; 862 m_pidControllerActive = false;
859 force *= 100f; 863 force *= 100f;
860 doForce(force); 864//Console.WriteLine("DF 1"); // ##
865 if (!force.ApproxEquals(Vector3.Zero, 0.01f))
866 doForce(force);
861 // If uncommented, things get pushed off world 867 // If uncommented, things get pushed off world
862 // 868 //
863 // m_log.Debug("Push!"); 869 // m_log.Debug("Push!");
@@ -896,7 +902,8 @@ namespace OpenSim.Region.Physics.OdePlugin
896 d.BodyAddForce(Body, force.X, force.Y, force.Z); 902 d.BodyAddForce(Body, force.X, force.Y, force.Z);
897 //d.BodySetRotation(Body, ref m_StandUpRotation); 903 //d.BodySetRotation(Body, ref m_StandUpRotation);
898 //standupStraight(); 904 //standupStraight();
899 905 d.Vector3 vel = d.BodyGetLinearVel(Body); //##
906//Console.WriteLine("AvVel <{0},{1},{2}>", vel.X, vel.Y, vel.Z); //##
900 } 907 }
901 } 908 }
902 909
@@ -1103,12 +1110,14 @@ namespace OpenSim.Region.Physics.OdePlugin
1103 } 1110 }
1104 if (vec.IsFinite()) 1111 if (vec.IsFinite())
1105 { 1112 {
1106 if (!vec.ApproxEquals(Vector3.Zero, 0.01f)) 1113 if (!vec.ApproxEquals(Vector3.Zero, 0.02f)) // 0.01 allows 0.002 !!
1107 { 1114 {
1115//Console.WriteLine("DF 2"); // ##
1116
1108 doForce(vec); 1117 doForce(vec);
1109 if (!_zeroFlag) 1118 if (!_zeroFlag)
1110 { 1119 {
1111 AlignAvatarTiltWithCurrentDirectionOfMovement(vec); 1120// AlignAvatarTiltWithCurrentDirectionOfMovement(vec);
1112 } 1121 }
1113 } 1122 }
1114 } 1123 }
diff --git a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
index ab084fd..86f9893 100644
--- a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
@@ -713,7 +713,7 @@ namespace OpenSim.Region.Physics.OdePlugin
713 713
714 // Test if we're colliding a geom with a space. 714 // Test if we're colliding a geom with a space.
715 // If so we have to drill down into the space recursively 715 // If so we have to drill down into the space recursively
716 716//Console.WriteLine("near -----------"); //##
717 if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2)) 717 if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2))
718 { 718 {
719 if (g1 == IntPtr.Zero || g2 == IntPtr.Zero) 719 if (g1 == IntPtr.Zero || g2 == IntPtr.Zero)
@@ -844,11 +844,21 @@ namespace OpenSim.Region.Physics.OdePlugin
844 // Testing if the collision is at the feet of the avatar 844 // Testing if the collision is at the feet of the avatar
845 845
846 //m_log.DebugFormat("[PHYSICS]: {0} - {1} - {2} - {3}", curContact.pos.Z, p2.Position.Z, (p2.Position.Z - curContact.pos.Z), (p2.Size.Z * 0.6f)); 846 //m_log.DebugFormat("[PHYSICS]: {0} - {1} - {2} - {3}", curContact.pos.Z, p2.Position.Z, (p2.Position.Z - curContact.pos.Z), (p2.Size.Z * 0.6f));
847 if ((p2.Position.Z - curContact.pos.Z) > (p2.Size.Z * 0.6f)) 847//#@ if ((p2.Position.Z - curContact.pos.Z) > (p2.Size.Z * 0.6f))
848 p2.IsColliding = true; 848//#@ p2.IsColliding = true;
849 } 849 if ((p2.Position.Z - curContact.pos.Z) > (p2.Size.Z * 0.6f)){ //##
850//Console.WriteLine("AvColl 1 {0} - {1} - {2} - {3}", //##
851// curContact.pos.Z, p2.Position.Z, (p2.Position.Z - curContact.pos.Z), (p2.Size.Z * 0.6f)); //##
852 p2.IsColliding = true; //##
853 }else{
854//Console.WriteLine("AvColl 2 {0} - {1} - {2} - {3}", //##
855// curContact.pos.Z, p2.Position.Z, (p2.Position.Z - curContact.pos.Z), (p2.Size.Z * 0.6f)); //##
856
857 } //##
858 }
850 else 859 else
851 { 860 {
861//Console.WriteLine("AvColl 3 {0}", p2.PhysicsActorType); //##
852 p2.IsColliding = true; 862 p2.IsColliding = true;
853 } 863 }
854 864