aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/ODECharacter.cs')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs64
1 files changed, 24 insertions, 40 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 606b13e..4165484 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -67,14 +67,17 @@ namespace OpenSim.Region.Physics.OdePlugin
67 private PhysicsVector _acceleration; 67 private PhysicsVector _acceleration;
68 private PhysicsVector m_rotationalVelocity; 68 private PhysicsVector m_rotationalVelocity;
69 private float m_mass = 80f; 69 private float m_mass = 80f;
70 private float m_density = 60f; 70 public float m_density = 60f;
71 private bool m_pidControllerActive = true; 71 private bool m_pidControllerActive = true;
72 private float PID_D = 800.0f; 72 public float PID_D = 800.0f;
73 private float PID_P = 900.0f; 73 public float PID_P = 900.0f;
74 //private static float POSTURE_SERVO = 10000.0f; 74 //private static float POSTURE_SERVO = 10000.0f;
75 public static float CAPSULE_RADIUS = 0.37f; 75 public float CAPSULE_RADIUS = 0.37f;
76 public float CAPSULE_LENGTH = 2.140599f; 76 public float CAPSULE_LENGTH = 2.140599f;
77 private float m_tensor = 3800000f; 77 public float m_tensor = 3800000f;
78 public float heightFudgeFactor = 0.52f;
79 public float walkDivisor = 1.3f;
80 public float runDivisor = 0.8f;
78 private bool flying = false; 81 private bool flying = false;
79 private bool m_iscolliding = false; 82 private bool m_iscolliding = false;
80 private bool m_iscollidingGround = false; 83 private bool m_iscollidingGround = false;
@@ -115,7 +118,7 @@ namespace OpenSim.Region.Physics.OdePlugin
115 public int m_eventsubscription = 0; 118 public int m_eventsubscription = 0;
116 private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); 119 private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate();
117 120
118 public OdeCharacter(String avName, OdeScene parent_scene, PhysicsVector pos, CollisionLocker dode, PhysicsVector size) 121 public OdeCharacter(String avName, OdeScene parent_scene, PhysicsVector pos, CollisionLocker dode, PhysicsVector size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor)
119 { 122 {
120 ode = dode; 123 ode = dode;
121 _velocity = new PhysicsVector(); 124 _velocity = new PhysicsVector();
@@ -124,14 +127,15 @@ namespace OpenSim.Region.Physics.OdePlugin
124 _acceleration = new PhysicsVector(); 127 _acceleration = new PhysicsVector();
125 _parent_scene = parent_scene; 128 _parent_scene = parent_scene;
126 129
127 if (Environment.OSVersion.Platform == PlatformID.Unix) 130 PID_D = pid_d;
128 { 131 PID_P = pid_p;
129 m_tensor = 2000000f; 132 CAPSULE_RADIUS = capsule_radius;
130 } 133 m_tensor = tensor;
131 else 134 m_density = density;
132 { 135 heightFudgeFactor = height_fudge_factor;
133 m_tensor = 1300000f; 136 walkDivisor = walk_divisor;
134 } 137 runDivisor = rundivisor;
138
135 139
136 m_StandUpRotation = 140 m_StandUpRotation =
137 new d.Matrix3(0.5f, 0.7071068f, 0.5f, -0.7071068f, 0f, 0.7071068f, 0.5f, -0.7071068f, 141 new d.Matrix3(0.5f, 0.7071068f, 0.5f, -0.7071068f, 0f, 0.7071068f, 0.5f, -0.7071068f,
@@ -141,7 +145,7 @@ namespace OpenSim.Region.Physics.OdePlugin
141 { 145 {
142 m_colliderarr[i] = false; 146 m_colliderarr[i] = false;
143 } 147 }
144 CAPSULE_LENGTH = (size.Z - ((size.Z * 0.52f))); 148 CAPSULE_LENGTH = (size.Z - ((size.Z * height_fudge_factor)));
145 149
146 lock (OdeScene.OdeLock) 150 lock (OdeScene.OdeLock)
147 { 151 {
@@ -391,7 +395,7 @@ namespace OpenSim.Region.Physics.OdePlugin
391 float capsuleradius = CAPSULE_RADIUS; 395 float capsuleradius = CAPSULE_RADIUS;
392 //capsuleradius = 0.2f; 396 //capsuleradius = 0.2f;
393 397
394 CAPSULE_LENGTH = (SetSize.Z - ((SetSize.Z*0.52f))); // subtract 43% of the size 398 CAPSULE_LENGTH = (SetSize.Z - ((SetSize.Z * heightFudgeFactor))); // subtract 43% of the size
395 //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); 399 //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString());
396 d.BodyDestroy(Body); 400 d.BodyDestroy(Body);
397 401
@@ -416,15 +420,6 @@ namespace OpenSim.Region.Physics.OdePlugin
416 private void AvatarGeomAndBodyCreation(float npositionX, float npositionY, float npositionZ, float tensor) 420 private void AvatarGeomAndBodyCreation(float npositionX, float npositionY, float npositionZ, float tensor)
417 { 421 {
418 422
419 if (Environment.OSVersion.Platform == PlatformID.Unix)
420 {
421 m_tensor = 2000000f;
422 }
423 else
424 {
425 m_tensor = 550000f;
426 }
427
428 int dAMotorEuler = 1; 423 int dAMotorEuler = 1;
429 _parent_scene.waitForSpaceUnlock(_parent_scene.space); 424 _parent_scene.waitForSpaceUnlock(_parent_scene.space);
430 Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); 425 Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH);
@@ -662,17 +657,7 @@ namespace OpenSim.Region.Physics.OdePlugin
662 657
663 // If the PID Controller isn't active then we set our force 658 // If the PID Controller isn't active then we set our force
664 // calculating base velocity to the current position 659 // calculating base velocity to the current position
665 if (Environment.OSVersion.Platform == PlatformID.Unix) 660
666 {
667 PID_D = 3200.0f;
668 PID_P = 1400.0f;
669 }
670 else
671 {
672 PID_D = 2200.0f;
673 PID_P = 900.0f;
674 }
675
676 661
677 if (m_pidControllerActive == false) 662 if (m_pidControllerActive == false)
678 { 663 {
@@ -686,11 +671,11 @@ namespace OpenSim.Region.Physics.OdePlugin
686 671
687 if (!m_alwaysRun) 672 if (!m_alwaysRun)
688 { 673 {
689 movementdivisor = 1.3f; 674 movementdivisor = walkDivisor;
690 } 675 }
691 else 676 else
692 { 677 {
693 movementdivisor = 0.8f; 678 movementdivisor = runDivisor;
694 } 679 }
695 680
696 // if velocity is zero, use position control; otherwise, velocity control 681 // if velocity is zero, use position control; otherwise, velocity control
@@ -830,11 +815,10 @@ namespace OpenSim.Region.Physics.OdePlugin
830 _velocity.Y = (vec.Y); 815 _velocity.Y = (vec.Y);
831 816
832 _velocity.Z = (vec.Z); 817 _velocity.Z = (vec.Z);
818
833 if (_velocity.Z < -6 && !m_hackSentFall) 819 if (_velocity.Z < -6 && !m_hackSentFall)
834 { 820 {
835 // Collisionupdates will be used in the future, right now the're not being used.
836 m_hackSentFall = true; 821 m_hackSentFall = true;
837 //base.SendCollisionUpdate(new CollisionEventUpdate());
838 m_pidControllerActive = false; 822 m_pidControllerActive = false;
839 } 823 }
840 else if (flying && !m_hackSentFly) 824 else if (flying && !m_hackSentFly)