diff options
author | Robert Adams | 2012-12-10 15:35:53 -0800 |
---|---|---|
committer | Robert Adams | 2012-12-10 15:35:53 -0800 |
commit | 9df85eadf4b3719a898fda8769313ae023962c25 (patch) | |
tree | af055fb53368d75c236959bfde56d43f23e6f741 /OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs | |
parent | BulletSim: some comments about rebuilding linksets (having to recompute and r... (diff) | |
download | opensim-SC-9df85eadf4b3719a898fda8769313ae023962c25.zip opensim-SC-9df85eadf4b3719a898fda8769313ae023962c25.tar.gz opensim-SC-9df85eadf4b3719a898fda8769313ae023962c25.tar.bz2 opensim-SC-9df85eadf4b3719a898fda8769313ae023962c25.tar.xz |
BulletSim: Fix crash on the destruction of physical linksets.
While fixing the above, add methods to physical body and shape pointer
wrapper so routines won't have to know that IntPtr.Zero means no
physical instance.
Fix problem with physical linksets failing after a few sits and
unsits by properly restoring child prom positions for compound
linksets after multiple selection and deselections.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs index 6ce767d..3473006 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs | |||
@@ -94,7 +94,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys | |||
94 | m_terrainShape = new BulletShape(BulletSimAPI.CreateMeshShape2(PhysicsScene.World.ptr, | 94 | m_terrainShape = new BulletShape(BulletSimAPI.CreateMeshShape2(PhysicsScene.World.ptr, |
95 | indicesCount, indices, verticesCount, vertices), | 95 | indicesCount, indices, verticesCount, vertices), |
96 | BSPhysicsShapeType.SHAPE_MESH); | 96 | BSPhysicsShapeType.SHAPE_MESH); |
97 | if (m_terrainShape.ptr == IntPtr.Zero) | 97 | if (!m_terrainShape.HasPhysicalShape) |
98 | { | 98 | { |
99 | // DISASTER!! | 99 | // DISASTER!! |
100 | PhysicsScene.DetailLog("{0},BSTerrainMesh.create,failedCreationOfShape", ID); | 100 | PhysicsScene.DetailLog("{0},BSTerrainMesh.create,failedCreationOfShape", ID); |
@@ -107,7 +107,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys | |||
107 | Quaternion rot = Quaternion.Identity; | 107 | Quaternion rot = Quaternion.Identity; |
108 | 108 | ||
109 | m_terrainBody = new BulletBody(id, BulletSimAPI.CreateBodyWithDefaultMotionState2( m_terrainShape.ptr, ID, pos, rot)); | 109 | m_terrainBody = new BulletBody(id, BulletSimAPI.CreateBodyWithDefaultMotionState2( m_terrainShape.ptr, ID, pos, rot)); |
110 | if (m_terrainBody.ptr == IntPtr.Zero) | 110 | if (!m_terrainBody.HasPhysicalBody) |
111 | { | 111 | { |
112 | // DISASTER!! | 112 | // DISASTER!! |
113 | physicsScene.Logger.ErrorFormat("{0} Failed creation of terrain body! base={1}", LogHeader, TerrainBase); | 113 | physicsScene.Logger.ErrorFormat("{0} Failed creation of terrain body! base={1}", LogHeader, TerrainBase); |
@@ -140,7 +140,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys | |||
140 | 140 | ||
141 | public override void Dispose() | 141 | public override void Dispose() |
142 | { | 142 | { |
143 | if (m_terrainBody.ptr != IntPtr.Zero) | 143 | if (m_terrainBody.HasPhysicalBody) |
144 | { | 144 | { |
145 | BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, m_terrainBody.ptr); | 145 | BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, m_terrainBody.ptr); |
146 | // Frees both the body and the shape. | 146 | // Frees both the body and the shape. |