aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
diff options
context:
space:
mode:
authorRobert Adams2012-12-21 15:21:32 -0800
committerRobert Adams2012-12-21 15:21:32 -0800
commit6dbf9c8ed4ca5646f47043f9937da5acbe124d0e (patch)
tree337ec47d2093834ccef03f83816ec3f203315c6f /OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
parentBulletSim: Move all the parameter variables, tables and get and fetch logic t... (diff)
downloadopensim-SC_OLD-6dbf9c8ed4ca5646f47043f9937da5acbe124d0e.zip
opensim-SC_OLD-6dbf9c8ed4ca5646f47043f9937da5acbe124d0e.tar.gz
opensim-SC_OLD-6dbf9c8ed4ca5646f47043f9937da5acbe124d0e.tar.bz2
opensim-SC_OLD-6dbf9c8ed4ca5646f47043f9937da5acbe124d0e.tar.xz
BulletSim: repair vehicle problems introduced in previous 'improvements'. Fix line endings in BSParams.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs37
1 files changed, 28 insertions, 9 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index e59ed8d..3fde57b 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -634,28 +634,33 @@ namespace OpenSim.Region.Physics.BulletSPlugin
634 m_knownHas = 0; 634 m_knownHas = 0;
635 m_knownChanged = 0; 635 m_knownChanged = 0;
636 } 636 }
637 // Push all the changed values back into the physics engine
637 private void PushKnownChanged() 638 private void PushKnownChanged()
638 { 639 {
639 if (m_knownChanged != 0) 640 if (m_knownChanged != 0)
640 { 641 {
641 if ((m_knownChanged & m_knownChangedPosition) != 0) 642 if ((m_knownChanged & m_knownChangedPosition) != 0)
642 Prim.ForcePosition = VehiclePosition; 643 Prim.ForcePosition = m_knownPosition;
644
643 if ((m_knownChanged & m_knownChangedOrientation) != 0) 645 if ((m_knownChanged & m_knownChangedOrientation) != 0)
644 Prim.ForceOrientation = VehicleOrientation; 646 Prim.ForceOrientation = m_knownOrientation;
647
645 if ((m_knownChanged & m_knownChangedVelocity) != 0) 648 if ((m_knownChanged & m_knownChangedVelocity) != 0)
646 { 649 {
647 Prim.ForceVelocity = VehicleVelocity; 650 Prim.ForceVelocity = m_knownVelocity;
648 BulletSimAPI.SetInterpolationLinearVelocity2(Prim.PhysBody.ptr, VehicleVelocity); 651 BulletSimAPI.SetInterpolationLinearVelocity2(Prim.PhysBody.ptr, VehicleVelocity);
649 } 652 }
653
650 if ((m_knownChanged & m_knownChangedForce) != 0) 654 if ((m_knownChanged & m_knownChangedForce) != 0)
651 Prim.AddForce((Vector3)m_knownForce, false, true); 655 Prim.AddForce((Vector3)m_knownForce, false, true);
652 656
653 if ((m_knownChanged & m_knownChangedRotationalVelocity) != 0) 657 if ((m_knownChanged & m_knownChangedRotationalVelocity) != 0)
654 { 658 {
655 Prim.ForceRotationalVelocity = VehicleRotationalVelocity; 659 Prim.ForceRotationalVelocity = m_knownRotationalVelocity;
656 // Fake out Bullet by making it think the velocity is the same as last time. 660 // Fake out Bullet by making it think the velocity is the same as last time.
657 BulletSimAPI.SetInterpolationAngularVelocity2(Prim.PhysBody.ptr, VehicleRotationalVelocity); 661 BulletSimAPI.SetInterpolationAngularVelocity2(Prim.PhysBody.ptr, m_knownRotationalVelocity);
658 } 662 }
663
659 if ((m_knownChanged & m_knownChangedRotationalForce) != 0) 664 if ((m_knownChanged & m_knownChangedRotationalForce) != 0)
660 Prim.AddAngularForce((Vector3)m_knownRotationalForce, false, true); 665 Prim.AddAngularForce((Vector3)m_knownRotationalForce, false, true);
661 666
@@ -667,7 +672,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
667 } 672 }
668 673
669 // Since the computation of terrain height can be a little involved, this routine 674 // Since the computation of terrain height can be a little involved, this routine
670 // is used ot fetch the height only once for each vehicle simulation step. 675 // is used to fetch the height only once for each vehicle simulation step.
671 private float GetTerrainHeight(Vector3 pos) 676 private float GetTerrainHeight(Vector3 pos)
672 { 677 {
673 if ((m_knownHas & m_knownChangedTerrainHeight) == 0) 678 if ((m_knownHas & m_knownChangedTerrainHeight) == 0)
@@ -699,12 +704,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin
699 m_knownPosition = Prim.ForcePosition; 704 m_knownPosition = Prim.ForcePosition;
700 m_knownHas |= m_knownChangedPosition; 705 m_knownHas |= m_knownChangedPosition;
701 } 706 }
702 return (Vector3)m_knownPosition; 707 return m_knownPosition;
703 } 708 }
704 set 709 set
705 { 710 {
706 m_knownPosition = value; 711 m_knownPosition = value;
707 m_knownChanged |= m_knownChangedPosition; 712 m_knownChanged |= m_knownChangedPosition;
713 m_knownHas |= m_knownChangedPosition;
708 } 714 }
709 } 715 }
710 716
@@ -717,12 +723,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin
717 m_knownOrientation = Prim.ForceOrientation; 723 m_knownOrientation = Prim.ForceOrientation;
718 m_knownHas |= m_knownChangedOrientation; 724 m_knownHas |= m_knownChangedOrientation;
719 } 725 }
720 return (Quaternion)m_knownOrientation; 726 return m_knownOrientation;
721 } 727 }
722 set 728 set
723 { 729 {
724 m_knownOrientation = value; 730 m_knownOrientation = value;
725 m_knownChanged |= m_knownChangedOrientation; 731 m_knownChanged |= m_knownChangedOrientation;
732 m_knownHas |= m_knownChangedOrientation;
726 } 733 }
727 } 734 }
728 735
@@ -741,13 +748,19 @@ namespace OpenSim.Region.Physics.BulletSPlugin
741 { 748 {
742 m_knownVelocity = value; 749 m_knownVelocity = value;
743 m_knownChanged |= m_knownChangedVelocity; 750 m_knownChanged |= m_knownChangedVelocity;
751 m_knownHas |= m_knownChangedVelocity;
744 } 752 }
745 } 753 }
746 754
747 private void VehicleAddForce(Vector3 aForce) 755 private void VehicleAddForce(Vector3 aForce)
748 { 756 {
757 if ((m_knownHas & m_knownChangedForce) == 0)
758 {
759 m_knownForce = Vector3.Zero;
760 }
749 m_knownForce += aForce; 761 m_knownForce += aForce;
750 m_knownChanged |= m_knownChangedForce; 762 m_knownChanged |= m_knownChangedForce;
763 m_knownHas |= m_knownChangedForce;
751 } 764 }
752 765
753 private Vector3 VehicleRotationalVelocity 766 private Vector3 VehicleRotationalVelocity
@@ -765,12 +778,18 @@ namespace OpenSim.Region.Physics.BulletSPlugin
765 { 778 {
766 m_knownRotationalVelocity = value; 779 m_knownRotationalVelocity = value;
767 m_knownChanged |= m_knownChangedRotationalVelocity; 780 m_knownChanged |= m_knownChangedRotationalVelocity;
781 m_knownHas |= m_knownChangedRotationalVelocity;
768 } 782 }
769 } 783 }
770 private void VehicleAddAngularForce(Vector3 aForce) 784 private void VehicleAddAngularForce(Vector3 aForce)
771 { 785 {
786 if ((m_knownHas & m_knownChangedRotationalForce) == 0)
787 {
788 m_knownRotationalForce = Vector3.Zero;
789 }
772 m_knownRotationalForce += aForce; 790 m_knownRotationalForce += aForce;
773 m_knownChanged |= m_knownChangedRotationalForce; 791 m_knownChanged |= m_knownChangedRotationalForce;
792 m_knownHas |= m_knownChangedRotationalForce;
774 } 793 }
775 // Vehicle relative forward velocity 794 // Vehicle relative forward velocity
776 private Vector3 VehicleForwardVelocity 795 private Vector3 VehicleForwardVelocity
@@ -782,7 +801,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
782 m_knownForwardVelocity = VehicleVelocity * Quaternion.Inverse(Quaternion.Normalize(VehicleOrientation)); 801 m_knownForwardVelocity = VehicleVelocity * Quaternion.Inverse(Quaternion.Normalize(VehicleOrientation));
783 m_knownHas |= m_knownChangedForwardVelocity; 802 m_knownHas |= m_knownChangedForwardVelocity;
784 } 803 }
785 return (Vector3)m_knownForwardVelocity; 804 return m_knownForwardVelocity;
786 } 805 }
787 } 806 }
788 private float VehicleForwardSpeed 807 private float VehicleForwardSpeed