diff options
author | Robert Adams | 2012-11-03 21:08:39 -0700 |
---|---|---|
committer | Robert Adams | 2012-11-03 21:16:02 -0700 |
commit | 79f7c466a116bf368423d4e18163f34fd8d66ce1 (patch) | |
tree | 8acd97fa89b1d900f785cec052fedfac7dde6027 /OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |
parent | BulletSim: search the mesh and hull lists to find shapes if type is not known... (diff) | |
download | opensim-SC-79f7c466a116bf368423d4e18163f34fd8d66ce1.zip opensim-SC-79f7c466a116bf368423d4e18163f34fd8d66ce1.tar.gz opensim-SC-79f7c466a116bf368423d4e18163f34fd8d66ce1.tar.bz2 opensim-SC-79f7c466a116bf368423d4e18163f34fd8d66ce1.tar.xz |
BulletSim: fix compound linkset crash by not freeing shape of child prims.
Remove all compilation warnings (mostly 'protected' in sealed classes.)
Add the dynamicAabbEnable parameter to creation of compound shapes.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 6e68695..12c6d7a 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -83,8 +83,8 @@ public sealed class BSLinksetCompound : BSLinkset | |||
83 | public override bool MakeDynamic(BSPhysObject child) | 83 | public override bool MakeDynamic(BSPhysObject child) |
84 | { | 84 | { |
85 | bool ret = false; | 85 | bool ret = false; |
86 | DetailLog("{0},BSLinksetCompound.MakeDynamic,call,isChild={1}", child.LocalID, HasChild(child)); | 86 | DetailLog("{0},BSLinksetCompound.MakeDynamic,call,IsRoot={1}", child.LocalID, IsRoot(child)); |
87 | if (HasChild(child)) | 87 | if (!IsRoot(child)) |
88 | { | 88 | { |
89 | // Physical children are removed from the world as the shape ofthe root compound | 89 | // Physical children are removed from the world as the shape ofthe root compound |
90 | // shape takes over. | 90 | // shape takes over. |
@@ -103,8 +103,8 @@ public sealed class BSLinksetCompound : BSLinkset | |||
103 | public override bool MakeStatic(BSPhysObject child) | 103 | public override bool MakeStatic(BSPhysObject child) |
104 | { | 104 | { |
105 | bool ret = false; | 105 | bool ret = false; |
106 | DetailLog("{0},BSLinksetCompound.MakeStatic,call,hasChild={1}", child.LocalID, HasChild(child)); | 106 | DetailLog("{0},BSLinksetCompound.MakeStatic,call,IsRoot={1}", child.LocalID, IsRoot(child)); |
107 | if (HasChild(child)) | 107 | if (!IsRoot(child)) |
108 | { | 108 | { |
109 | // The non-physical children can come back to life. | 109 | // The non-physical children can come back to life. |
110 | BulletSimAPI.RemoveFromCollisionFlags2(child.PhysBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); | 110 | BulletSimAPI.RemoveFromCollisionFlags2(child.PhysBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); |
@@ -240,6 +240,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
240 | // A mesh or hull is created because scale is not available on a native shape. | 240 | // A mesh or hull is created because scale is not available on a native shape. |
241 | // (TODO: Bullet does have a btScaledCollisionShape. Can that be used?) | 241 | // (TODO: Bullet does have a btScaledCollisionShape. Can that be used?) |
242 | BulletShape saveShape = cPrim.PhysShape; | 242 | BulletShape saveShape = cPrim.PhysShape; |
243 | cPrim.PhysShape.ptr = IntPtr.Zero; // Don't let the create free the child's shape | ||
243 | PhysicsScene.Shapes.CreateGeomMeshOrHull(cPrim, null); | 244 | PhysicsScene.Shapes.CreateGeomMeshOrHull(cPrim, null); |
244 | BulletShape newShape = cPrim.PhysShape; | 245 | BulletShape newShape = cPrim.PhysShape; |
245 | cPrim.PhysShape = saveShape; | 246 | cPrim.PhysShape = saveShape; |
@@ -263,7 +264,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
263 | float linksetMass = LinksetMass; | 264 | float linksetMass = LinksetMass; |
264 | LinksetRoot.UpdatePhysicalMassProperties(linksetMass); | 265 | LinksetRoot.UpdatePhysicalMassProperties(linksetMass); |
265 | 266 | ||
266 | // DEBUG: see of inter-linkset collisions are causing problems | 267 | // DEBUG: see of inter-linkset collisions are causing problems for constraint linksets. |
267 | // BulletSimAPI.SetCollisionFilterMask2(LinksetRoot.BSBody.ptr, | 268 | // BulletSimAPI.SetCollisionFilterMask2(LinksetRoot.BSBody.ptr, |
268 | // (uint)CollisionFilterGroups.LinksetFilter, (uint)CollisionFilterGroups.LinksetMask); | 269 | // (uint)CollisionFilterGroups.LinksetFilter, (uint)CollisionFilterGroups.LinksetMask); |
269 | 270 | ||