aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs
diff options
context:
space:
mode:
authorTeravus Ovares2009-04-07 00:13:08 +0000
committerTeravus Ovares2009-04-07 00:13:08 +0000
commit9459b16cc268ec39c05615ffdb86f6186a3105e7 (patch)
tree155dddb73bc1be302c28ef7d25d243bb5f864e6c /OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs
parentAdded some null-checks to Intimidated's patch in r9024. (diff)
downloadopensim-SC_OLD-9459b16cc268ec39c05615ffdb86f6186a3105e7.zip
opensim-SC_OLD-9459b16cc268ec39c05615ffdb86f6186a3105e7.tar.gz
opensim-SC_OLD-9459b16cc268ec39c05615ffdb86f6186a3105e7.tar.bz2
opensim-SC_OLD-9459b16cc268ec39c05615ffdb86f6186a3105e7.tar.xz
* BulletDotNET Updates.
* Should react somewhat normally to editing, and setting physics now.
Diffstat (limited to 'OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs')
-rw-r--r--OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs267
1 files changed, 210 insertions, 57 deletions
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs
index 58ec5fa..061a620 100644
--- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs
+++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs
@@ -178,6 +178,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
178 private btTransform tempTransform3; 178 private btTransform tempTransform3;
179 private btTransform tempTransform4; 179 private btTransform tempTransform4;
180 private btTriangleIndexVertexArray btshapeArray; 180 private btTriangleIndexVertexArray btshapeArray;
181 private bool forceenable = false;
181 182
182 public btRigidBody Body; 183 public btRigidBody Body;
183 184
@@ -722,66 +723,103 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
722 { 723 {
723 if (m_taintadd) 724 if (m_taintadd)
724 { 725 {
726 m_log.Debug("[PHYSICS]: TaintAdd");
725 changeadd(timestep); 727 changeadd(timestep);
726 } 728 }
727 729
728 if (prim_geom.Handle == IntPtr.Zero) 730 if (prim_geom.Handle == IntPtr.Zero)
729 { 731 {
730 CreateGeom(IntPtr.Zero, primMesh); 732 CreateGeom(IntPtr.Zero, primMesh);
731 733
732 if (IsPhysical) 734 if (IsPhysical)
733 SetBody(Mass); 735 SetBody(Mass);
734 else 736 else
735 SetBody(0); 737 SetBody(0);
738 m_log.Debug("[PHYSICS]: GEOM_DOESNT_EXSIT");
736 739
737 } 740 }
738 741
739 if (!_position.IsIdentical(m_taintposition, 0f)) 742 if (!_position.IsIdentical(m_taintposition, 0f))
743 {
744 m_log.Debug("[PHYSICS]: TaintMove");
740 changemove(timestep); 745 changemove(timestep);
741 746 }
742 if (m_taintrot != _orientation) 747 if (m_taintrot != _orientation)
748 {
749 m_log.Debug("[PHYSICS]: TaintRotate");
743 rotate(timestep); 750 rotate(timestep);
744 // 751 } //
745 752
746 if (m_taintPhysics != m_isphysical && !(m_taintparent != _parent)) 753 if (m_taintPhysics != m_isphysical && !(m_taintparent != _parent))
754 {
755 m_log.Debug("[PHYSICS]: TaintPhysics");
747 changePhysicsStatus(timestep); 756 changePhysicsStatus(timestep);
757 }
748 // 758 //
749 759
750 if (!_size.IsIdentical(m_taintsize, 0)) 760 if (!_size.IsIdentical(m_taintsize, 0))
761 {
762 m_log.Debug("[PHYSICS]: TaintSize");
751 changesize(timestep); 763 changesize(timestep);
752 // 764 }
765
766 //
753 767
754 if (m_taintshape) 768 if (m_taintshape)
769 {
770 m_log.Debug("[PHYSICS]: TaintShape");
755 changeshape(timestep); 771 changeshape(timestep);
756 // 772 } //
757 773
758 if (m_taintforce) 774 if (m_taintforce)
775 {
776 m_log.Debug("[PHYSICS]: TaintForce");
759 changeAddForce(timestep); 777 changeAddForce(timestep);
760 778 }
761 if (m_taintaddangularforce) 779 if (m_taintaddangularforce)
780 {
781 m_log.Debug("[PHYSICS]: TaintAngularForce");
762 changeAddAngularForce(timestep); 782 changeAddAngularForce(timestep);
763 783 }
764 if (!m_taintTorque.IsIdentical(PhysicsVector.Zero, 0.001f)) 784 if (!m_taintTorque.IsIdentical(PhysicsVector.Zero, 0.001f))
785 {
786 m_log.Debug("[PHYSICS]: TaintTorque");
765 changeSetTorque(timestep); 787 changeSetTorque(timestep);
766 788 }
767 if (m_taintdisable) 789 if (m_taintdisable)
790 {
791 m_log.Debug("[PHYSICS]: TaintDisable");
768 changedisable(timestep); 792 changedisable(timestep);
769 793 }
770 if (m_taintselected != m_isSelected) 794 if (m_taintselected != m_isSelected)
795 {
796 m_log.Debug("[PHYSICS]: TaintSelected");
771 changeSelectedStatus(timestep); 797 changeSelectedStatus(timestep);
772 798 }
773 if (!m_taintVelocity.IsIdentical(PhysicsVector.Zero, 0.001f)) 799 if (!m_taintVelocity.IsIdentical(PhysicsVector.Zero, 0.001f))
800 {
801 m_log.Debug("[PHYSICS]: TaintVelocity");
774 changevelocity(timestep); 802 changevelocity(timestep);
775 803 }
776 if (m_taintparent != _parent) 804 if (m_taintparent != _parent)
805 {
806 m_log.Debug("[PHYSICS]: TaintLink");
777 changelink(timestep); 807 changelink(timestep);
778 808 }
779 if (m_taintCollidesWater != m_collidesWater) 809 if (m_taintCollidesWater != m_collidesWater)
810 {
780 changefloatonwater(timestep); 811 changefloatonwater(timestep);
781 812 }
782 if (!m_angularlock.IsIdentical(m_taintAngularLock, 0)) 813 if (!m_angularlock.IsIdentical(m_taintAngularLock, 0))
814 {
815 m_log.Debug("[PHYSICS]: TaintAngularLock");
783 changeAngularLock(timestep); 816 changeAngularLock(timestep);
784 817 }
818 if (m_taintremove)
819 {
820 DisposeOfBody();
821 Dispose();
822 }
785 823
786 } 824 }
787 825
@@ -789,19 +827,41 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
789 827
790 private void changeadd(float timestep) 828 private void changeadd(float timestep)
791 { 829 {
792 if (_mesh == null) 830 //SetCollisionShape(null);
831 // Construction of new prim
832 if (Body != null)
793 { 833 {
794 if (_parent_scene.needsMeshing(_pbs)) 834 if (Body.Handle != IntPtr.Zero)
795 { 835 {
796 // Don't need to re-enable body.. it's done in SetMesh 836 _parent_scene.removeFromWorld(this, Body);
797 _mesh = _parent_scene.mesher.CreateMesh(m_primName, _pbs, _size, _parent_scene.meshSculptLOD, IsPhysical); 837 //Body.Dispose();
798 // createmesh returns null when it's a shape that isn't a cube.
799 } 838 }
839 //Body = null;
840 // TODO: dispose parts that make up body
800 } 841 }
801 CreateGeom(IntPtr.Zero, primMesh); 842 if (_parent_scene.needsMeshing(_pbs))
843 {
844 // Don't need to re-enable body.. it's done in SetMesh
845 float meshlod = _parent_scene.meshSculptLOD;
802 846
803 enableBody(); 847 if (IsPhysical)
804 changeSelectedStatus(timestep); 848 meshlod = _parent_scene.MeshSculptphysicalLOD;
849
850 IMesh mesh = _parent_scene.mesher.CreateMesh(SOPName, _pbs, _size, meshlod, IsPhysical);
851 // createmesh returns null when it doesn't mesh.
852 CreateGeom(IntPtr.Zero, mesh);
853 }
854 else
855 {
856 _mesh = null;
857 CreateGeom(IntPtr.Zero, null);
858 }
859
860 if (IsPhysical)
861 SetBody(Mass);
862 else
863 SetBody(0);
864 //changeSelectedStatus(timestep);
805 m_taintadd = false; 865 m_taintadd = false;
806 866
807 } 867 }
@@ -809,7 +869,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
809 private void changemove(float timestep) 869 private void changemove(float timestep)
810 { 870 {
811 871
812 872 m_log.Debug("[PHYSICS]: _________ChangeMove");
813 tempTransform2 = Body.getWorldTransform(); 873 tempTransform2 = Body.getWorldTransform();
814 btQuaternion quat = tempTransform2.getRotation(); 874 btQuaternion quat = tempTransform2.getRotation();
815 tempPosition2.setValue(_position.X, _position.Y, _position.Z); 875 tempPosition2.setValue(_position.X, _position.Y, _position.Z);
@@ -825,7 +885,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
825 885
826 private void rotate(float timestep) 886 private void rotate(float timestep)
827 { 887 {
828 888 m_log.Debug("[PHYSICS]: _________ChangeRotate");
829 tempTransform2 = Body.getWorldTransform(); 889 tempTransform2 = Body.getWorldTransform();
830 tempOrientation2 = new btQuaternion(_orientation.X, _orientation.Y, _orientation.Z, _orientation.W); 890 tempOrientation2 = new btQuaternion(_orientation.X, _orientation.Y, _orientation.Z, _orientation.W);
831 tempTransform2.setRotation(tempOrientation2); 891 tempTransform2.setRotation(tempOrientation2);
@@ -837,54 +897,100 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
837 897
838 private void changePhysicsStatus(float timestep) 898 private void changePhysicsStatus(float timestep)
839 { 899 {
900 if (Body != null)
901 {
902 if (Body.Handle != IntPtr.Zero)
903 {
904 _parent_scene.removeFromWorld(this, Body);
905 //Body.Dispose();
906 }
907 //Body = null;
908 // TODO: dispose parts that make up body
909 }
910 m_log.Debug("[PHYSICS]: _________ChangePhysics");
911 if (_parent_scene.needsMeshing(_pbs))
912 {
913 // Don't need to re-enable body.. it's done in SetMesh
914 float meshlod = _parent_scene.meshSculptLOD;
915
916 if (IsPhysical)
917 meshlod = _parent_scene.MeshSculptphysicalLOD;
918
919 IMesh mesh = _parent_scene.mesher.CreateMesh(SOPName, _pbs, _size, meshlod, IsPhysical);
920 // createmesh returns null when it doesn't mesh.
921 CreateGeom(IntPtr.Zero, mesh);
922 }
923 else
924 {
925 _mesh = null;
926 CreateGeom(IntPtr.Zero, null);
927 }
840 SetCollisionShape(prim_geom); 928 SetCollisionShape(prim_geom);
841 SetBody(Mass); 929 if (m_isphysical)
930 SetBody(Mass);
931 else
932 SetBody(0);
842 changeSelectedStatus(timestep); 933 changeSelectedStatus(timestep);
843 934
844 resetCollisionAccounting(); 935 resetCollisionAccounting();
845 m_taintPhysics = m_isphysical; 936 m_taintPhysics = m_isphysical;
846 } 937 }
847 938
848 private void changesize(float timestep) 939 private void changesize(float timestep)
849 { 940 {
941 if (Body != null)
942 {
943 if (Body.Handle != IntPtr.Zero)
944 {
945 _parent_scene.removeFromWorld(this, Body);
946 //Body.Dispose();
947 }
948 //Body = null;
949 // TODO: dispose parts that make up body
950 }
951
952 m_log.Debug("[PHYSICS]: _________ChangeSize");
850 SetCollisionShape(null); 953 SetCollisionShape(null);
851 // Construction of new prim 954 // Construction of new prim
852 if (_parent_scene.needsMeshing(_pbs)) 955 if (_parent_scene.needsMeshing(_pbs))
853 { 956 {
957 // Don't need to re-enable body.. it's done in SetMesh
854 float meshlod = _parent_scene.meshSculptLOD; 958 float meshlod = _parent_scene.meshSculptLOD;
855 959
856 if (IsPhysical) 960 if (IsPhysical)
857 meshlod = _parent_scene.MeshSculptphysicalLOD; 961 meshlod = _parent_scene.MeshSculptphysicalLOD;
858 // Don't need to re-enable body.. it's done in SetMesh
859
860 IMesh mesh = null;
861
862 if (_parent_scene.needsMeshing(_pbs))
863 mesh = _parent_scene.mesher.CreateMesh(SOPName, _pbs, _size, meshlod, IsPhysical);
864
865 //IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
866 962
963 IMesh mesh = _parent_scene.mesher.CreateMesh(SOPName, _pbs, _size, meshlod, IsPhysical);
964 // createmesh returns null when it doesn't mesh.
867 CreateGeom(IntPtr.Zero, mesh); 965 CreateGeom(IntPtr.Zero, mesh);
868
869
870 } 966 }
871 else 967 else
872 { 968 {
873 _mesh = null; 969 _mesh = null;
874 CreateGeom(IntPtr.Zero, _mesh); 970 CreateGeom(IntPtr.Zero, null);
875 } 971 }
876 972
877 if (IsPhysical) 973 if (IsPhysical)
878 SetBody(Mass); 974 SetBody(Mass);
879 else 975 else
880 SetBody(0); 976 SetBody(0);
881 977
882 m_taintsize = _size; 978 m_taintsize = _size;
883 979
884 } 980 }
885 981
886 private void changeshape(float timestep) 982 private void changeshape(float timestep)
887 { 983 {
984 if (Body != null)
985 {
986 if (Body.Handle != IntPtr.Zero)
987 {
988 _parent_scene.removeFromWorld(this, Body);
989 //Body.Dispose();
990 }
991 //Body = null;
992 // TODO: dispose parts that make up body
993 }
888 // Cleanup of old prim geometry and Bodies 994 // Cleanup of old prim geometry and Bodies
889 if (IsPhysical && Body != null && Body.Handle != IntPtr.Zero) 995 if (IsPhysical && Body != null && Body.Handle != IntPtr.Zero)
890 { 996 {
@@ -898,12 +1004,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
898 } 1004 }
899 else 1005 else
900 { 1006 {
901 disableBody(); 1007 //disableBody();
902 } 1008 }
903 } 1009 }
904 try 1010 try
905 { 1011 {
906 SetCollisionShape(null); 1012 //SetCollisionShape(null);
907 } 1013 }
908 catch (System.AccessViolationException) 1014 catch (System.AccessViolationException)
909 { 1015 {
@@ -968,6 +1074,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
968 } 1074 }
969 } 1075 }
970 resetCollisionAccounting(); 1076 resetCollisionAccounting();
1077
971 m_taintshape = false; 1078 m_taintshape = false;
972 } 1079 }
973 1080
@@ -1004,6 +1111,16 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1004 private void changeSelectedStatus(float timestep) 1111 private void changeSelectedStatus(float timestep)
1005 { 1112 {
1006 // TODO: throw new NotImplementedException(); 1113 // TODO: throw new NotImplementedException();
1114 if (m_taintselected)
1115 {
1116 disableBodySoft();
1117 }
1118 else
1119 {
1120 enableBodySoft();
1121 }
1122 m_isSelected = m_taintselected;
1123
1007 } 1124 }
1008 1125
1009 private void changevelocity(float timestep) 1126 private void changevelocity(float timestep)
@@ -1584,6 +1701,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1584 1701
1585 public void CreateGeom(IntPtr m_targetSpace, IMesh p_mesh) 1702 public void CreateGeom(IntPtr m_targetSpace, IMesh p_mesh)
1586 { 1703 {
1704 m_log.Debug("[PHYSICS]: _________CreateGeom");
1587 if (p_mesh != null) 1705 if (p_mesh != null)
1588 { 1706 {
1589 _mesh = _parent_scene.mesher.CreateMesh(m_primName, _pbs, _size, _parent_scene.meshSculptLOD, IsPhysical); 1707 _mesh = _parent_scene.mesher.CreateMesh(m_primName, _pbs, _size, _parent_scene.meshSculptLOD, IsPhysical);
@@ -1631,7 +1749,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1631 // TODO: Set Collision Body Mesh 1749 // TODO: Set Collision Body Mesh
1632 // This sleeper is there to moderate how long it takes between 1750 // This sleeper is there to moderate how long it takes between
1633 // setting up the mesh and pre-processing it when we get rapid fire mesh requests on a single object 1751 // setting up the mesh and pre-processing it when we get rapid fire mesh requests on a single object
1634 1752 m_log.Debug("_________SetMesh");
1635 Thread.Sleep(10); 1753 Thread.Sleep(10);
1636 1754
1637 //Kill Body so that mesh can re-make the geom 1755 //Kill Body so that mesh can re-make the geom
@@ -1647,7 +1765,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1647 } 1765 }
1648 else 1766 else
1649 { 1767 {
1650 disableBody(); 1768 //disableBody();
1651 } 1769 }
1652 } 1770 }
1653 1771
@@ -1683,11 +1801,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1683 1801
1684 private void SetCollisionShape(btCollisionShape shape) 1802 private void SetCollisionShape(btCollisionShape shape)
1685 { 1803 {
1804 /*
1686 if (shape == null) 1805 if (shape == null)
1687 m_log.Debug("[PHYSICS]:SetShape!Null"); 1806 m_log.Debug("[PHYSICS]:SetShape!Null");
1688 else 1807 else
1689 m_log.Debug("[PHYSICS]:SetShape!"); 1808 m_log.Debug("[PHYSICS]:SetShape!");
1690 1809
1691 if (Body != null) 1810 if (Body != null)
1692 { 1811 {
1693 DisposeOfBody(); 1812 DisposeOfBody();
@@ -1698,6 +1817,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1698 prim_geom.Dispose(); 1817 prim_geom.Dispose();
1699 prim_geom = null; 1818 prim_geom = null;
1700 } 1819 }
1820 */
1701 prim_geom = shape; 1821 prim_geom = shape;
1702 1822
1703 //Body.set 1823 //Body.set
@@ -1705,12 +1825,13 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1705 1825
1706 public void SetBody(float mass) 1826 public void SetBody(float mass)
1707 { 1827 {
1708 m_log.DebugFormat("[PHYSICS]: SetBody! {0}",mass); 1828 //m_log.DebugFormat("[PHYSICS]: SetBody! {0}",mass);
1829 /*
1709 if (Body != null && Body.Handle != IntPtr.Zero) 1830 if (Body != null && Body.Handle != IntPtr.Zero)
1710 { 1831 {
1711 DisposeOfBody(); 1832 DisposeOfBody();
1712 } 1833 }
1713 1834 */
1714 if (tempMotionState1 != null && tempMotionState1.Handle != IntPtr.Zero) 1835 if (tempMotionState1 != null && tempMotionState1.Handle != IntPtr.Zero)
1715 tempMotionState1.Dispose(); 1836 tempMotionState1.Dispose();
1716 if (tempTransform2 != null && tempTransform2.Handle != IntPtr.Zero) 1837 if (tempTransform2 != null && tempTransform2.Handle != IntPtr.Zero)
@@ -1728,18 +1849,41 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1728 if (tempInertia1 != null && tempInertia1.Handle != IntPtr.Zero) 1849 if (tempInertia1 != null && tempInertia1.Handle != IntPtr.Zero)
1729 tempInertia1.Dispose(); 1850 tempInertia1.Dispose();
1730 tempInertia1 = new btVector3(0, 0, 0); 1851 tempInertia1 = new btVector3(0, 0, 0);
1852 /*
1731 if (prim_geom.Handle == IntPtr.Zero) 1853 if (prim_geom.Handle == IntPtr.Zero)
1732 { 1854 {
1733 m_log.Warn("[PHYSICS]:PrimGeom is Disposed!"); 1855 m_log.Warn("[PHYSICS]:PrimGeom is Disposed!");
1734 CreateGeom(IntPtr.Zero, primMesh); 1856 if (_parent_scene.needsMeshing(_pbs))
1857 {
1858 // Don't need to re-enable body.. it's done in SetMesh
1859 float meshlod = _parent_scene.meshSculptLOD;
1860
1861 if (IsPhysical)
1862 meshlod = _parent_scene.MeshSculptphysicalLOD;
1863
1864 IMesh mesh = _parent_scene.mesher.CreateMesh(SOPName, _pbs, _size, meshlod, IsPhysical);
1865 // createmesh returns null when it doesn't mesh.
1866 CreateGeom(IntPtr.Zero, mesh);
1867 }
1868 else
1869 {
1870 _mesh = null;
1871 CreateGeom(IntPtr.Zero, null);
1872 }
1735 1873
1736 } 1874 }
1875 */
1876
1737 prim_geom.calculateLocalInertia(mass, tempInertia1); 1877 prim_geom.calculateLocalInertia(mass, tempInertia1);
1738 1878
1739 if (mass == 0) 1879 if (mass != 0)
1740 Body = new btRigidBody(mass, tempMotionState1, prim_geom); 1880 _parent_scene.addActivePrim(this);
1741 else 1881 else
1742 Body = new btRigidBody(mass, tempMotionState1, prim_geom, tempInertia1); 1882 _parent_scene.remActivePrim(this);
1883
1884 // Body = new btRigidBody(mass, tempMotionState1, prim_geom);
1885 //else
1886 Body = new btRigidBody(mass, tempMotionState1, prim_geom, tempInertia1);
1743 1887
1744 if (prim_geom is btGImpactMeshShape) 1888 if (prim_geom is btGImpactMeshShape)
1745 { 1889 {
@@ -1810,6 +1954,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1810 public void disableBody() 1954 public void disableBody()
1811 { 1955 {
1812 //this kills the body so things like 'mesh' can re-create it. 1956 //this kills the body so things like 'mesh' can re-create it.
1957 /*
1813 lock (this) 1958 lock (this)
1814 { 1959 {
1815 if (!childPrim) 1960 if (!childPrim)
@@ -1861,6 +2006,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1861 } 2006 }
1862 2007
1863 } 2008 }
2009 */
1864 m_disabled = true; 2010 m_disabled = true;
1865 m_collisionscore = 0; 2011 m_collisionscore = 0;
1866 } 2012 }
@@ -1885,7 +2031,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1885 if (m_isphysical && Body.Handle != IntPtr.Zero) 2031 if (m_isphysical && Body.Handle != IntPtr.Zero)
1886 { 2032 {
1887 Body.clearForces(); 2033 Body.clearForces();
1888 Body.forceActivationState(1); 2034 Body.forceActivationState(4);
2035 forceenable = true;
2036
1889 } 2037 }
1890 m_disabled = false; 2038 m_disabled = false;
1891 } 2039 }
@@ -1922,8 +2070,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1922 { 2070 {
1923 PhysicsVector pv = new PhysicsVector(0, 0, 0); 2071 PhysicsVector pv = new PhysicsVector(0, 0, 0);
1924 bool lastZeroFlag = _zeroFlag; 2072 bool lastZeroFlag = _zeroFlag;
1925 if (tempPosition2 != null && tempPosition2.Handle != IntPtr.Zero) 2073 if (tempPosition3 != null && tempPosition3.Handle != IntPtr.Zero)
1926 tempPosition2.Dispose(); 2074 tempPosition3.Dispose();
1927 if (tempTransform3 != null && tempTransform3.Handle != IntPtr.Zero) 2075 if (tempTransform3 != null && tempTransform3.Handle != IntPtr.Zero)
1928 tempTransform3.Dispose(); 2076 tempTransform3.Dispose();
1929 2077
@@ -1939,7 +2087,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1939 2087
1940 2088
1941 tempTransform3 = Body.getInterpolationWorldTransform(); 2089 tempTransform3 = Body.getInterpolationWorldTransform();
1942 tempPosition2 = tempTransform3.getOrigin(); // vec 2090 tempPosition3 = tempTransform3.getOrigin(); // vec
1943 tempOrientation2 = tempTransform3.getRotation(); // ori 2091 tempOrientation2 = tempTransform3.getRotation(); // ori
1944 tempAngularVelocity1 = Body.getInterpolationAngularVelocity(); //rotvel 2092 tempAngularVelocity1 = Body.getInterpolationAngularVelocity(); //rotvel
1945 tempLinearVelocity1 = Body.getInterpolationLinearVelocity(); // vel 2093 tempLinearVelocity1 = Body.getInterpolationLinearVelocity(); // vel
@@ -1950,9 +2098,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
1950 m_lastposition = _position; 2098 m_lastposition = _position;
1951 m_lastorientation = _orientation; 2099 m_lastorientation = _orientation;
1952 2100
1953 l_position.X = tempPosition2.getX(); 2101 l_position.X = tempPosition3.getX();
1954 l_position.Y = tempPosition2.getY(); 2102 l_position.Y = tempPosition3.getY();
1955 l_position.Z = tempPosition2.getZ(); 2103 l_position.Z = tempPosition3.getZ();
1956 l_orientation.X = tempOrientation2.getX(); 2104 l_orientation.X = tempOrientation2.getX();
1957 l_orientation.Y = tempOrientation2.getY(); 2105 l_orientation.Y = tempOrientation2.getY();
1958 l_orientation.Z = tempOrientation2.getZ(); 2106 l_orientation.Z = tempOrientation2.getZ();
@@ -2103,6 +2251,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
2103 2251
2104 } 2252 }
2105 m_lastposition = l_position; 2253 m_lastposition = l_position;
2254 if (forceenable)
2255 {
2256 Body.forceActivationState(1);
2257 forceenable = false;
2258 }
2106 } 2259 }
2107 else 2260 else
2108 { 2261 {