diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index 4a31c7d..29a23c0 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |||
@@ -38,7 +38,7 @@ public sealed class BSShapeCollection : IDisposable | |||
38 | { | 38 | { |
39 | private static string LogHeader = "[BULLETSIM SHAPE COLLECTION]"; | 39 | private static string LogHeader = "[BULLETSIM SHAPE COLLECTION]"; |
40 | 40 | ||
41 | protected BSScene PhysicsScene { get; set; } | 41 | private BSScene PhysicsScene { get; set; } |
42 | 42 | ||
43 | private Object m_collectionActivityLock = new Object(); | 43 | private Object m_collectionActivityLock = new Object(); |
44 | 44 | ||
@@ -103,11 +103,12 @@ public sealed class BSShapeCollection : IDisposable | |||
103 | { | 103 | { |
104 | // Do we have the correct geometry for this type of object? | 104 | // Do we have the correct geometry for this type of object? |
105 | // Updates prim.BSShape with information/pointers to shape. | 105 | // Updates prim.BSShape with information/pointers to shape. |
106 | // CreateGeom returns 'true' of BSShape as changed to a new shape. | 106 | // Returns 'true' of BSShape is changed to a new shape. |
107 | bool newGeom = CreateGeom(forceRebuild, prim, shapeCallback); | 107 | bool newGeom = CreateGeom(forceRebuild, prim, shapeCallback); |
108 | // If we had to select a new shape geometry for the object, | 108 | // If we had to select a new shape geometry for the object, |
109 | // rebuild the body around it. | 109 | // rebuild the body around it. |
110 | // Updates prim.BSBody with information/pointers to requested body | 110 | // Updates prim.BSBody with information/pointers to requested body |
111 | // Returns 'true' if BSBody was changed. | ||
111 | bool newBody = CreateBody((newGeom || forceRebuild), prim, PhysicsScene.World, | 112 | bool newBody = CreateBody((newGeom || forceRebuild), prim, PhysicsScene.World, |
112 | prim.PhysShape, bodyCallback); | 113 | prim.PhysShape, bodyCallback); |
113 | ret = newGeom || newBody; | 114 | ret = newGeom || newBody; |
@@ -431,6 +432,7 @@ public sealed class BSShapeCollection : IDisposable | |||
431 | return ret; | 432 | return ret; |
432 | } | 433 | } |
433 | 434 | ||
435 | // Create a mesh/hull shape or a native shape if 'nativeShapePossible' is 'true'. | ||
434 | private bool CreateGeomNonSpecial(bool forceRebuild, BSPhysObject prim, ShapeDestructionCallback shapeCallback) | 436 | private bool CreateGeomNonSpecial(bool forceRebuild, BSPhysObject prim, ShapeDestructionCallback shapeCallback) |
435 | { | 437 | { |
436 | bool ret = false; | 438 | bool ret = false; |
@@ -797,15 +799,17 @@ public sealed class BSShapeCollection : IDisposable | |||
797 | private bool GetReferenceToCompoundShape(BSPhysObject prim, ShapeDestructionCallback shapeCallback) | 799 | private bool GetReferenceToCompoundShape(BSPhysObject prim, ShapeDestructionCallback shapeCallback) |
798 | { | 800 | { |
799 | // Remove reference to the old shape | 801 | // Remove reference to the old shape |
800 | // Don't need to do this as the shape is freed when we create the new root shape below. | 802 | // Don't need to do this as the shape is freed when the new root shape is created below. |
801 | // DereferenceShape(prim.PhysShape, true, shapeCallback); | 803 | // DereferenceShape(prim.PhysShape, true, shapeCallback); |
802 | 804 | ||
803 | BulletShape cShape = new BulletShape( | 805 | BulletShape cShape = new BulletShape( |
804 | BulletSimAPI.CreateCompoundShape2(PhysicsScene.World.ptr), ShapeData.PhysicsShapeType.SHAPE_COMPOUND); | 806 | BulletSimAPI.CreateCompoundShape2(PhysicsScene.World.ptr, false), ShapeData.PhysicsShapeType.SHAPE_COMPOUND); |
805 | 807 | ||
806 | // Create the shape for the root prim and add it to the compound shape | 808 | // Create the shape for the root prim and add it to the compound shape. Cannot be a native shape. |
807 | CreateGeomNonSpecial(true, prim, null); | 809 | CreateGeomMeshOrHull(prim, shapeCallback); |
808 | BulletSimAPI.AddChildShapeToCompoundShape2(cShape.ptr, prim.PhysShape.ptr, OMV.Vector3.Zero, OMV.Quaternion.Identity); | 810 | BulletSimAPI.AddChildShapeToCompoundShape2(cShape.ptr, prim.PhysShape.ptr, OMV.Vector3.Zero, OMV.Quaternion.Identity); |
811 | DetailLog("{0},BSShapeCollection.GetReferenceToCompoundShape,addRootPrim,compShape={1},rootShape={2}", | ||
812 | prim.LocalID, cShape, prim.PhysShape); | ||
809 | 813 | ||
810 | prim.PhysShape = cShape; | 814 | prim.PhysShape = cShape; |
811 | 815 | ||