diff options
author | Teravus Ovares | 2008-02-17 11:50:15 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-02-17 11:50:15 +0000 |
commit | e33a0c5fc0b107a99b34ff3c9016f8de178d0d47 (patch) | |
tree | 64c76241f758892c1a3693f6767d17b68ae18377 /OpenSim/Region/Physics | |
parent | * Located and destroyed the weird velocity and rotation transfers. It turned... (diff) | |
download | opensim-SC-e33a0c5fc0b107a99b34ff3c9016f8de178d0d47.zip opensim-SC-e33a0c5fc0b107a99b34ff3c9016f8de178d0d47.tar.gz opensim-SC-e33a0c5fc0b107a99b34ff3c9016f8de178d0d47.tar.bz2 opensim-SC-e33a0c5fc0b107a99b34ff3c9016f8de178d0d47.tar.xz |
* Fixed the Ghost physical hull on deleting a physical Prim
* Fixed a deadlock when there is an exception in the collision and stepping parts of Simulate.
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 136 |
1 files changed, 75 insertions, 61 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index d7d9ab1..0fd4f4d 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -755,74 +755,77 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
755 | prim.disableBody(); | 755 | prim.disableBody(); |
756 | } | 756 | } |
757 | // we don't want to remove the main space | 757 | // we don't want to remove the main space |
758 | if (prim.m_targetSpace != space && prim.IsPhysical == false) | 758 | |
759 | { | 759 | // If the geometry is in the targetspace, remove it from the target space |
760 | // If the geometry is in the targetspace, remove it from the target space | 760 | //m_log.Warn(prim.m_targetSpace); |
761 | //m_log.Warn(prim.m_targetSpace); | ||
762 | 761 | ||
763 | 762 | ||
764 | if (prim.m_targetSpace != (IntPtr)0) | 763 | if (prim.m_targetSpace != (IntPtr)0) |
764 | { | ||
765 | if (d.SpaceQuery(prim.m_targetSpace, prim.prim_geom)) | ||
765 | { | 766 | { |
766 | if (d.SpaceQuery(prim.m_targetSpace, prim.prim_geom)) | ||
767 | { | ||
768 | |||
769 | if (d.GeomIsSpace(prim.m_targetSpace)) | ||
770 | { | ||
771 | waitForSpaceUnlock(prim.m_targetSpace); | ||
772 | d.SpaceRemove(prim.m_targetSpace, prim.prim_geom); | ||
773 | prim.m_targetSpace = space; | ||
774 | } | ||
775 | else | ||
776 | { | ||
777 | m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" + | ||
778 | ((OdePrim)prim).m_targetSpace.ToString()); | ||
779 | } | ||
780 | 767 | ||
768 | if (d.GeomIsSpace(prim.m_targetSpace)) | ||
769 | { | ||
770 | waitForSpaceUnlock(prim.m_targetSpace); | ||
771 | d.SpaceRemove(prim.m_targetSpace, prim.prim_geom); | ||
772 | prim.m_targetSpace = space; | ||
781 | } | 773 | } |
782 | } | 774 | else |
783 | //m_log.Warn(prim.prim_geom); | ||
784 | try | ||
785 | { | ||
786 | if (prim.prim_geom != (IntPtr)0) | ||
787 | { | 775 | { |
788 | d.GeomDestroy(prim.prim_geom); | 776 | m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" + |
789 | prim.prim_geom = (IntPtr)0; | 777 | ((OdePrim)prim).m_targetSpace.ToString()); |
790 | } | 778 | } |
791 | 779 | ||
792 | } | 780 | } |
793 | catch (System.AccessViolationException) | 781 | } |
782 | //m_log.Warn(prim.prim_geom); | ||
783 | try | ||
784 | { | ||
785 | if (prim.prim_geom != (IntPtr)0) | ||
794 | { | 786 | { |
795 | m_log.Info("[PHYSICS]: Couldn't remove prim from physics scene, it was already be removed."); | 787 | d.GeomDestroy(prim.prim_geom); |
788 | prim.prim_geom = (IntPtr)0; | ||
789 | } | ||
790 | else | ||
791 | { | ||
792 | m_log.Warn("[PHYSICS]: Unable to remove prim from physics scene"); | ||
796 | } | 793 | } |
797 | _prims.Remove(prim); | ||
798 | 794 | ||
799 | //If there are no more geometries in the sub-space, we don't need it in the main space anymore | ||
800 | //if (d.SpaceGetNumGeoms(prim.m_targetSpace) == 0) | ||
801 | //{ | ||
802 | //if (!(prim.m_targetSpace.Equals(null))) | ||
803 | //{ | ||
804 | //if (d.GeomIsSpace(prim.m_targetSpace)) | ||
805 | //{ | ||
806 | //waitForSpaceUnlock(prim.m_targetSpace); | ||
807 | //d.SpaceRemove(space, prim.m_targetSpace); | ||
808 | // free up memory used by the space. | ||
809 | //d.SpaceDestroy(prim.m_targetSpace); | ||
810 | //int[] xyspace = calculateSpaceArrayItemFromPos(prim.Position); | ||
811 | //resetSpaceArrayItemToZero(xyspace[0], xyspace[1]); | ||
812 | //} | ||
813 | //else | ||
814 | //{ | ||
815 | //m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" + | ||
816 | //((OdePrim) prim).m_targetSpace.ToString()); | ||
817 | //} | ||
818 | //} | ||
819 | //} | ||
820 | } | 795 | } |
796 | catch (System.AccessViolationException) | ||
797 | { | ||
798 | m_log.Info("[PHYSICS]: Couldn't remove prim from physics scene, it was already be removed."); | ||
799 | } | ||
800 | _prims.Remove(prim); | ||
801 | |||
802 | //If there are no more geometries in the sub-space, we don't need it in the main space anymore | ||
803 | //if (d.SpaceGetNumGeoms(prim.m_targetSpace) == 0) | ||
804 | //{ | ||
805 | //if (!(prim.m_targetSpace.Equals(null))) | ||
806 | //{ | ||
807 | //if (d.GeomIsSpace(prim.m_targetSpace)) | ||
808 | //{ | ||
809 | //waitForSpaceUnlock(prim.m_targetSpace); | ||
810 | //d.SpaceRemove(space, prim.m_targetSpace); | ||
811 | // free up memory used by the space. | ||
812 | //d.SpaceDestroy(prim.m_targetSpace); | ||
813 | //int[] xyspace = calculateSpaceArrayItemFromPos(prim.Position); | ||
814 | //resetSpaceArrayItemToZero(xyspace[0], xyspace[1]); | ||
815 | //} | ||
816 | //else | ||
817 | //{ | ||
818 | //m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" + | ||
819 | //((OdePrim) prim).m_targetSpace.ToString()); | ||
820 | //} | ||
821 | //} | ||
822 | //} | ||
823 | } | ||
821 | 824 | ||
822 | 825 | ||
823 | 826 | ||
824 | ode.dunlock(world); | 827 | ode.dunlock(world); |
825 | } | 828 | |
826 | } | 829 | } |
827 | } | 830 | } |
828 | /// <summary> | 831 | /// <summary> |
@@ -1261,19 +1264,30 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1261 | if (!ode.lockquery()) | 1264 | if (!ode.lockquery()) |
1262 | { | 1265 | { |
1263 | ode.dlock(world); | 1266 | ode.dlock(world); |
1264 | foreach (OdeCharacter actor in _characters) | 1267 | try |
1265 | { | 1268 | { |
1266 | actor.Move(timeStep); | 1269 | foreach (OdeCharacter actor in _characters) |
1267 | 1270 | { | |
1268 | } | 1271 | actor.Move(timeStep); |
1269 | 1272 | ||
1273 | } | ||
1274 | |||
1270 | 1275 | ||
1271 | collision_optimized(timeStep); | 1276 | collision_optimized(timeStep); |
1272 | 1277 | ||
1273 | d.WorldQuickStep(world, ODE_STEPSIZE); | 1278 | d.WorldQuickStep(world, ODE_STEPSIZE); |
1274 | 1279 | ||
1275 | d.JointGroupEmpty(contactgroup); | 1280 | d.JointGroupEmpty(contactgroup); |
1276 | ode.dunlock(world); | 1281 | ode.dunlock(world); |
1282 | } | ||
1283 | catch (Exception e) | ||
1284 | { | ||
1285 | m_log.Error("[PHYSICS]: " + e.Message.ToString() + e.TargetSite.ToString()); | ||
1286 | ode.dunlock(world); | ||
1287 | } | ||
1288 | |||
1289 | |||
1290 | |||
1277 | 1291 | ||
1278 | step_time -= ODE_STEPSIZE; | 1292 | step_time -= ODE_STEPSIZE; |
1279 | i++; | 1293 | i++; |