diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 90 |
1 files changed, 65 insertions, 25 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index bf8ca0e..c37b632 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -380,10 +380,23 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
380 | set | 380 | set |
381 | { | 381 | { |
382 | if (Body == IntPtr.Zero || Shell == IntPtr.Zero) | 382 | if (Body == IntPtr.Zero || Shell == IntPtr.Zero) |
383 | _position.X = value.X; _position.Y = value.Y; _position.Z = value.Z; | 383 | { |
384 | 384 | if (PhysicsVector.isFinite(value)) | |
385 | m_taintPosition.X = value.X; m_taintPosition.Y = value.Y; m_taintPosition.Z = value.Z; | 385 | { |
386 | _parent_scene.AddPhysicsActorTaint(this); | 386 | _position.X = value.X; |
387 | _position.Y = value.Y; | ||
388 | _position.Z = value.Z; | ||
389 | |||
390 | m_taintPosition.X = value.X; | ||
391 | m_taintPosition.Y = value.Y; | ||
392 | m_taintPosition.Z = value.Z; | ||
393 | _parent_scene.AddPhysicsActorTaint(this); | ||
394 | } | ||
395 | else | ||
396 | { | ||
397 | m_log.Warn("[PHYSICS]: Got a NaN Position from Scene on a Character"); | ||
398 | } | ||
399 | } | ||
387 | } | 400 | } |
388 | } | 401 | } |
389 | 402 | ||
@@ -402,15 +415,22 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
402 | get { return new PhysicsVector(CAPSULE_RADIUS*2, CAPSULE_RADIUS*2, CAPSULE_LENGTH); } | 415 | get { return new PhysicsVector(CAPSULE_RADIUS*2, CAPSULE_RADIUS*2, CAPSULE_LENGTH); } |
403 | set | 416 | set |
404 | { | 417 | { |
405 | m_pidControllerActive = true; | 418 | if (PhysicsVector.isFinite(value)) |
406 | 419 | { | |
420 | m_pidControllerActive = true; | ||
421 | |||
407 | PhysicsVector SetSize = value; | 422 | PhysicsVector SetSize = value; |
408 | m_tainted_CAPSULE_LENGTH = (SetSize.Z * 1.15f) - CAPSULE_RADIUS * 2.0f; | 423 | m_tainted_CAPSULE_LENGTH = (SetSize.Z*1.15f) - CAPSULE_RADIUS*2.0f; |
409 | //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); | 424 | //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); |
410 | 425 | ||
411 | Velocity = new PhysicsVector(0f, 0f, 0f); | 426 | Velocity = new PhysicsVector(0f, 0f, 0f); |
412 | 427 | ||
413 | _parent_scene.AddPhysicsActorTaint(this); | 428 | _parent_scene.AddPhysicsActorTaint(this); |
429 | } | ||
430 | else | ||
431 | { | ||
432 | m_log.Warn("[PHYSICS]: Got a NaN Size from Scene on a Character"); | ||
433 | } | ||
414 | } | 434 | } |
415 | } | 435 | } |
416 | 436 | ||
@@ -616,8 +636,15 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
616 | } | 636 | } |
617 | set | 637 | set |
618 | { | 638 | { |
619 | m_pidControllerActive = true; | 639 | if (PhysicsVector.isFinite(value)) |
620 | _target_velocity = value; | 640 | { |
641 | m_pidControllerActive = true; | ||
642 | _target_velocity = value; | ||
643 | } | ||
644 | else | ||
645 | { | ||
646 | m_log.Warn("[PHYSICS]: Got a NaN velocity from Scene in a Character"); | ||
647 | } | ||
621 | } | 648 | } |
622 | } | 649 | } |
623 | 650 | ||
@@ -667,22 +694,29 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
667 | /// <param name="force"></param> | 694 | /// <param name="force"></param> |
668 | public override void AddForce(PhysicsVector force, bool pushforce) | 695 | public override void AddForce(PhysicsVector force, bool pushforce) |
669 | { | 696 | { |
670 | if (pushforce) | 697 | if (PhysicsVector.isFinite(force)) |
671 | { | 698 | { |
672 | m_pidControllerActive = false; | 699 | if (pushforce) |
673 | force *= 100f; | 700 | { |
674 | doForce(force); | 701 | m_pidControllerActive = false; |
675 | //m_log.Debug("Push!"); | 702 | force *= 100f; |
676 | //_target_velocity.X += force.X; | 703 | doForce(force); |
677 | // _target_velocity.Y += force.Y; | 704 | //m_log.Debug("Push!"); |
678 | //_target_velocity.Z += force.Z; | 705 | //_target_velocity.X += force.X; |
706 | // _target_velocity.Y += force.Y; | ||
707 | //_target_velocity.Z += force.Z; | ||
708 | } | ||
709 | else | ||
710 | { | ||
711 | m_pidControllerActive = true; | ||
712 | _target_velocity.X += force.X; | ||
713 | _target_velocity.Y += force.Y; | ||
714 | _target_velocity.Z += force.Z; | ||
715 | } | ||
679 | } | 716 | } |
680 | else | 717 | else |
681 | { | 718 | { |
682 | m_pidControllerActive = true; | 719 | m_log.Warn("[PHYSICS]: Got a NaN force applied to a Character"); |
683 | _target_velocity.X += force.X; | ||
684 | _target_velocity.Y += force.Y; | ||
685 | _target_velocity.Z += force.Z; | ||
686 | } | 720 | } |
687 | //m_lastUpdateSent = false; | 721 | //m_lastUpdateSent = false; |
688 | } | 722 | } |
@@ -847,8 +881,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
847 | // end add Kitto Flora | 881 | // end add Kitto Flora |
848 | 882 | ||
849 | } | 883 | } |
850 | 884 | if (PhysicsVector.isFinite(vec)) | |
851 | doForce(vec); | 885 | { |
886 | doForce(vec); | ||
887 | } | ||
888 | else | ||
889 | { | ||
890 | m_log.Warn("[PHYSICS]: Got a NaN force vector in Move()"); | ||
891 | } | ||
852 | } | 892 | } |
853 | 893 | ||
854 | /// <summary> | 894 | /// <summary> |