aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-03-20 20:39:33 +0000
committerJustin Clark-Casey (justincc)2012-03-20 20:39:33 +0000
commit86bd287b5346063edb0f62ceb96ee08c6ee80c18 (patch)
tree37ef7b7d14b42ee2c15f432a15fcfe36b17dde94 /OpenSim
parentrefactor: Eliminate unnecessary duplicate avCapsuleTilted (diff)
downloadopensim-SC_OLD-86bd287b5346063edb0f62ceb96ee08c6ee80c18.zip
opensim-SC_OLD-86bd287b5346063edb0f62ceb96ee08c6ee80c18.tar.gz
opensim-SC_OLD-86bd287b5346063edb0f62ceb96ee08c6ee80c18.tar.bz2
opensim-SC_OLD-86bd287b5346063edb0f62ceb96ee08c6ee80c18.tar.xz
refactor: precalculate the fixed movement factor for avatar tilting (sqrt(2)) rather than doing it multiple times on every move.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs21
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs3
2 files changed, 16 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 6d1f41d..8397eb4 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -115,6 +115,11 @@ namespace OpenSim.Region.Physics.OdePlugin
115 private float m_tainted_CAPSULE_LENGTH; // set when the capsule length changes. 115 private float m_tainted_CAPSULE_LENGTH; // set when the capsule length changes.
116 116
117 /// <summary> 117 /// <summary>
118 /// Base movement for calculating tilt.
119 /// </summary>
120 private float m_tiltBaseMovement = (float)Math.Sqrt(2);
121
122 /// <summary>
118 /// Used to introduce a fixed tilt because a straight-up capsule falls through terrain, probably a bug in terrain collider 123 /// Used to introduce a fixed tilt because a straight-up capsule falls through terrain, probably a bug in terrain collider
119 /// </summary> 124 /// </summary>
120 private float m_tiltMagnitudeWhenProjectedOnXYPlane = 0.1131371f; 125 private float m_tiltMagnitudeWhenProjectedOnXYPlane = 0.1131371f;
@@ -524,14 +529,14 @@ namespace OpenSim.Region.Physics.OdePlugin
524 if (movementVector.Y > 0) 529 if (movementVector.Y > 0)
525 { 530 {
526 // northeast 531 // northeast
527 movementVector.X = (float)Math.Sqrt(2.0); 532 movementVector.X = m_tiltBaseMovement;
528 movementVector.Y = (float)Math.Sqrt(2.0); 533 movementVector.Y = m_tiltBaseMovement;
529 } 534 }
530 else 535 else
531 { 536 {
532 // southeast 537 // southeast
533 movementVector.X = (float)Math.Sqrt(2.0); 538 movementVector.X = m_tiltBaseMovement;
534 movementVector.Y = -(float)Math.Sqrt(2.0); 539 movementVector.Y = -m_tiltBaseMovement;
535 } 540 }
536 } 541 }
537 else 542 else
@@ -540,14 +545,14 @@ namespace OpenSim.Region.Physics.OdePlugin
540 if (movementVector.Y > 0) 545 if (movementVector.Y > 0)
541 { 546 {
542 // northwest 547 // northwest
543 movementVector.X = -(float)Math.Sqrt(2.0); 548 movementVector.X = -m_tiltBaseMovement;
544 movementVector.Y = (float)Math.Sqrt(2.0); 549 movementVector.Y = m_tiltBaseMovement;
545 } 550 }
546 else 551 else
547 { 552 {
548 // southwest 553 // southwest
549 movementVector.X = -(float)Math.Sqrt(2.0); 554 movementVector.X = -m_tiltBaseMovement;
550 movementVector.Y = -(float)Math.Sqrt(2.0); 555 movementVector.Y = -m_tiltBaseMovement;
551 } 556 }
552 } 557 }
553 558
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index 1f8c2ca..842ff91 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -185,6 +185,9 @@ namespace OpenSim.Region.Physics.OdePlugin
185 /// <summary> 185 /// <summary>
186 /// true = old compatibility mode with leaning capsule; false = new corrected mode 186 /// true = old compatibility mode with leaning capsule; false = new corrected mode
187 /// </summary> 187 /// </summary>
188 /// <remarks>
189 /// Even when set to false, the capsule still tilts but this is done in a different way.
190 /// </remarks>
188 public bool IsAvCapsuleTilted { get; private set; } 191 public bool IsAvCapsuleTilted { get; private set; }
189 192
190 private float avDensity = 80f; 193 private float avDensity = 80f;