aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs62
1 files changed, 31 insertions, 31 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 4165484..5024b5d 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -36,7 +36,7 @@ namespace OpenSim.Region.Physics.OdePlugin
36 /// <summary> 36 /// <summary>
37 /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves. 37 /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves.
38 /// </summary> 38 /// </summary>
39 39
40 public enum dParam : int 40 public enum dParam : int
41 { 41 {
42 LowStop = 0, 42 LowStop = 0,
@@ -106,7 +106,7 @@ namespace OpenSim.Region.Physics.OdePlugin
106 private CollisionCategories m_collisionFlags = (CollisionCategories.Geom 106 private CollisionCategories m_collisionFlags = (CollisionCategories.Geom
107 | CollisionCategories.Space 107 | CollisionCategories.Space
108 | CollisionCategories.Body 108 | CollisionCategories.Body
109 | CollisionCategories.Character 109 | CollisionCategories.Character
110 | CollisionCategories.Land); 110 | CollisionCategories.Land);
111 public IntPtr Body; 111 public IntPtr Body;
112 private OdeScene _parent_scene; 112 private OdeScene _parent_scene;
@@ -145,7 +145,7 @@ namespace OpenSim.Region.Physics.OdePlugin
145 { 145 {
146 m_colliderarr[i] = false; 146 m_colliderarr[i] = false;
147 } 147 }
148 CAPSULE_LENGTH = (size.Z - ((size.Z * height_fudge_factor))); 148 CAPSULE_LENGTH = (size.Z - ((size.Z * height_fudge_factor)));
149 149
150 lock (OdeScene.OdeLock) 150 lock (OdeScene.OdeLock)
151 { 151 {
@@ -338,7 +338,7 @@ namespace OpenSim.Region.Physics.OdePlugin
338 } 338 }
339 339
340 /// <summary> 340 /// <summary>
341 /// turn the PID controller on or off. 341 /// turn the PID controller on or off.
342 /// The PID Controller will turn on all by itself in many situations 342 /// The PID Controller will turn on all by itself in many situations
343 /// </summary> 343 /// </summary>
344 /// <param name="status"></param> 344 /// <param name="status"></param>
@@ -354,7 +354,7 @@ namespace OpenSim.Region.Physics.OdePlugin
354 354
355 /// <summary> 355 /// <summary>
356 /// This 'puts' an avatar somewhere in the physics space. 356 /// This 'puts' an avatar somewhere in the physics space.
357 /// Not really a good choice unless you 'know' it's a good 357 /// Not really a good choice unless you 'know' it's a good
358 /// spot otherwise you're likely to orbit the avatar. 358 /// spot otherwise you're likely to orbit the avatar.
359 /// </summary> 359 /// </summary>
360 public override PhysicsVector Position 360 public override PhysicsVector Position
@@ -389,7 +389,7 @@ namespace OpenSim.Region.Physics.OdePlugin
389 lock (OdeScene.OdeLock) 389 lock (OdeScene.OdeLock)
390 { 390 {
391 d.JointDestroy(Amotor); 391 d.JointDestroy(Amotor);
392 392
393 PhysicsVector SetSize = value; 393 PhysicsVector SetSize = value;
394 float prevCapsule = CAPSULE_LENGTH; 394 float prevCapsule = CAPSULE_LENGTH;
395 float capsuleradius = CAPSULE_RADIUS; 395 float capsuleradius = CAPSULE_RADIUS;
@@ -405,7 +405,7 @@ namespace OpenSim.Region.Physics.OdePlugin
405 AvatarGeomAndBodyCreation(_position.X, _position.Y, 405 AvatarGeomAndBodyCreation(_position.X, _position.Y,
406 _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor); 406 _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor);
407 Velocity = new PhysicsVector(0f, 0f, 0f); 407 Velocity = new PhysicsVector(0f, 0f, 0f);
408 408
409 } 409 }
410 _parent_scene.geom_name_map[Shell] = m_name; 410 _parent_scene.geom_name_map[Shell] = m_name;
411 _parent_scene.actor_name_map[Shell] = (PhysicsActor) this; 411 _parent_scene.actor_name_map[Shell] = (PhysicsActor) this;
@@ -423,7 +423,7 @@ namespace OpenSim.Region.Physics.OdePlugin
423 int dAMotorEuler = 1; 423 int dAMotorEuler = 1;
424 _parent_scene.waitForSpaceUnlock(_parent_scene.space); 424 _parent_scene.waitForSpaceUnlock(_parent_scene.space);
425 Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); 425 Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH);
426 426
427 d.GeomSetCategoryBits(Shell, (int)m_collisionCategories); 427 d.GeomSetCategoryBits(Shell, (int)m_collisionCategories);
428 d.GeomSetCollideBits(Shell, (int)m_collisionFlags); 428 d.GeomSetCollideBits(Shell, (int)m_collisionFlags);
429 429
@@ -442,8 +442,8 @@ namespace OpenSim.Region.Physics.OdePlugin
442 442
443 d.GeomSetBody(Shell, Body); 443 d.GeomSetBody(Shell, Body);
444 444
445 445
446 // The purpose of the AMotor here is to keep the avatar's physical 446 // The purpose of the AMotor here is to keep the avatar's physical
447 // surrogate from rotating while moving 447 // surrogate from rotating while moving
448 Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero); 448 Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero);
449 d.JointAttach(Amotor, Body, IntPtr.Zero); 449 d.JointAttach(Amotor, Body, IntPtr.Zero);
@@ -455,7 +455,7 @@ namespace OpenSim.Region.Physics.OdePlugin
455 d.JointSetAMotorAngle(Amotor, 0, 0); 455 d.JointSetAMotorAngle(Amotor, 0, 0);
456 d.JointSetAMotorAngle(Amotor, 1, 0); 456 d.JointSetAMotorAngle(Amotor, 1, 0);
457 d.JointSetAMotorAngle(Amotor, 2, 0); 457 d.JointSetAMotorAngle(Amotor, 2, 0);
458 458
459 // These lowstops and high stops are effectively (no wiggle room) 459 // These lowstops and high stops are effectively (no wiggle room)
460 d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -0.000000000001f); 460 d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -0.000000000001f);
461 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0.000000000001f); 461 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0.000000000001f);
@@ -464,23 +464,23 @@ namespace OpenSim.Region.Physics.OdePlugin
464 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0.000000000001f); 464 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0.000000000001f);
465 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.000000000001f); 465 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.000000000001f);
466 466
467 // Fudge factor is 1f by default, we're setting it to 0. We don't want it to Fudge or the 467 // Fudge factor is 1f by default, we're setting it to 0. We don't want it to Fudge or the
468 // capped cyllinder will fall over 468 // capped cyllinder will fall over
469 d.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f); 469 d.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f);
470 d.JointSetAMotorParam(Amotor, (int)dParam.FMax, tensor); 470 d.JointSetAMotorParam(Amotor, (int)dParam.FMax, tensor);
471 471
472 //d.Matrix3 bodyrotation = d.BodyGetRotation(Body); 472 //d.Matrix3 bodyrotation = d.BodyGetRotation(Body);
473 //d.QfromR( 473 //d.QfromR(
474 //d.Matrix3 checkrotation = new d.Matrix3(0.7071068,0.5, -0.7071068, 474 //d.Matrix3 checkrotation = new d.Matrix3(0.7071068,0.5, -0.7071068,
475 // 475 //
476 //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22); 476 //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22);
477 //standupStraight(); 477 //standupStraight();
478 478
479 479
480 480
481 } 481 }
482 482
483 // 483 //
484 /// <summary> 484 /// <summary>
485 /// Uses the capped cyllinder volume formula to calculate the avatar's mass. 485 /// Uses the capped cyllinder volume formula to calculate the avatar's mass.
486 /// This may be used in calculations in the scene/scenepresence 486 /// This may be used in calculations in the scene/scenepresence
@@ -508,13 +508,13 @@ namespace OpenSim.Region.Physics.OdePlugin
508 508
509 } 509 }
510 510
511// This code is very useful. Written by DanX0r. We're just not using it right now. 511// This code is very useful. Written by DanX0r. We're just not using it right now.
512// Commented out to prevent a warning. 512// Commented out to prevent a warning.
513// 513//
514// private void standupStraight() 514// private void standupStraight()
515// { 515// {
516// // The purpose of this routine here is to quickly stabilize the Body while it's popped up in the air. 516// // The purpose of this routine here is to quickly stabilize the Body while it's popped up in the air.
517// // The amotor needs a few seconds to stabilize so without it, the avatar shoots up sky high when you 517// // The amotor needs a few seconds to stabilize so without it, the avatar shoots up sky high when you
518// // change appearance and when you enter the simulator 518// // change appearance and when you enter the simulator
519// // After this routine is done, the amotor stabilizes much quicker 519// // After this routine is done, the amotor stabilizes much quicker
520// d.Vector3 feet; 520// d.Vector3 feet;
@@ -558,7 +558,7 @@ namespace OpenSim.Region.Physics.OdePlugin
558 if (_zeroFlag) 558 if (_zeroFlag)
559 return new PhysicsVector(0f, 0f, 0f); 559 return new PhysicsVector(0f, 0f, 0f);
560 m_lastUpdateSent = false; 560 m_lastUpdateSent = false;
561 return _velocity; 561 return _velocity;
562 } 562 }
563 set 563 set
564 { 564 {
@@ -601,7 +601,7 @@ namespace OpenSim.Region.Physics.OdePlugin
601 } 601 }
602 602
603 /// <summary> 603 /// <summary>
604 /// Adds the force supplied to the Target Velocity 604 /// Adds the force supplied to the Target Velocity
605 /// The PID controller takes this target velocity and tries to make it a reality 605 /// The PID controller takes this target velocity and tries to make it a reality
606 /// </summary> 606 /// </summary>
607 /// <param name="force"></param> 607 /// <param name="force"></param>
@@ -616,7 +616,7 @@ namespace OpenSim.Region.Physics.OdePlugin
616 // _target_velocity.Y += force.Y; 616 // _target_velocity.Y += force.Y;
617 //_target_velocity.Z += force.Z; 617 //_target_velocity.Z += force.Z;
618 } 618 }
619 else 619 else
620 { 620 {
621 m_pidControllerActive = true; 621 m_pidControllerActive = true;
622 _target_velocity.X += force.X; 622 _target_velocity.X += force.X;
@@ -637,7 +637,7 @@ namespace OpenSim.Region.Physics.OdePlugin
637 d.BodyAddForce(Body, force.X, force.Y, force.Z); 637 d.BodyAddForce(Body, force.X, force.Y, force.Z);
638 //d.BodySetRotation(Body, ref m_StandUpRotation); 638 //d.BodySetRotation(Body, ref m_StandUpRotation);
639 //standupStraight(); 639 //standupStraight();
640 640
641 } 641 }
642 } 642 }
643 643
@@ -655,16 +655,16 @@ namespace OpenSim.Region.Physics.OdePlugin
655 { 655 {
656 // no lock; for now it's only called from within Simulate() 656 // no lock; for now it's only called from within Simulate()
657 657
658 // 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
659 // calculating base velocity to the current position 659 // calculating base velocity to the current position
660 660
661 661
662 if (m_pidControllerActive == false) 662 if (m_pidControllerActive == false)
663 { 663 {
664 _zeroPosition = d.BodyGetPosition(Body); 664 _zeroPosition = d.BodyGetPosition(Body);
665 } 665 }
666 //PidStatus = true; 666 //PidStatus = true;
667 667
668 PhysicsVector vec = new PhysicsVector(); 668 PhysicsVector vec = new PhysicsVector();
669 d.Vector3 vel = d.BodyGetLinearVel(Body); 669 d.Vector3 vel = d.BodyGetLinearVel(Body);
670 float movementdivisor = 1f; 670 float movementdivisor = 1f;
@@ -798,13 +798,13 @@ namespace OpenSim.Region.Physics.OdePlugin
798 _velocity.X = 0.0f; 798 _velocity.X = 0.0f;
799 _velocity.Y = 0.0f; 799 _velocity.Y = 0.0f;
800 _velocity.Z = 0.0f; 800 _velocity.Z = 0.0f;
801 801
802 // Did we send out the 'stopped' message? 802 // Did we send out the 'stopped' message?
803 if (!m_lastUpdateSent) 803 if (!m_lastUpdateSent)
804 { 804 {
805 m_lastUpdateSent = true; 805 m_lastUpdateSent = true;
806 //base.RequestPhysicsterseUpdate(); 806 //base.RequestPhysicsterseUpdate();
807 807
808 } 808 }
809 } 809 }
810 else 810 else
@@ -815,7 +815,7 @@ namespace OpenSim.Region.Physics.OdePlugin
815 _velocity.Y = (vec.Y); 815 _velocity.Y = (vec.Y);
816 816
817 _velocity.Z = (vec.Z); 817 _velocity.Z = (vec.Z);
818 818
819 if (_velocity.Z < -6 && !m_hackSentFall) 819 if (_velocity.Z < -6 && !m_hackSentFall)
820 { 820 {
821 m_hackSentFall = true; 821 m_hackSentFall = true;
@@ -849,7 +849,7 @@ namespace OpenSim.Region.Physics.OdePlugin
849 849
850 d.GeomDestroy(Shell); 850 d.GeomDestroy(Shell);
851 _parent_scene.geom_name_map.Remove(Shell); 851 _parent_scene.geom_name_map.Remove(Shell);
852 852
853 //kill the body 853 //kill the body
854 d.BodyDestroy(Body); 854 d.BodyDestroy(Body);
855 } 855 }