aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs18
1 files changed, 9 insertions, 9 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 87ffe3e..a0e627e 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -154,8 +154,9 @@ public sealed class BSPrim : BSPhysObject
154 PhysicsScene.TaintedObject("BSPrim.destroy", delegate() 154 PhysicsScene.TaintedObject("BSPrim.destroy", delegate()
155 { 155 {
156 DetailLog("{0},BSPrim.Destroy,taint,", LocalID); 156 DetailLog("{0},BSPrim.Destroy,taint,", LocalID);
157 // everything in the C# world will get garbage collected. Tell the C++ world to free stuff. 157 // If there are physical body and shape, release my use of same.
158 BulletSimAPI.DestroyObject(PhysicsScene.WorldID, LocalID); 158 PhysicsScene.Shapes.DereferenceBody(BSBody, true, null);
159 PhysicsScene.Shapes.DereferenceShape(BSShape, true, null);
159 }); 160 });
160 } 161 }
161 162
@@ -251,9 +252,6 @@ public sealed class BSPrim : BSPhysObject
251 _rotationalVelocity = OMV.Vector3.Zero; 252 _rotationalVelocity = OMV.Vector3.Zero;
252 253
253 // Zero some other properties directly into the physics engine 254 // Zero some other properties directly into the physics engine
254 BulletSimAPI.SetLinearVelocity2(BSBody.ptr, OMV.Vector3.Zero);
255 BulletSimAPI.SetAngularVelocity2(BSBody.ptr, OMV.Vector3.Zero);
256 BulletSimAPI.SetInterpolationVelocity2(BSBody.ptr, OMV.Vector3.Zero, OMV.Vector3.Zero);
257 BulletSimAPI.ClearForces2(BSBody.ptr); 255 BulletSimAPI.ClearForces2(BSBody.ptr);
258 } 256 }
259 257
@@ -1108,9 +1106,8 @@ public sealed class BSPrim : BSPhysObject
1108 ShapeData shapeData; 1106 ShapeData shapeData;
1109 FillShapeInfo(out shapeData); 1107 FillShapeInfo(out shapeData);
1110 1108
1111 // Undo me from any possible linkset so, if body is rebuilt, the link will get restored. 1109 // If this prim is part of a linkset, we must remove and restore the physical
1112 // NOTE that the new linkset is not set. This saves the handle to the linkset 1110 // links of the body is rebuilt.
1113 // so we can add ourselves back when shape mangling is complete.
1114 bool needToRestoreLinkset = false; 1111 bool needToRestoreLinkset = false;
1115 1112
1116 // Create the correct physical representation for this type of object. 1113 // Create the correct physical representation for this type of object.
@@ -1119,12 +1116,15 @@ public sealed class BSPrim : BSPhysObject
1119 null, delegate(BulletBody dBody) 1116 null, delegate(BulletBody dBody)
1120 { 1117 {
1121 // Called if the current prim body is about to be destroyed. 1118 // Called if the current prim body is about to be destroyed.
1122 // The problem is the constraints for Linksets which need to be updated for the new body. 1119 // Remove all the physical dependencies on the old body.
1123 needToRestoreLinkset = Linkset.RemoveBodyDependencies(this); 1120 needToRestoreLinkset = Linkset.RemoveBodyDependencies(this);
1124 }); 1121 });
1125 1122
1126 if (needToRestoreLinkset) 1123 if (needToRestoreLinkset)
1124 {
1125 // If physical body dependencies were removed, restore them
1127 Linkset.RestoreBodyDependencies(this); 1126 Linkset.RestoreBodyDependencies(this);
1127 }
1128 1128
1129 // Make sure the properties are set on the new object 1129 // Make sure the properties are set on the new object
1130 UpdatePhysicalParameters(); 1130 UpdatePhysicalParameters();