aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs8
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs6
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs2
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs10
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs63
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapes.cs7
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs7
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs8
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs8
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs947
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt7
-rw-r--r--prebuild.xml1
12 files changed, 235 insertions, 839 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 3b77e49..d5ab245 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -210,8 +210,7 @@ public sealed class BSCharacter : BSPhysObject
210 if (!Flying && !IsColliding) 210 if (!Flying && !IsColliding)
211 { 211 {
212 stepVelocity.Z = _velocity.Z; 212 stepVelocity.Z = _velocity.Z;
213 DetailLog("{0},BSCharacter.MoveMotor,taint,overrideStepZWithWorldZ,stepVel={1}", 213 // DetailLog("{0},BSCharacter.MoveMotor,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity);
214 LocalID, stepVelocity);
215 } 214 }
216 215
217 // 'stepVelocity' is now the speed we'd like the avatar to move in. Turn that into an instantanous force. 216 // 'stepVelocity' is now the speed we'd like the avatar to move in. Turn that into an instantanous force.
@@ -231,8 +230,7 @@ public sealed class BSCharacter : BSPhysObject
231 AddForce(moveForce, false, true); 230 AddForce(moveForce, false, true);
232 } 231 }
233 */ 232 */
234 DetailLog("{0},BSCharacter.MoveMotor,move,stepVel={1},vel={2},mass={3},moveForce={4}", 233 // DetailLog("{0},BSCharacter.MoveMotor,move,stepVel={1},vel={2},mass={3},moveForce={4}", LocalID, stepVelocity, _velocity, Mass, moveForce);
235 LocalID, stepVelocity, _velocity, Mass, moveForce);
236 AddForce(moveForce, false, true); 234 AddForce(moveForce, false, true);
237 }); 235 });
238 } 236 }
@@ -736,7 +734,7 @@ public sealed class BSCharacter : BSPhysObject
736 PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.AddForce", delegate() 734 PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.AddForce", delegate()
737 { 735 {
738 // Bullet adds this central force to the total force for this tick 736 // Bullet adds this central force to the total force for this tick
739 DetailLog("{0},BSCharacter.addForce,taint,force={1}", LocalID, addForce); 737 // DetailLog("{0},BSCharacter.addForce,taint,force={1}", LocalID, addForce);
740 if (PhysBody.HasPhysicalBody) 738 if (PhysBody.HasPhysicalBody)
741 { 739 {
742 BulletSimAPI.ApplyCentralForce2(PhysBody.ptr, addForce); 740 BulletSimAPI.ApplyCentralForce2(PhysBody.ptr, addForce);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
index 19ce62b..9bb951c 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
@@ -359,7 +359,7 @@ public sealed class BSLinksetCompound : BSLinkset
359 PhysicsScene.Shapes.CreateGeomMeshOrHull(cPrim, null); 359 PhysicsScene.Shapes.CreateGeomMeshOrHull(cPrim, null);
360 BulletShape newShape = cPrim.PhysShape; 360 BulletShape newShape = cPrim.PhysShape;
361 cPrim.PhysShape = saveShape; 361 cPrim.PhysShape = saveShape;
362 BulletSimAPI.AddChildShapeToCompoundShape2(LinksetRoot.PhysShape.ptr, newShape.ptr, lci.OffsetPos, lci.OffsetRot); 362 PhysicsScene.PE.AddChildShapeToCompoundShape(LinksetRoot.PhysShape, newShape, lci.OffsetPos, lci.OffsetRot);
363 } 363 }
364 else 364 else
365 { 365 {
@@ -371,7 +371,7 @@ public sealed class BSLinksetCompound : BSLinkset
371 PhysicsScene.Logger.ErrorFormat("{0} Rebuilt sharable shape when building linkset! Region={1}, primID={2}, shape={3}", 371 PhysicsScene.Logger.ErrorFormat("{0} Rebuilt sharable shape when building linkset! Region={1}, primID={2}, shape={3}",
372 LogHeader, PhysicsScene.RegionName, cPrim.LocalID, cPrim.PhysShape); 372 LogHeader, PhysicsScene.RegionName, cPrim.LocalID, cPrim.PhysShape);
373 } 373 }
374 BulletSimAPI.AddChildShapeToCompoundShape2(LinksetRoot.PhysShape.ptr, cPrim.PhysShape.ptr, lci.OffsetPos, lci.OffsetRot); 374 PhysicsScene.PE.AddChildShapeToCompoundShape(LinksetRoot.PhysShape, cPrim.PhysShape, lci.OffsetPos, lci.OffsetRot);
375 } 375 }
376 } 376 }
377 return false; // 'false' says to move onto the next child in the list 377 return false; // 'false' says to move onto the next child in the list
@@ -386,7 +386,7 @@ public sealed class BSLinksetCompound : BSLinkset
386 Rebuilding = false; 386 Rebuilding = false;
387 } 387 }
388 388
389 BulletSimAPI.RecalculateCompoundShapeLocalAabb2(LinksetRoot.PhysShape.ptr); 389 PhysicsScene.PE.RecalculateCompoundShapeLocalAabb(LinksetRoot.PhysShape);
390 390
391 // DEBUG: see of inter-linkset collisions are causing problems for constraint linksets. 391 // DEBUG: see of inter-linkset collisions are causing problems for constraint linksets.
392 // BulletSimAPI.SetCollisionFilterMask2(LinksetRoot.BSBody.ptr, 392 // BulletSimAPI.SetCollisionFilterMask2(LinksetRoot.BSBody.ptr,
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 2de4717..cf09be2 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -845,7 +845,7 @@ public sealed class BSPrim : BSPhysObject
845 // the functions after this one set up the state of a possibly newly created collision body. 845 // the functions after this one set up the state of a possibly newly created collision body.
846 private void MakeSolid(bool makeSolid) 846 private void MakeSolid(bool makeSolid)
847 { 847 {
848 CollisionObjectTypes bodyType = (CollisionObjectTypes)BulletSimAPI.GetBodyType2(PhysBody.ptr); 848 CollisionObjectTypes bodyType = (CollisionObjectTypes)PhysicsScene.PE.GetBodyType(PhysBody);
849 if (makeSolid) 849 if (makeSolid)
850 { 850 {
851 // Verify the previous code created the correct shape for this type of thing. 851 // Verify the previous code created the correct shape for this type of thing.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 4133107..bfc9df2 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -50,6 +50,9 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
50 50
51 public string BulletSimVersion = "?"; 51 public string BulletSimVersion = "?";
52 52
53 // The handle to the underlying managed or unmanaged version of Bullet being used.
54 public BulletSimAPITemplate PE;
55
53 public Dictionary<uint, BSPhysObject> PhysObjects; 56 public Dictionary<uint, BSPhysObject> PhysObjects;
54 public BSShapeCollection Shapes; 57 public BSShapeCollection Shapes;
55 58
@@ -187,12 +190,15 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
187 190
188 // Allocate pinned memory to pass parameters. 191 // Allocate pinned memory to pass parameters.
189 UnmanagedParams = new ConfigurationParameters[1]; 192 UnmanagedParams = new ConfigurationParameters[1];
190 m_paramsHandle = GCHandle.Alloc(UnmanagedParams, GCHandleType.Pinned);
191 193
192 // Set default values for physics parameters plus any overrides from the ini file 194 // Set default values for physics parameters plus any overrides from the ini file
193 GetInitialParameterValues(config); 195 GetInitialParameterValues(config);
194 196
195 // allocate more pinned memory close to the above in an attempt to get the memory all together 197 // For the moment, only one version of the interface
198 PE = new BSAPIUnman();
199
200 // Allocate more pinned memory. Do this early to try and get all pinned memory close together.
201 m_paramsHandle = GCHandle.Alloc(UnmanagedParams, GCHandleType.Pinned);
196 m_collisionArray = new CollisionDesc[m_maxCollisionsPerFrame]; 202 m_collisionArray = new CollisionDesc[m_maxCollisionsPerFrame];
197 m_collisionArrayPinnedHandle = GCHandle.Alloc(m_collisionArray, GCHandleType.Pinned); 203 m_collisionArrayPinnedHandle = GCHandle.Alloc(m_collisionArray, GCHandleType.Pinned);
198 m_updateArray = new EntityProperties[m_maxUpdatesPerFrame]; 204 m_updateArray = new EntityProperties[m_maxUpdatesPerFrame];
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
index 0cc51b0..e7d8d14 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
@@ -174,7 +174,7 @@ public sealed class BSShapeCollection : IDisposable
174 174
175 // Zero any reference to the shape so it is not freed when the body is deleted. 175 // Zero any reference to the shape so it is not freed when the body is deleted.
176 BulletSimAPI.SetCollisionShape2(PhysicsScene.World.ptr, body.ptr, IntPtr.Zero); 176 BulletSimAPI.SetCollisionShape2(PhysicsScene.World.ptr, body.ptr, IntPtr.Zero);
177 BulletSimAPI.DestroyObject2(PhysicsScene.World.ptr, body.ptr); 177 PhysicsScene.PE.DestroyObject(PhysicsScene.World, body);
178 }); 178 });
179 } 179 }
180 } 180 }
@@ -261,7 +261,7 @@ public sealed class BSShapeCollection : IDisposable
261 if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceShape,deleteNativeShape,ptr={1},taintTime={2}", 261 if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceShape,deleteNativeShape,ptr={1},taintTime={2}",
262 BSScene.DetailLogZero, shape.ptr.ToString("X"), inTaintTime); 262 BSScene.DetailLogZero, shape.ptr.ToString("X"), inTaintTime);
263 if (shapeCallback != null) shapeCallback(shape); 263 if (shapeCallback != null) shapeCallback(shape);
264 BulletSimAPI.DeleteCollisionShape2(PhysicsScene.World.ptr, shape.ptr); 264 PhysicsScene.PE.DeleteCollisionShape(PhysicsScene.World, shape);
265 } 265 }
266 else 266 else
267 { 267 {
@@ -342,26 +342,26 @@ public sealed class BSShapeCollection : IDisposable
342 return; 342 return;
343 } 343 }
344 344
345 int numChildren = BulletSimAPI.GetNumberOfCompoundChildren2(shape.ptr); 345 int numChildren = PhysicsScene.PE.GetNumberOfCompoundChildren(shape);
346 if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceCompound,shape={1},children={2}", BSScene.DetailLogZero, shape, numChildren); 346 if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceCompound,shape={1},children={2}", BSScene.DetailLogZero, shape, numChildren);
347 347
348 for (int ii = numChildren - 1; ii >= 0; ii--) 348 for (int ii = numChildren - 1; ii >= 0; ii--)
349 { 349 {
350 IntPtr childShape = BulletSimAPI.RemoveChildShapeFromCompoundShapeIndex2(shape.ptr, ii); 350 BulletShape childShape = PhysicsScene.PE.RemoveChildShapeFromCompoundShapeIndex(shape, ii);
351 DereferenceAnonCollisionShape(childShape); 351 DereferenceAnonCollisionShape(childShape);
352 } 352 }
353 BulletSimAPI.DeleteCollisionShape2(PhysicsScene.World.ptr, shape.ptr); 353 PhysicsScene.PE.DeleteCollisionShape(PhysicsScene.World, shape);
354 } 354 }
355 355
356 // Sometimes we have a pointer to a collision shape but don't know what type it is. 356 // Sometimes we have a pointer to a collision shape but don't know what type it is.
357 // Figure out type and call the correct dereference routine. 357 // Figure out type and call the correct dereference routine.
358 // Called at taint-time. 358 // Called at taint-time.
359 private void DereferenceAnonCollisionShape(IntPtr cShape) 359 private void DereferenceAnonCollisionShape(BulletShape shapeInfo)
360 { 360 {
361 MeshDesc meshDesc; 361 MeshDesc meshDesc;
362 HullDesc hullDesc; 362 HullDesc hullDesc;
363 363
364 BulletShape shapeInfo = new BulletShape(cShape); 364 IntPtr cShape = shapeInfo.ptr;
365 if (TryGetMeshByPtr(cShape, out meshDesc)) 365 if (TryGetMeshByPtr(cShape, out meshDesc))
366 { 366 {
367 shapeInfo.type = BSPhysicsShapeType.SHAPE_MESH; 367 shapeInfo.type = BSPhysicsShapeType.SHAPE_MESH;
@@ -382,7 +382,7 @@ public sealed class BSShapeCollection : IDisposable
382 } 382 }
383 else 383 else
384 { 384 {
385 if (BulletSimAPI.IsNativeShape2(cShape)) 385 if (PhysicsScene.PE.IsNativeShape(shapeInfo))
386 { 386 {
387 shapeInfo.isNativeShape = true; 387 shapeInfo.isNativeShape = true;
388 shapeInfo.type = BSPhysicsShapeType.SHAPE_BOX; // (technically, type doesn't matter) 388 shapeInfo.type = BSPhysicsShapeType.SHAPE_BOX; // (technically, type doesn't matter)
@@ -570,19 +570,15 @@ public sealed class BSShapeCollection : IDisposable
570 570
571 if (shapeType == BSPhysicsShapeType.SHAPE_CAPSULE) 571 if (shapeType == BSPhysicsShapeType.SHAPE_CAPSULE)
572 { 572 {
573 // The proper scale has been calculated in the prim. 573
574 newShape = new BulletShape( 574 newShape = PhysicsScene.PE.BuildCapsuleShape(PhysicsScene.World, 1f, 1f, prim.Scale);
575 // Bullet's capsule total height is the passed "height + (radius * 2)" so, the base
576 // capsule is radius of 0.5f (1 diameter) and height of two (1.0f + 0.5f * 2)".
577 // This must be taken into account when computing the scaling of the capsule.
578 BulletSimAPI.BuildCapsuleShape2(PhysicsScene.World.ptr, 1f, 1f, prim.Scale)
579 , shapeType);
580 if (DDetail) DetailLog("{0},BSShapeCollection.BuiletPhysicalNativeShape,capsule,scale={1}", prim.LocalID, prim.Scale); 575 if (DDetail) DetailLog("{0},BSShapeCollection.BuiletPhysicalNativeShape,capsule,scale={1}", prim.LocalID, prim.Scale);
581 } 576 }
582 else 577 else
583 { 578 {
584 // Native shapes are scaled in Bullet so set the scaling to the size 579 // Native shapes are scaled in Bullet so set the scaling to the size
585 newShape = new BulletShape(BulletSimAPI.BuildNativeShape2(PhysicsScene.World.ptr, nativeShapeData), shapeType); 580 newShape = PhysicsScene.PE.BuildNativeShape(PhysicsScene.World, nativeShapeData);
581
586 } 582 }
587 if (!newShape.HasPhysicalShape) 583 if (!newShape.HasPhysicalShape)
588 { 584 {
@@ -629,13 +625,14 @@ public sealed class BSShapeCollection : IDisposable
629 625
630 private BulletShape CreatePhysicalMesh(string objName, System.UInt64 newMeshKey, PrimitiveBaseShape pbs, OMV.Vector3 size, float lod) 626 private BulletShape CreatePhysicalMesh(string objName, System.UInt64 newMeshKey, PrimitiveBaseShape pbs, OMV.Vector3 size, float lod)
631 { 627 {
628 BulletShape newShape = new BulletShape();
632 IMesh meshData = null; 629 IMesh meshData = null;
633 IntPtr meshPtr = IntPtr.Zero; 630
634 MeshDesc meshDesc; 631 MeshDesc meshDesc;
635 if (Meshes.TryGetValue(newMeshKey, out meshDesc)) 632 if (Meshes.TryGetValue(newMeshKey, out meshDesc))
636 { 633 {
637 // If the mesh has already been built just use it. 634 // If the mesh has already been built just use it.
638 meshPtr = meshDesc.ptr; 635 newShape = new BulletShape(meshDesc.ptr, BSPhysicsShapeType.SHAPE_MESH);
639 } 636 }
640 else 637 else
641 { 638 {
@@ -658,11 +655,10 @@ public sealed class BSShapeCollection : IDisposable
658 // m_log.DebugFormat("{0}: BSShapeCollection.CreatePhysicalMesh: calling CreateMesh. lid={1}, key={2}, indices={3}, vertices={4}", 655 // m_log.DebugFormat("{0}: BSShapeCollection.CreatePhysicalMesh: calling CreateMesh. lid={1}, key={2}, indices={3}, vertices={4}",
659 // LogHeader, prim.LocalID, newMeshKey, indices.Length, vertices.Count); 656 // LogHeader, prim.LocalID, newMeshKey, indices.Length, vertices.Count);
660 657
661 meshPtr = BulletSimAPI.CreateMeshShape2(PhysicsScene.World.ptr, 658 newShape = PhysicsScene.PE.CreateMeshShape(PhysicsScene.World,
662 indices.GetLength(0), indices, vertices.Count, verticesAsFloats); 659 indices.GetLength(0), indices, vertices.Count, verticesAsFloats);
663 } 660 }
664 } 661 }
665 BulletShape newShape = new BulletShape(meshPtr, BSPhysicsShapeType.SHAPE_MESH);
666 newShape.shapeKey = newMeshKey; 662 newShape.shapeKey = newMeshKey;
667 663
668 return newShape; 664 return newShape;
@@ -700,12 +696,14 @@ public sealed class BSShapeCollection : IDisposable
700 private BulletShape CreatePhysicalHull(string objName, System.UInt64 newHullKey, PrimitiveBaseShape pbs, OMV.Vector3 size, float lod) 696 private BulletShape CreatePhysicalHull(string objName, System.UInt64 newHullKey, PrimitiveBaseShape pbs, OMV.Vector3 size, float lod)
701 { 697 {
702 698
699 BulletShape newShape = new BulletShape();
703 IntPtr hullPtr = IntPtr.Zero; 700 IntPtr hullPtr = IntPtr.Zero;
701
704 HullDesc hullDesc; 702 HullDesc hullDesc;
705 if (Hulls.TryGetValue(newHullKey, out hullDesc)) 703 if (Hulls.TryGetValue(newHullKey, out hullDesc))
706 { 704 {
707 // If the hull shape already is created, just use it. 705 // If the hull shape already is created, just use it.
708 hullPtr = hullDesc.ptr; 706 newShape = new BulletShape(hullDesc.ptr, BSPhysicsShapeType.SHAPE_HULL);
709 } 707 }
710 else 708 else
711 { 709 {
@@ -793,11 +791,10 @@ public sealed class BSShapeCollection : IDisposable
793 } 791 }
794 } 792 }
795 // create the hull data structure in Bullet 793 // create the hull data structure in Bullet
796 hullPtr = BulletSimAPI.CreateHullShape2(PhysicsScene.World.ptr, hullCount, convHulls); 794 newShape = PhysicsScene.PE.CreateHullShape(PhysicsScene.World, hullCount, convHulls);
797 } 795 }
798 } 796 }
799 797
800 BulletShape newShape = new BulletShape(hullPtr, BSPhysicsShapeType.SHAPE_HULL);
801 newShape.shapeKey = newHullKey; 798 newShape.shapeKey = newHullKey;
802 799
803 return newShape; 800 return newShape;
@@ -819,12 +816,12 @@ public sealed class BSShapeCollection : IDisposable
819 // Don't need to do this as the shape is freed when the new root shape is created below. 816 // Don't need to do this as the shape is freed when the new root shape is created below.
820 // DereferenceShape(prim.PhysShape, true, shapeCallback); 817 // DereferenceShape(prim.PhysShape, true, shapeCallback);
821 818
822 BulletShape cShape = new BulletShape( 819
823 BulletSimAPI.CreateCompoundShape2(PhysicsScene.World.ptr, false), BSPhysicsShapeType.SHAPE_COMPOUND); 820 BulletShape cShape = PhysicsScene.PE.CreateCompoundShape(PhysicsScene.World, false);
824 821
825 // Create the shape for the root prim and add it to the compound shape. Cannot be a native shape. 822 // Create the shape for the root prim and add it to the compound shape. Cannot be a native shape.
826 CreateGeomMeshOrHull(prim, shapeCallback); 823 CreateGeomMeshOrHull(prim, shapeCallback);
827 BulletSimAPI.AddChildShapeToCompoundShape2(cShape.ptr, prim.PhysShape.ptr, OMV.Vector3.Zero, OMV.Quaternion.Identity); 824 PhysicsScene.PE.AddChildShapeToCompoundShape(cShape, prim.PhysShape, OMV.Vector3.Zero, OMV.Quaternion.Identity);
828 if (DDetail) DetailLog("{0},BSShapeCollection.GetReferenceToCompoundShape,addRootPrim,compShape={1},rootShape={2}", 825 if (DDetail) DetailLog("{0},BSShapeCollection.GetReferenceToCompoundShape,addRootPrim,compShape={1},rootShape={2}",
829 prim.LocalID, cShape, prim.PhysShape); 826 prim.LocalID, cShape, prim.PhysShape);
830 827
@@ -932,7 +929,7 @@ public sealed class BSShapeCollection : IDisposable
932 // If not a solid object, body is a GhostObject. Otherwise a RigidBody. 929 // If not a solid object, body is a GhostObject. Otherwise a RigidBody.
933 if (!mustRebuild) 930 if (!mustRebuild)
934 { 931 {
935 CollisionObjectTypes bodyType = (CollisionObjectTypes)BulletSimAPI.GetBodyType2(prim.PhysBody.ptr); 932 CollisionObjectTypes bodyType = (CollisionObjectTypes)PhysicsScene.PE.GetBodyType(prim.PhysBody);
936 if (prim.IsSolid && bodyType != CollisionObjectTypes.CO_RIGID_BODY 933 if (prim.IsSolid && bodyType != CollisionObjectTypes.CO_RIGID_BODY
937 || !prim.IsSolid && bodyType != CollisionObjectTypes.CO_GHOST_OBJECT) 934 || !prim.IsSolid && bodyType != CollisionObjectTypes.CO_GHOST_OBJECT)
938 { 935 {
@@ -947,20 +944,16 @@ public sealed class BSShapeCollection : IDisposable
947 DereferenceBody(prim.PhysBody, true, bodyCallback); 944 DereferenceBody(prim.PhysBody, true, bodyCallback);
948 945
949 BulletBody aBody; 946 BulletBody aBody;
950 IntPtr bodyPtr = IntPtr.Zero;
951 if (prim.IsSolid) 947 if (prim.IsSolid)
952 { 948 {
953 bodyPtr = BulletSimAPI.CreateBodyFromShape2(sim.ptr, shape.ptr, 949 aBody = PhysicsScene.PE.CreateBodyFromShape(sim, shape, prim.LocalID, prim.RawPosition, prim.RawOrientation);
954 prim.LocalID, prim.RawPosition, prim.RawOrientation); 950 if (DDetail) DetailLog("{0},BSShapeCollection.CreateBody,mesh,body={1}", prim.LocalID, aBody);
955 if (DDetail) DetailLog("{0},BSShapeCollection.CreateBody,mesh,ptr={1}", prim.LocalID, bodyPtr.ToString("X"));
956 } 951 }
957 else 952 else
958 { 953 {
959 bodyPtr = BulletSimAPI.CreateGhostFromShape2(sim.ptr, shape.ptr, 954 aBody = PhysicsScene.PE.CreateGhostFromShape(sim, shape, prim.LocalID, prim.RawPosition, prim.RawOrientation);
960 prim.LocalID, prim.RawPosition, prim.RawOrientation); 955 if (DDetail) DetailLog("{0},BSShapeCollection.CreateBody,ghost,body={1}", prim.LocalID, aBody);
961 if (DDetail) DetailLog("{0},BSShapeCollection.CreateBody,ghost,ptr={1}", prim.LocalID, bodyPtr.ToString("X"));
962 } 956 }
963 aBody = new BulletBody(prim.LocalID, bodyPtr);
964 957
965 ReferenceBody(aBody, true); 958 ReferenceBody(aBody, true);
966 959
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
index c7885c6..cdaa869 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
@@ -126,7 +126,8 @@ public class BSShapeNative : BSShape
126 BSPhysicsShapeType shapeType, FixedShapeKey shapeKey) 126 BSPhysicsShapeType shapeType, FixedShapeKey shapeKey)
127 { 127 {
128 // Native shapes are not shared and are always built anew. 128 // Native shapes are not shared and are always built anew.
129 return new BSShapeNative(physicsScene, prim, shapeType, shapeKey); 129 //return new BSShapeNative(physicsScene, prim, shapeType, shapeKey);
130 return null;
130 } 131 }
131 132
132 private BSShapeNative(BSScene physicsScene, BSPhysObject prim, 133 private BSShapeNative(BSScene physicsScene, BSPhysObject prim,
@@ -141,6 +142,7 @@ public class BSShapeNative : BSShape
141 nativeShapeData.HullKey = (ulong)shapeKey; 142 nativeShapeData.HullKey = (ulong)shapeKey;
142 143
143 144
145 /*
144 if (shapeType == BSPhysicsShapeType.SHAPE_CAPSULE) 146 if (shapeType == BSPhysicsShapeType.SHAPE_CAPSULE)
145 { 147 {
146 ptr = BulletSimAPI.BuildCapsuleShape2(physicsScene.World.ptr, 1f, 1f, prim.Scale); 148 ptr = BulletSimAPI.BuildCapsuleShape2(physicsScene.World.ptr, 1f, 1f, prim.Scale);
@@ -157,15 +159,18 @@ public class BSShapeNative : BSShape
157 } 159 }
158 type = shapeType; 160 type = shapeType;
159 key = (UInt64)shapeKey; 161 key = (UInt64)shapeKey;
162 */
160 } 163 }
161 // Make this reference to the physical shape go away since native shapes are not shared. 164 // Make this reference to the physical shape go away since native shapes are not shared.
162 public override void Dereference(BSScene physicsScene) 165 public override void Dereference(BSScene physicsScene)
163 { 166 {
167 /*
164 // Native shapes are not tracked and are released immediately 168 // Native shapes are not tracked and are released immediately
165 physicsScene.DetailLog("{0},BSShapeCollection.DereferenceShape,deleteNativeShape,shape={1}", BSScene.DetailLogZero, this); 169 physicsScene.DetailLog("{0},BSShapeCollection.DereferenceShape,deleteNativeShape,shape={1}", BSScene.DetailLogZero, this);
166 BulletSimAPI.DeleteCollisionShape2(physicsScene.World.ptr, ptr); 170 BulletSimAPI.DeleteCollisionShape2(physicsScene.World.ptr, ptr);
167 ptr = IntPtr.Zero; 171 ptr = IntPtr.Zero;
168 // Garbage collection will free up this instance. 172 // Garbage collection will free up this instance.
173 */
169 } 174 }
170} 175}
171 176
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
index 07a9fd8..a2c085e 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
@@ -105,9 +105,8 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
105 centerPos.Y = m_mapInfo.minCoords.Y + (m_mapInfo.sizeY / 2f); 105 centerPos.Y = m_mapInfo.minCoords.Y + (m_mapInfo.sizeY / 2f);
106 centerPos.Z = m_mapInfo.minZ + ((m_mapInfo.maxZ - m_mapInfo.minZ) / 2f); 106 centerPos.Z = m_mapInfo.minZ + ((m_mapInfo.maxZ - m_mapInfo.minZ) / 2f);
107 107
108 m_mapInfo.terrainBody = new BulletBody(m_mapInfo.ID, 108 m_mapInfo.terrainBody = PhysicsScene.PE.CreateBodyWithDefaultMotionState(m_mapInfo.terrainShape,
109 BulletSimAPI.CreateBodyWithDefaultMotionState2(m_mapInfo.terrainShape.ptr, 109 m_mapInfo.ID, centerPos, Quaternion.Identity);
110 m_mapInfo.ID, centerPos, Quaternion.Identity));
111 110
112 // Set current terrain attributes 111 // Set current terrain attributes
113 BulletSimAPI.SetFriction2(m_mapInfo.terrainBody.ptr, BSParam.TerrainFriction); 112 BulletSimAPI.SetFriction2(m_mapInfo.terrainBody.ptr, BSParam.TerrainFriction);
@@ -139,7 +138,7 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
139 { 138 {
140 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, m_mapInfo.terrainBody.ptr); 139 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, m_mapInfo.terrainBody.ptr);
141 // Frees both the body and the shape. 140 // Frees both the body and the shape.
142 BulletSimAPI.DestroyObject2(PhysicsScene.World.ptr, m_mapInfo.terrainBody.ptr); 141 PhysicsScene.PE.DestroyObject(PhysicsScene.World, m_mapInfo.terrainBody);
143 BulletSimAPI.ReleaseHeightMapInfo2(m_mapInfo.Ptr); 142 BulletSimAPI.ReleaseHeightMapInfo2(m_mapInfo.Ptr);
144 } 143 }
145 } 144 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
index 86ccfbb..d99a50f 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
@@ -137,9 +137,9 @@ public sealed class BSTerrainManager : IDisposable
137 BulletSimAPI.CreateGroundPlaneShape2(BSScene.GROUNDPLANE_ID, 1f, 137 BulletSimAPI.CreateGroundPlaneShape2(BSScene.GROUNDPLANE_ID, 1f,
138 BSParam.TerrainCollisionMargin), 138 BSParam.TerrainCollisionMargin),
139 BSPhysicsShapeType.SHAPE_GROUNDPLANE); 139 BSPhysicsShapeType.SHAPE_GROUNDPLANE);
140 m_groundPlane = new BulletBody(BSScene.GROUNDPLANE_ID, 140 m_groundPlane = PhysicsScene.PE.CreateBodyWithDefaultMotionState(groundPlaneShape,
141 BulletSimAPI.CreateBodyWithDefaultMotionState2(groundPlaneShape.ptr, BSScene.GROUNDPLANE_ID, 141 BSScene.GROUNDPLANE_ID, Vector3.Zero, Quaternion.Identity);
142 Vector3.Zero, Quaternion.Identity)); 142
143 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, m_groundPlane.ptr); 143 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, m_groundPlane.ptr);
144 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, m_groundPlane.ptr); 144 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, m_groundPlane.ptr);
145 // Ground plane does not move 145 // Ground plane does not move
@@ -160,7 +160,7 @@ public sealed class BSTerrainManager : IDisposable
160 { 160 {
161 if (BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, m_groundPlane.ptr)) 161 if (BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, m_groundPlane.ptr))
162 { 162 {
163 BulletSimAPI.DestroyObject2(PhysicsScene.World.ptr, m_groundPlane.ptr); 163 PhysicsScene.PE.DestroyObject(PhysicsScene.World, m_groundPlane);
164 } 164 }
165 m_groundPlane.Clear(); 165 m_groundPlane.Clear();
166 } 166 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
index 061e232..d8c4972 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
@@ -91,9 +91,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys
91 PhysicsScene.DetailLog("{0},BSTerrainMesh.create,meshed,indices={1},indSz={2},vertices={3},vertSz={4}", 91 PhysicsScene.DetailLog("{0},BSTerrainMesh.create,meshed,indices={1},indSz={2},vertices={3},vertSz={4}",
92 ID, indicesCount, indices.Length, verticesCount, vertices.Length); 92 ID, indicesCount, indices.Length, verticesCount, vertices.Length);
93 93
94 m_terrainShape = new BulletShape(BulletSimAPI.CreateMeshShape2(PhysicsScene.World.ptr, 94 m_terrainShape = PhysicsScene.PE.CreateMeshShape(PhysicsScene.World, indicesCount, indices, verticesCount, vertices);
95 indicesCount, indices, verticesCount, vertices),
96 BSPhysicsShapeType.SHAPE_MESH);
97 if (!m_terrainShape.HasPhysicalShape) 95 if (!m_terrainShape.HasPhysicalShape)
98 { 96 {
99 // DISASTER!! 97 // DISASTER!!
@@ -106,7 +104,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys
106 Vector3 pos = regionBase; 104 Vector3 pos = regionBase;
107 Quaternion rot = Quaternion.Identity; 105 Quaternion rot = Quaternion.Identity;
108 106
109 m_terrainBody = new BulletBody(id, BulletSimAPI.CreateBodyWithDefaultMotionState2( m_terrainShape.ptr, ID, pos, rot)); 107 m_terrainBody = PhysicsScene.PE.CreateBodyWithDefaultMotionState(m_terrainShape, ID, pos, rot);
110 if (!m_terrainBody.HasPhysicalBody) 108 if (!m_terrainBody.HasPhysicalBody)
111 { 109 {
112 // DISASTER!! 110 // DISASTER!!
@@ -143,7 +141,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys
143 { 141 {
144 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, m_terrainBody.ptr); 142 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, m_terrainBody.ptr);
145 // Frees both the body and the shape. 143 // Frees both the body and the shape.
146 BulletSimAPI.DestroyObject2(PhysicsScene.World.ptr, m_terrainBody.ptr); 144 PhysicsScene.PE.DestroyObject(PhysicsScene.World, m_terrainBody);
147 } 145 }
148 } 146 }
149 147
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
index b361498..6b76151 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
@@ -292,985 +292,376 @@ public enum ConstraintParamAxis : int
292 292
293public abstract class BulletSimAPITemplate 293public abstract class BulletSimAPITemplate
294{ 294{
295 /*
295// Initialization and simulation 296// Initialization and simulation
296public abstract BulletWorld Initialize2(Vector3 maxPosition, IntPtr parms, 297public abstract BulletWorld Initialize(Vector3 maxPosition, IntPtr parms,
297 int maxCollisions, IntPtr collisionArray, 298 int maxCollisions, IntPtr collisionArray,
298 int maxUpdates, IntPtr updateArray 299 int maxUpdates, IntPtr updateArray
299 ); 300 );
300 301
301public abstract bool UpdateParameter2(BulletWorld world, uint localID, String parm, float value); 302public abstract bool UpdateParameter(BulletWorld world, uint localID, String parm, float value);
302 303
303public abstract void SetHeightMap2(BulletWorld world, float[] heightmap); 304public abstract void SetHeightMap(BulletWorld world, float[] heightmap);
304 305
305public abstract void Shutdown2(BulletWorld sim); 306public abstract void Shutdown(BulletWorld sim);
306 307
307public abstract int PhysicsStep2(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep, 308public abstract int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep,
308 out int updatedEntityCount, 309 out int updatedEntityCount,
309 out IntPtr updatedEntitiesPtr, 310 out IntPtr updatedEntitiesPtr,
310 out int collidersCount, 311 out int collidersCount,
311 out IntPtr collidersPtr); 312 out IntPtr collidersPtr);
312 313
313public abstract bool PushUpdate2(BulletBody obj); 314public abstract bool PushUpdate(BulletBody obj);
315 */
314 316
315// ===================================================================================== 317// =====================================================================================
316// Mesh, hull, shape and body creation helper routines 318// Mesh, hull, shape and body creation helper routines
317public abstract BulletShape CreateMeshShape2(BulletWorld world, 319public abstract BulletShape CreateMeshShape(BulletWorld world,
318 int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices, 320 int indicesCount, int[] indices,
319 int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices ); 321 int verticesCount, float[] vertices );
320 322
321public abstract BulletShape CreateHullShape2(BulletWorld world, 323public abstract BulletShape CreateHullShape(BulletWorld world,
322 int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls); 324 int hullCount, float[] hulls);
323 325
324public abstract BulletShape BuildHullShapeFromMesh2(BulletWorld world, BulletShape meshShape); 326public abstract BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape);
325 327
326public abstract BulletShape BuildNativeShape2(BulletWorld world, ShapeData shapeData); 328public abstract BulletShape BuildNativeShape(BulletWorld world, ShapeData shapeData);
327 329
328public abstract bool IsNativeShape2(BulletShape shape); 330public abstract bool IsNativeShape(BulletShape shape);
329 331
330public abstract void SetShapeCollisionMargin(BulletShape shape, float margin); 332public abstract void SetShapeCollisionMargin(BulletShape shape, float margin);
331 333
332public abstract BulletShape BuildCapsuleShape2(BulletWorld world, float radius, float height, Vector3 scale); 334public abstract BulletShape BuildCapsuleShape(BulletWorld world, float radius, float height, Vector3 scale);
333
334public abstract BulletShape CreateCompoundShape2(BulletWorld sim, bool enableDynamicAabbTree);
335
336public abstract int GetNumberOfCompoundChildren2(BulletShape cShape);
337
338public abstract void AddChildShapeToCompoundShape2(BulletShape cShape, BulletShape addShape, Vector3 pos, Quaternion rot);
339
340public abstract BulletShape GetChildShapeFromCompoundShapeIndex2(BulletShape cShape, int indx);
341
342public abstract BulletShape RemoveChildShapeFromCompoundShapeIndex2(BulletShape cShape, int indx);
343
344public abstract void RemoveChildShapeFromCompoundShape2(BulletShape cShape, BulletShape removeShape);
345
346public abstract void RecalculateCompoundShapeLocalAabb2(BulletShape cShape);
347
348public abstract BulletShape DuplicateCollisionShape2(BulletWorld sim, BulletShape srcShape, uint id);
349
350public abstract BulletBody CreateBodyFromShapeAndInfo2(BulletWorld sim, BulletShape shape, uint id, IntPtr constructionInfo);
351
352public abstract bool DeleteCollisionShape2(BulletWorld world, BulletShape shape);
353
354public abstract int GetBodyType2(BulletBody obj);
355
356public abstract BulletBody CreateBodyFromShape2(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot);
357
358public abstract BulletBody CreateBodyWithDefaultMotionState2(BulletShape shape, uint id, Vector3 pos, Quaternion rot);
359
360public abstract BulletBody CreateGhostFromShape2(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot);
361
362public abstract IntPtr AllocateBodyInfo2(BulletBody obj);
363
364public abstract void ReleaseBodyInfo2(IntPtr obj);
365
366public abstract void DestroyObject2(BulletWorld sim, BulletBody obj);
367
368// =====================================================================================
369// Terrain creation and helper routines
370public abstract IntPtr CreateHeightMapInfo2(BulletWorld sim, uint id, Vector3 minCoords, Vector3 maxCoords,
371 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
372
373public abstract IntPtr FillHeightMapInfo2(BulletWorld sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords,
374 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
375
376public abstract bool ReleaseHeightMapInfo2(IntPtr heightMapInfo);
377
378public abstract BulletBody CreateGroundPlaneShape2(uint id, float height, float collisionMargin);
379
380public abstract BulletBody CreateTerrainShape2(IntPtr mapInfo);
381
382// =====================================================================================
383// Constraint creation and helper routines
384public abstract BulletConstraint Create6DofConstraint2(BulletWorld world, BulletBody obj1, BulletBody obj2,
385 Vector3 frame1loc, Quaternion frame1rot,
386 Vector3 frame2loc, Quaternion frame2rot,
387 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
388
389public abstract BulletConstraint Create6DofConstraintToPoint2(BulletWorld world, BulletBody obj1, BulletBody obj2,
390 Vector3 joinPoint,
391 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
392
393public abstract BulletConstraint CreateHingeConstraint2(BulletWorld world, BulletBody obj1, BulletBody obj2,
394 Vector3 pivotinA, Vector3 pivotinB,
395 Vector3 axisInA, Vector3 axisInB,
396 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
397
398public abstract void SetConstraintEnable2(BulletConstraint constrain, float numericTrueFalse);
399
400public abstract void SetConstraintNumSolverIterations2(BulletConstraint constrain, float iterations);
401
402public abstract bool SetFrames2(BulletConstraint constrain,
403 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot);
404
405public abstract bool SetLinearLimits2(BulletConstraint constrain, Vector3 low, Vector3 hi);
406
407public abstract bool SetAngularLimits2(BulletConstraint constrain, Vector3 low, Vector3 hi);
408
409public abstract bool UseFrameOffset2(BulletConstraint constrain, float enable);
410
411public abstract bool TranslationalLimitMotor2(BulletConstraint constrain, float enable, float targetVel, float maxMotorForce);
412
413public abstract bool SetBreakingImpulseThreshold2(BulletConstraint constrain, float threshold);
414
415public abstract bool CalculateTransforms2(BulletConstraint constrain);
416
417public abstract bool SetConstraintParam2(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis);
418
419public abstract bool DestroyConstraint2(BulletWorld world, BulletConstraint constrain);
420
421// =====================================================================================
422// btCollisionWorld entries
423public abstract void UpdateSingleAabb2(BulletWorld world, BulletBody obj);
424
425public abstract void UpdateAabbs2(BulletWorld world);
426
427public abstract bool GetForceUpdateAllAabbs2(BulletWorld world);
428
429public abstract void SetForceUpdateAllAabbs2(BulletWorld world, bool force);
430
431// =====================================================================================
432// btDynamicsWorld entries
433public abstract bool AddObjectToWorld2(BulletWorld world, BulletBody obj);
434
435public abstract bool RemoveObjectFromWorld2(BulletWorld world, BulletBody obj);
436
437public abstract bool AddConstraintToWorld2(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects);
438
439public abstract bool RemoveConstraintFromWorld2(BulletWorld world, BulletConstraint constrain);
440// =====================================================================================
441// btCollisionObject entries
442public abstract Vector3 GetAnisotripicFriction2(BulletConstraint constrain);
443
444public abstract Vector3 SetAnisotripicFriction2(BulletConstraint constrain, Vector3 frict);
445
446public abstract bool HasAnisotripicFriction2(BulletConstraint constrain);
447
448public abstract void SetContactProcessingThreshold2(BulletBody obj, float val);
449
450public abstract float GetContactProcessingThreshold2(BulletBody obj);
451
452public abstract bool IsStaticObject2(BulletBody obj);
453
454public abstract bool IsKinematicObject2(BulletBody obj);
455
456public abstract bool IsStaticOrKinematicObject2(BulletBody obj);
457
458public abstract bool HasContactResponse2(BulletBody obj);
459
460public abstract void SetCollisionShape2(BulletWorld sim, BulletBody obj, BulletBody shape);
461
462public abstract BulletShape GetCollisionShape2(BulletBody obj);
463
464public abstract int GetActivationState2(BulletBody obj);
465
466public abstract void SetActivationState2(BulletBody obj, int state);
467
468public abstract void SetDeactivationTime2(BulletBody obj, float dtime);
469
470public abstract float GetDeactivationTime2(BulletBody obj);
471
472public abstract void ForceActivationState2(BulletBody obj, ActivationState state);
473
474public abstract void Activate2(BulletBody obj, bool forceActivation);
475
476public abstract bool IsActive2(BulletBody obj);
477
478public abstract void SetRestitution2(BulletBody obj, float val);
479
480public abstract float GetRestitution2(BulletBody obj);
481
482public abstract void SetFriction2(BulletBody obj, float val);
483
484public abstract float GetFriction2(BulletBody obj);
485
486 /* Haven't defined the type 'Transform'
487public abstract Transform GetWorldTransform2(BulletBody obj);
488
489public abstract void setWorldTransform2(BulletBody obj, Transform trans);
490 */
491
492public abstract Vector3 GetPosition2(BulletBody obj);
493
494public abstract Quaternion GetOrientation2(BulletBody obj);
495
496public abstract void SetTranslation2(BulletBody obj, Vector3 position, Quaternion rotation);
497
498public abstract IntPtr GetBroadphaseHandle2(BulletBody obj);
499
500public abstract void SetBroadphaseHandle2(BulletBody obj, IntPtr handle);
501
502 /*
503public abstract Transform GetInterpolationWorldTransform2(IntPtr obj);
504
505public abstract void SetInterpolationWorldTransform2(IntPtr obj, Transform trans);
506 */
507
508public abstract void SetInterpolationLinearVelocity2(BulletBody obj, Vector3 vel);
509
510public abstract void SetInterpolationAngularVelocity2(BulletBody obj, Vector3 vel);
511
512public abstract void SetInterpolationVelocity2(BulletBody obj, Vector3 linearVel, Vector3 angularVel);
513
514public abstract float GetHitFraction2(BulletBody obj);
515
516public abstract void SetHitFraction2(BulletBody obj, float val);
517
518public abstract CollisionFlags GetCollisionFlags2(BulletBody obj);
519
520public abstract CollisionFlags SetCollisionFlags2(BulletBody obj, CollisionFlags flags);
521
522public abstract CollisionFlags AddToCollisionFlags2(BulletBody obj, CollisionFlags flags);
523
524public abstract CollisionFlags RemoveFromCollisionFlags2(BulletBody obj, CollisionFlags flags);
525
526public abstract float GetCcdMotionThreshold2(BulletBody obj);
527
528public abstract void SetCcdMotionThreshold2(BulletBody obj, float val);
529
530public abstract float GetCcdSweptSphereRadius2(BulletBody obj);
531
532public abstract void SetCcdSweptSphereRadius2(BulletBody obj, float val);
533
534public abstract IntPtr GetUserPointer2(BulletBody obj);
535
536public abstract void SetUserPointer2(BulletBody obj, IntPtr val);
537
538// =====================================================================================
539// btRigidBody entries
540public abstract void ApplyGravity2(BulletBody obj);
541
542public abstract void SetGravity2(BulletBody obj, Vector3 val);
543
544public abstract Vector3 GetGravity2(BulletBody obj);
545
546public abstract void SetDamping2(BulletBody obj, float lin_damping, float ang_damping);
547
548public abstract void SetLinearDamping2(BulletBody obj, float lin_damping);
549
550public abstract void SetAngularDamping2(BulletBody obj, float ang_damping);
551
552public abstract float GetLinearDamping2(BulletBody obj);
553 335
554public abstract float GetAngularDamping2(BulletBody obj); 336public abstract BulletShape CreateCompoundShape(BulletWorld sim, bool enableDynamicAabbTree);
555 337
556public abstract float GetLinearSleepingThreshold2(BulletBody obj); 338public abstract int GetNumberOfCompoundChildren(BulletShape cShape);
557 339
340public abstract void AddChildShapeToCompoundShape(BulletShape cShape, BulletShape addShape, Vector3 pos, Quaternion rot);
558 341
559public abstract void ApplyDamping2(BulletBody obj, float timeStep); 342public abstract BulletShape GetChildShapeFromCompoundShapeIndex(BulletShape cShape, int indx);
560 343
561public abstract void SetMassProps2(BulletBody obj, float mass, Vector3 inertia); 344public abstract BulletShape RemoveChildShapeFromCompoundShapeIndex(BulletShape cShape, int indx);
562 345
563public abstract Vector3 GetLinearFactor2(BulletBody obj); 346public abstract void RemoveChildShapeFromCompoundShape(BulletShape cShape, BulletShape removeShape);
564 347
565public abstract void SetLinearFactor2(BulletBody obj, Vector3 factor); 348public abstract void RecalculateCompoundShapeLocalAabb(BulletShape cShape);
566 349
567 /* 350public abstract BulletShape DuplicateCollisionShape(BulletWorld sim, BulletShape srcShape, uint id);
568public abstract void SetCenterOfMassTransform2(BulletBody obj, Transform trans);
569 */
570
571public abstract void SetCenterOfMassByPosRot2(BulletBody obj, Vector3 pos, Quaternion rot);
572
573// Add a force to the object as if its mass is one.
574public abstract void ApplyCentralForce2(BulletBody obj, Vector3 force);
575
576// Set the force being applied to the object as if its mass is one.
577public abstract void SetObjectForce2(BulletBody obj, Vector3 force);
578
579public abstract Vector3 GetTotalForce2(BulletBody obj);
580 351
581public abstract Vector3 GetTotalTorque2(BulletBody obj); 352public abstract BulletBody CreateBodyFromShapeAndInfo(BulletWorld sim, BulletShape shape, uint id, IntPtr constructionInfo);
582 353
583public abstract Vector3 GetInvInertiaDiagLocal2(BulletBody obj); 354public abstract bool DeleteCollisionShape(BulletWorld world, BulletShape shape);
584 355
585public abstract void SetInvInertiaDiagLocal2(BulletBody obj, Vector3 inert); 356public abstract int GetBodyType(BulletBody obj);
586 357
587public abstract void SetSleepingThresholds2(BulletBody obj, float lin_threshold, float ang_threshold); 358public abstract BulletBody CreateBodyFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot);
588 359
589public abstract void ApplyTorque2(BulletBody obj, Vector3 torque); 360public abstract BulletBody CreateBodyWithDefaultMotionState(BulletShape shape, uint id, Vector3 pos, Quaternion rot);
590
591// Apply force at the given point. Will add torque to the object.
592public abstract void ApplyForce2(BulletBody obj, Vector3 force, Vector3 pos);
593
594// Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass.
595public abstract void ApplyCentralImpulse2(BulletBody obj, Vector3 imp);
596
597// Apply impulse to the object's torque. Force is scaled by object's mass.
598public abstract void ApplyTorqueImpulse2(BulletBody obj, Vector3 imp);
599
600// Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces.
601public abstract void ApplyImpulse2(BulletBody obj, Vector3 imp, Vector3 pos);
602 361
603public abstract void ClearForces2(BulletBody obj); 362public abstract BulletBody CreateGhostFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot);
604 363
605public abstract void ClearAllForces2(BulletBody obj); 364public abstract IntPtr AllocateBodyInfo(BulletBody obj);
606 365
607public abstract void UpdateInertiaTensor2(BulletBody obj); 366public abstract void ReleaseBodyInfo(IntPtr obj);
608 367
368public abstract void DestroyObject(BulletWorld sim, BulletBody obj);
609 369
610 /* 370 /*
611public abstract Transform GetCenterOfMassTransform2(BulletBody obj);
612 */
613
614public abstract Vector3 GetLinearVelocity2(BulletBody obj);
615
616public abstract Vector3 GetAngularVelocity2(BulletBody obj);
617
618public abstract void SetLinearVelocity2(BulletBody obj, Vector3 val);
619
620public abstract void SetAngularVelocity2(BulletBody obj, Vector3 angularVelocity);
621
622public abstract Vector3 GetVelocityInLocalPoint2(BulletBody obj, Vector3 pos);
623
624public abstract void Translate2(BulletBody obj, Vector3 trans);
625
626public abstract void UpdateDeactivation2(BulletBody obj, float timeStep);
627
628public abstract bool WantsSleeping2(BulletBody obj);
629
630public abstract void SetAngularFactor2(BulletBody obj, float factor);
631
632public abstract void SetAngularFactorV2(BulletBody obj, Vector3 factor);
633
634public abstract Vector3 GetAngularFactor2(BulletBody obj);
635
636public abstract bool IsInWorld2(BulletBody obj);
637
638public abstract void AddConstraintRef2(BulletBody obj, BulletConstraint constrain);
639
640public abstract void RemoveConstraintRef2(BulletBody obj, BulletConstraint constrain);
641
642public abstract BulletConstraint GetConstraintRef2(BulletBody obj, int index);
643
644public abstract int GetNumConstraintRefs2(BulletBody obj);
645
646public abstract bool SetCollisionGroupMask2(BulletBody body, uint filter, uint mask);
647
648// =====================================================================================
649// btCollisionShape entries
650
651public abstract float GetAngularMotionDisc2(BulletShape shape);
652
653public abstract float GetContactBreakingThreshold2(BulletShape shape, float defaultFactor);
654
655public abstract bool IsPolyhedral2(BulletShape shape);
656
657public abstract bool IsConvex2d2(BulletShape shape);
658
659public abstract bool IsConvex2(BulletShape shape);
660
661public abstract bool IsNonMoving2(BulletShape shape);
662
663public abstract bool IsConcave2(BulletShape shape);
664
665public abstract bool IsCompound2(BulletShape shape);
666
667public abstract bool IsSoftBody2(BulletShape shape);
668
669public abstract bool IsInfinite2(BulletShape shape);
670
671public abstract void SetLocalScaling2(BulletShape shape, Vector3 scale);
672
673public abstract Vector3 GetLocalScaling2(BulletShape shape);
674
675public abstract Vector3 CalculateLocalInertia2(BulletShape shape, float mass);
676
677public abstract int GetShapeType2(BulletShape shape);
678
679public abstract void SetMargin2(BulletShape shape, float val);
680
681public abstract float GetMargin2(BulletShape shape);
682
683};
684
685// ===============================================================================
686static class BulletSimAPI {
687// ===============================================================================
688// Link back to the managed code for outputting log messages
689[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
690public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg);
691
692// ===============================================================================
693// Initialization and simulation
694[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
695public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms,
696 int maxCollisions, IntPtr collisionArray,
697 int maxUpdates, IntPtr updateArray,
698 DebugLogCallback logRoutine);
699
700[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
701public static extern bool UpdateParameter2(IntPtr world, uint localID, String parm, float value);
702
703[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
704public static extern void SetHeightMap2(IntPtr world, float[] heightmap);
705
706[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
707public static extern void Shutdown2(IntPtr sim);
708
709[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
710public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep,
711 out int updatedEntityCount,
712 out IntPtr updatedEntitiesPtr,
713 out int collidersCount,
714 out IntPtr collidersPtr);
715
716[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
717public static extern bool PushUpdate2(IntPtr obj);
718
719// =====================================================================================
720// Mesh, hull, shape and body creation helper routines
721[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
722public static extern IntPtr CreateMeshShape2(IntPtr world,
723 int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices,
724 int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices );
725
726[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
727public static extern IntPtr CreateHullShape2(IntPtr world,
728 int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls);
729
730[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
731public static extern IntPtr BuildHullShapeFromMesh2(IntPtr world, IntPtr meshShape);
732
733[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
734public static extern IntPtr BuildNativeShape2(IntPtr world, ShapeData shapeData);
735
736[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
737public static extern bool IsNativeShape2(IntPtr shape);
738
739[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
740public static extern void SetShapeCollisionMargin(IntPtr shape, float margin);
741
742[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
743public static extern IntPtr BuildCapsuleShape2(IntPtr world, float radius, float height, Vector3 scale);
744
745[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
746public static extern IntPtr CreateCompoundShape2(IntPtr sim, bool enableDynamicAabbTree);
747
748[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
749public static extern int GetNumberOfCompoundChildren2(IntPtr cShape);
750
751[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
752public static extern void AddChildShapeToCompoundShape2(IntPtr cShape, IntPtr addShape, Vector3 pos, Quaternion rot);
753
754[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
755public static extern IntPtr GetChildShapeFromCompoundShapeIndex2(IntPtr cShape, int indx);
756
757[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
758public static extern IntPtr RemoveChildShapeFromCompoundShapeIndex2(IntPtr cShape, int indx);
759
760[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
761public static extern void RemoveChildShapeFromCompoundShape2(IntPtr cShape, IntPtr removeShape);
762
763[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
764public static extern void RecalculateCompoundShapeLocalAabb2(IntPtr cShape);
765
766[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
767public static extern IntPtr DuplicateCollisionShape2(IntPtr sim, IntPtr srcShape, uint id);
768
769[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
770public static extern IntPtr CreateBodyFromShapeAndInfo2(IntPtr sim, IntPtr shape, uint id, IntPtr constructionInfo);
771
772[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
773public static extern bool DeleteCollisionShape2(IntPtr world, IntPtr shape);
774
775[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
776public static extern int GetBodyType2(IntPtr obj);
777
778[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
779public static extern IntPtr CreateBodyFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot);
780
781[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
782public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, uint id, Vector3 pos, Quaternion rot);
783
784[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
785public static extern IntPtr CreateGhostFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot);
786
787[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
788public static extern IntPtr AllocateBodyInfo2(IntPtr obj);
789
790[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
791public static extern void ReleaseBodyInfo2(IntPtr obj);
792
793[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
794public static extern void DestroyObject2(IntPtr sim, IntPtr obj);
795
796// ===================================================================================== 371// =====================================================================================
797// Terrain creation and helper routines 372// Terrain creation and helper routines
798[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 373public abstract IntPtr CreateHeightMapInfo(BulletWorld sim, uint id, Vector3 minCoords, Vector3 maxCoords,
799public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords, 374 float[] heightMap, float collisionMargin);
800 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
801 375
802[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 376public abstract IntPtr FillHeightMapInfo(BulletWorld sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords,
803public static extern IntPtr FillHeightMapInfo2(IntPtr sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords, 377 float[] heightMap, float collisionMargin);
804 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
805 378
806[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 379public abstract bool ReleaseHeightMapInfo(IntPtr heightMapInfo);
807public static extern bool ReleaseHeightMapInfo2(IntPtr heightMapInfo);
808 380
809[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 381public abstract BulletBody CreateGroundPlaneShape(uint id, float height, float collisionMargin);
810public static extern IntPtr CreateGroundPlaneShape2(uint id, float height, float collisionMargin);
811 382
812[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 383public abstract BulletBody CreateTerrainShape(IntPtr mapInfo);
813public static extern IntPtr CreateTerrainShape2(IntPtr mapInfo);
814 384
815// ===================================================================================== 385// =====================================================================================
816// Constraint creation and helper routines 386// Constraint creation and helper routines
817[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 387public abstract BulletConstraint Create6DofConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2,
818public static extern IntPtr Create6DofConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2,
819 Vector3 frame1loc, Quaternion frame1rot, 388 Vector3 frame1loc, Quaternion frame1rot,
820 Vector3 frame2loc, Quaternion frame2rot, 389 Vector3 frame2loc, Quaternion frame2rot,
821 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); 390 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
822 391
823[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 392public abstract BulletConstraint Create6DofConstraintToPoint(BulletWorld world, BulletBody obj1, BulletBody obj2,
824public static extern IntPtr Create6DofConstraintToPoint2(IntPtr world, IntPtr obj1, IntPtr obj2,
825 Vector3 joinPoint, 393 Vector3 joinPoint,
826 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); 394 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
827 395
828[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 396public abstract BulletConstraint CreateHingeConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2,
829public static extern IntPtr CreateHingeConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2,
830 Vector3 pivotinA, Vector3 pivotinB, 397 Vector3 pivotinA, Vector3 pivotinB,
831 Vector3 axisInA, Vector3 axisInB, 398 Vector3 axisInA, Vector3 axisInB,
832 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); 399 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
833 400
834[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 401public abstract void SetConstraintEnable(BulletConstraint constrain, float numericTrueFalse);
835public static extern void SetConstraintEnable2(IntPtr constrain, float numericTrueFalse);
836 402
837[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 403public abstract void SetConstraintNumSolverIterations(BulletConstraint constrain, float iterations);
838public static extern void SetConstraintNumSolverIterations2(IntPtr constrain, float iterations);
839 404
840[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 405public abstract bool SetFrames(BulletConstraint constrain,
841public static extern bool SetFrames2(IntPtr constrain,
842 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot); 406 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot);
843 407
844[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 408public abstract bool SetLinearLimits(BulletConstraint constrain, Vector3 low, Vector3 hi);
845public static extern bool SetLinearLimits2(IntPtr constrain, Vector3 low, Vector3 hi);
846 409
847[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 410public abstract bool SetAngularLimits(BulletConstraint constrain, Vector3 low, Vector3 hi);
848public static extern bool SetAngularLimits2(IntPtr constrain, Vector3 low, Vector3 hi);
849 411
850[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 412public abstract bool UseFrameOffset(BulletConstraint constrain, float enable);
851public static extern bool UseFrameOffset2(IntPtr constrain, float enable);
852 413
853[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 414public abstract bool TranslationalLimitMotor(BulletConstraint constrain, float enable, float targetVel, float maxMotorForce);
854public static extern bool TranslationalLimitMotor2(IntPtr constrain, float enable, float targetVel, float maxMotorForce);
855 415
856[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 416public abstract bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold);
857public static extern bool SetBreakingImpulseThreshold2(IntPtr constrain, float threshold);
858 417
859[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 418public abstract bool CalculateTransforms(BulletConstraint constrain);
860public static extern bool CalculateTransforms2(IntPtr constrain);
861 419
862[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 420public abstract bool SetConstraintParam(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis);
863public static extern bool SetConstraintParam2(IntPtr constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis);
864 421
865[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 422public abstract bool DestroyConstraint(BulletWorld world, BulletConstraint constrain);
866public static extern bool DestroyConstraint2(IntPtr world, IntPtr constrain);
867 423
868// ===================================================================================== 424// =====================================================================================
869// btCollisionWorld entries 425// btCollisionWorld entries
870[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 426public abstract void UpdateSingleAabb(BulletWorld world, BulletBody obj);
871public static extern void UpdateSingleAabb2(IntPtr world, IntPtr obj);
872 427
873[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 428public abstract void UpdateAabbs(BulletWorld world);
874public static extern void UpdateAabbs2(IntPtr world);
875 429
876[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 430public abstract bool GetForceUpdateAllAabbs(BulletWorld world);
877public static extern bool GetForceUpdateAllAabbs2(IntPtr world);
878 431
879[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 432public abstract void SetForceUpdateAllAabbs(BulletWorld world, bool force);
880public static extern void SetForceUpdateAllAabbs2(IntPtr world, bool force);
881 433
882// ===================================================================================== 434// =====================================================================================
883// btDynamicsWorld entries 435// btDynamicsWorld entries
884[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 436public abstract bool AddObjectToWorld(BulletWorld world, BulletBody obj);
885public static extern bool AddObjectToWorld2(IntPtr world, IntPtr obj);
886 437
887[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 438public abstract bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj);
888public static extern bool RemoveObjectFromWorld2(IntPtr world, IntPtr obj);
889 439
890[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 440public abstract bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects);
891public static extern bool AddConstraintToWorld2(IntPtr world, IntPtr constrain, bool disableCollisionsBetweenLinkedObjects);
892 441
893[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 442public abstract bool RemoveConstraintFromWorld(BulletWorld world, BulletConstraint constrain);
894public static extern bool RemoveConstraintFromWorld2(IntPtr world, IntPtr constrain);
895// ===================================================================================== 443// =====================================================================================
896// btCollisionObject entries 444// btCollisionObject entries
897[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 445public abstract Vector3 GetAnisotripicFriction(BulletConstraint constrain);
898public static extern Vector3 GetAnisotripicFriction2(IntPtr constrain);
899 446
900[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 447public abstract Vector3 SetAnisotripicFriction(BulletConstraint constrain, Vector3 frict);
901public static extern Vector3 SetAnisotripicFriction2(IntPtr constrain, Vector3 frict);
902 448
903[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 449public abstract bool HasAnisotripicFriction(BulletConstraint constrain);
904public static extern bool HasAnisotripicFriction2(IntPtr constrain);
905 450
906[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 451public abstract void SetContactProcessingThreshold(BulletBody obj, float val);
907public static extern void SetContactProcessingThreshold2(IntPtr obj, float val);
908 452
909[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 453public abstract float GetContactProcessingThreshold(BulletBody obj);
910public static extern float GetContactProcessingThreshold2(IntPtr obj);
911 454
912[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 455public abstract bool IsStaticObject(BulletBody obj);
913public static extern bool IsStaticObject2(IntPtr obj);
914 456
915[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 457public abstract bool IsKinematicObject(BulletBody obj);
916public static extern bool IsKinematicObject2(IntPtr obj);
917 458
918[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 459public abstract bool IsStaticOrKinematicObject(BulletBody obj);
919public static extern bool IsStaticOrKinematicObject2(IntPtr obj);
920 460
921[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 461public abstract bool HasContactResponse(BulletBody obj);
922public static extern bool HasContactResponse2(IntPtr obj);
923 462
924[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 463public abstract void SetCollisionShape(BulletWorld sim, BulletBody obj, BulletBody shape);
925public static extern void SetCollisionShape2(IntPtr sim, IntPtr obj, IntPtr shape);
926 464
927[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 465public abstract BulletShape GetCollisionShape(BulletBody obj);
928public static extern IntPtr GetCollisionShape2(IntPtr obj);
929 466
930[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 467public abstract int GetActivationState(BulletBody obj);
931public static extern int GetActivationState2(IntPtr obj);
932 468
933[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 469public abstract void SetActivationState(BulletBody obj, int state);
934public static extern void SetActivationState2(IntPtr obj, int state);
935 470
936[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 471public abstract void SetDeactivationTime(BulletBody obj, float dtime);
937public static extern void SetDeactivationTime2(IntPtr obj, float dtime);
938 472
939[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 473public abstract float GetDeactivationTime(BulletBody obj);
940public static extern float GetDeactivationTime2(IntPtr obj);
941 474
942[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 475public abstract void ForceActivationState(BulletBody obj, ActivationState state);
943public static extern void ForceActivationState2(IntPtr obj, ActivationState state);
944 476
945[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 477public abstract void Activate(BulletBody obj, bool forceActivation);
946public static extern void Activate2(IntPtr obj, bool forceActivation);
947 478
948[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 479public abstract bool IsActive(BulletBody obj);
949public static extern bool IsActive2(IntPtr obj);
950 480
951[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 481public abstract void SetRestitution(BulletBody obj, float val);
952public static extern void SetRestitution2(IntPtr obj, float val);
953 482
954[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 483public abstract float GetRestitution(BulletBody obj);
955public static extern float GetRestitution2(IntPtr obj);
956 484
957[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 485public abstract void SetFriction(BulletBody obj, float val);
958public static extern void SetFriction2(IntPtr obj, float val);
959 486
960[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 487public abstract float GetFriction(BulletBody obj);
961public static extern float GetFriction2(IntPtr obj);
962 488
963 /* Haven't defined the type 'Transform' 489public abstract Vector3 GetPosition(BulletBody obj);
964[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
965public static extern Transform GetWorldTransform2(IntPtr obj);
966 490
967[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 491public abstract Quaternion GetOrientation(BulletBody obj);
968public static extern void setWorldTransform2(IntPtr obj, Transform trans);
969 */
970 492
971[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 493public abstract void SetTranslation(BulletBody obj, Vector3 position, Quaternion rotation);
972public static extern Vector3 GetPosition2(IntPtr obj);
973 494
974[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 495public abstract IntPtr GetBroadphaseHandle(BulletBody obj);
975public static extern Quaternion GetOrientation2(IntPtr obj);
976 496
977[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 497public abstract void SetBroadphaseHandle(BulletBody obj, IntPtr handle);
978public static extern void SetTranslation2(IntPtr obj, Vector3 position, Quaternion rotation);
979 498
980[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 499public abstract void SetInterpolationLinearVelocity(BulletBody obj, Vector3 vel);
981public static extern IntPtr GetBroadphaseHandle2(IntPtr obj);
982 500
983[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 501public abstract void SetInterpolationAngularVelocity(BulletBody obj, Vector3 vel);
984public static extern void SetBroadphaseHandle2(IntPtr obj, IntPtr handle);
985 502
986 /* 503public abstract void SetInterpolationVelocity(BulletBody obj, Vector3 linearVel, Vector3 angularVel);
987[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
988public static extern Transform GetInterpolationWorldTransform2(IntPtr obj);
989 504
990[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 505public abstract float GetHitFraction(BulletBody obj);
991public static extern void SetInterpolationWorldTransform2(IntPtr obj, Transform trans);
992 */
993
994[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
995public static extern void SetInterpolationLinearVelocity2(IntPtr obj, Vector3 vel);
996
997[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
998public static extern void SetInterpolationAngularVelocity2(IntPtr obj, Vector3 vel);
999
1000[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1001public static extern void SetInterpolationVelocity2(IntPtr obj, Vector3 linearVel, Vector3 angularVel);
1002 506
1003[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 507public abstract void SetHitFraction(BulletBody obj, float val);
1004public static extern float GetHitFraction2(IntPtr obj);
1005 508
1006[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 509public abstract CollisionFlags GetCollisionFlags(BulletBody obj);
1007public static extern void SetHitFraction2(IntPtr obj, float val);
1008 510
1009[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 511public abstract CollisionFlags SetCollisionFlags(BulletBody obj, CollisionFlags flags);
1010public static extern CollisionFlags GetCollisionFlags2(IntPtr obj);
1011 512
1012[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 513public abstract CollisionFlags AddToCollisionFlags(BulletBody obj, CollisionFlags flags);
1013public static extern CollisionFlags SetCollisionFlags2(IntPtr obj, CollisionFlags flags);
1014 514
1015[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 515public abstract CollisionFlags RemoveFromCollisionFlags(BulletBody obj, CollisionFlags flags);
1016public static extern CollisionFlags AddToCollisionFlags2(IntPtr obj, CollisionFlags flags);
1017 516
1018[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 517public abstract float GetCcdMotionThreshold(BulletBody obj);
1019public static extern CollisionFlags RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags);
1020 518
1021[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 519public abstract void SetCcdMotionThreshold(BulletBody obj, float val);
1022public static extern float GetCcdMotionThreshold2(IntPtr obj);
1023 520
1024[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 521public abstract float GetCcdSweptSphereRadius(BulletBody obj);
1025public static extern void SetCcdMotionThreshold2(IntPtr obj, float val);
1026 522
1027[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 523public abstract void SetCcdSweptSphereRadius(BulletBody obj, float val);
1028public static extern float GetCcdSweptSphereRadius2(IntPtr obj);
1029 524
1030[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 525public abstract IntPtr GetUserPointer(BulletBody obj);
1031public static extern void SetCcdSweptSphereRadius2(IntPtr obj, float val);
1032 526
1033[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 527public abstract void SetUserPointer(BulletBody obj, IntPtr val);
1034public static extern IntPtr GetUserPointer2(IntPtr obj);
1035
1036[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1037public static extern void SetUserPointer2(IntPtr obj, IntPtr val);
1038 528
1039// ===================================================================================== 529// =====================================================================================
1040// btRigidBody entries 530// btRigidBody entries
1041[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 531public abstract void ApplyGravity(BulletBody obj);
1042public static extern void ApplyGravity2(IntPtr obj);
1043
1044[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1045public static extern void SetGravity2(IntPtr obj, Vector3 val);
1046 532
1047[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 533public abstract void SetGravity(BulletBody obj, Vector3 val);
1048public static extern Vector3 GetGravity2(IntPtr obj);
1049 534
1050[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 535public abstract Vector3 GetGravity(BulletBody obj);
1051public static extern void SetDamping2(IntPtr obj, float lin_damping, float ang_damping);
1052 536
1053[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 537public abstract void SetDamping(BulletBody obj, float lin_damping, float ang_damping);
1054public static extern void SetLinearDamping2(IntPtr obj, float lin_damping);
1055 538
1056[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 539public abstract void SetLinearDamping(BulletBody obj, float lin_damping);
1057public static extern void SetAngularDamping2(IntPtr obj, float ang_damping);
1058 540
1059[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 541public abstract void SetAngularDamping(BulletBody obj, float ang_damping);
1060public static extern float GetLinearDamping2(IntPtr obj);
1061 542
1062[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 543public abstract float GetLinearDamping(BulletBody obj);
1063public static extern float GetAngularDamping2(IntPtr obj);
1064 544
1065[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 545public abstract float GetAngularDamping(BulletBody obj);
1066public static extern float GetLinearSleepingThreshold2(IntPtr obj);
1067 546
1068[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 547public abstract float GetLinearSleepingThreshold(BulletBody obj);
1069public static extern float GetAngularSleepingThreshold2(IntPtr obj);
1070 548
1071[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1072public static extern void ApplyDamping2(IntPtr obj, float timeStep);
1073 549
1074[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 550public abstract void ApplyDamping(BulletBody obj, float timeStep);
1075public static extern void SetMassProps2(IntPtr obj, float mass, Vector3 inertia);
1076 551
1077[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 552public abstract void SetMassProps(BulletBody obj, float mass, Vector3 inertia);
1078public static extern Vector3 GetLinearFactor2(IntPtr obj);
1079 553
1080[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 554public abstract Vector3 GetLinearFactor(BulletBody obj);
1081public static extern void SetLinearFactor2(IntPtr obj, Vector3 factor);
1082 555
1083 /* 556public abstract void SetLinearFactor(BulletBody obj, Vector3 factor);
1084[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1085public static extern void SetCenterOfMassTransform2(IntPtr obj, Transform trans);
1086 */
1087 557
1088[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 558public abstract void SetCenterOfMassByPosRot(BulletBody obj, Vector3 pos, Quaternion rot);
1089public static extern void SetCenterOfMassByPosRot2(IntPtr obj, Vector3 pos, Quaternion rot);
1090 559
1091// Add a force to the object as if its mass is one. 560// Add a force to the object as if its mass is one.
1092[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 561public abstract void ApplyCentralForce(BulletBody obj, Vector3 force);
1093public static extern void ApplyCentralForce2(IntPtr obj, Vector3 force);
1094 562
1095// Set the force being applied to the object as if its mass is one. 563// Set the force being applied to the object as if its mass is one.
1096[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 564public abstract void SetObjectForce(BulletBody obj, Vector3 force);
1097public static extern void SetObjectForce2(IntPtr obj, Vector3 force);
1098 565
1099[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 566public abstract Vector3 GetTotalForce(BulletBody obj);
1100public static extern Vector3 GetTotalForce2(IntPtr obj);
1101 567
1102[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 568public abstract Vector3 GetTotalTorque(BulletBody obj);
1103public static extern Vector3 GetTotalTorque2(IntPtr obj);
1104 569
1105[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 570public abstract Vector3 GetInvInertiaDiagLocal(BulletBody obj);
1106public static extern Vector3 GetInvInertiaDiagLocal2(IntPtr obj);
1107 571
1108[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 572public abstract void SetInvInertiaDiagLocal(BulletBody obj, Vector3 inert);
1109public static extern void SetInvInertiaDiagLocal2(IntPtr obj, Vector3 inert);
1110 573
1111[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 574public abstract void SetSleepingThresholds(BulletBody obj, float lin_threshold, float ang_threshold);
1112public static extern void SetSleepingThresholds2(IntPtr obj, float lin_threshold, float ang_threshold);
1113 575
1114[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 576public abstract void ApplyTorque(BulletBody obj, Vector3 torque);
1115public static extern void ApplyTorque2(IntPtr obj, Vector3 torque);
1116 577
1117// Apply force at the given point. Will add torque to the object. 578// Apply force at the given point. Will add torque to the object.
1118[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 579public abstract void ApplyForce(BulletBody obj, Vector3 force, Vector3 pos);
1119public static extern void ApplyForce2(IntPtr obj, Vector3 force, Vector3 pos);
1120 580
1121// Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass. 581// Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass.
1122[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 582public abstract void ApplyCentralImpulse(BulletBody obj, Vector3 imp);
1123public static extern void ApplyCentralImpulse2(IntPtr obj, Vector3 imp);
1124 583
1125// Apply impulse to the object's torque. Force is scaled by object's mass. 584// Apply impulse to the object's torque. Force is scaled by object's mass.
1126[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 585public abstract void ApplyTorqueImpulse(BulletBody obj, Vector3 imp);
1127public static extern void ApplyTorqueImpulse2(IntPtr obj, Vector3 imp);
1128 586
1129// Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces. 587// Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces.
1130[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 588public abstract void ApplyImpulse(BulletBody obj, Vector3 imp, Vector3 pos);
1131public static extern void ApplyImpulse2(IntPtr obj, Vector3 imp, Vector3 pos);
1132
1133[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1134public static extern void ClearForces2(IntPtr obj);
1135 589
1136[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 590public abstract void ClearForces(BulletBody obj);
1137public static extern void ClearAllForces2(IntPtr obj);
1138 591
1139[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 592public abstract void ClearAllForces(BulletBody obj);
1140public static extern void UpdateInertiaTensor2(IntPtr obj);
1141 593
1142[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 594public abstract void UpdateInertiaTensor(BulletBody obj);
1143public static extern Vector3 GetCenterOfMassPosition2(IntPtr obj);
1144
1145 /*
1146[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1147public static extern Transform GetCenterOfMassTransform2(IntPtr obj);
1148 */
1149 595
1150[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 596public abstract Vector3 GetLinearVelocity(BulletBody obj);
1151public static extern Vector3 GetLinearVelocity2(IntPtr obj);
1152 597
1153[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 598public abstract Vector3 GetAngularVelocity(BulletBody obj);
1154public static extern Vector3 GetAngularVelocity2(IntPtr obj);
1155 599
1156[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 600public abstract void SetLinearVelocity(BulletBody obj, Vector3 val);
1157public static extern void SetLinearVelocity2(IntPtr obj, Vector3 val);
1158 601
1159[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 602public abstract void SetAngularVelocity(BulletBody obj, Vector3 angularVelocity);
1160public static extern void SetAngularVelocity2(IntPtr obj, Vector3 angularVelocity);
1161 603
1162[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 604public abstract Vector3 GetVelocityInLocalPoint(BulletBody obj, Vector3 pos);
1163public static extern Vector3 GetVelocityInLocalPoint2(IntPtr obj, Vector3 pos);
1164 605
1165[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 606public abstract void Translate(BulletBody obj, Vector3 trans);
1166public static extern void Translate2(IntPtr obj, Vector3 trans);
1167 607
1168[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 608public abstract void UpdateDeactivation(BulletBody obj, float timeStep);
1169public static extern void UpdateDeactivation2(IntPtr obj, float timeStep);
1170 609
1171[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 610public abstract bool WantsSleeping(BulletBody obj);
1172public static extern bool WantsSleeping2(IntPtr obj);
1173 611
1174[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 612public abstract void SetAngularFactor(BulletBody obj, float factor);
1175public static extern void SetAngularFactor2(IntPtr obj, float factor);
1176 613
1177[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 614public abstract void SetAngularFactorV(BulletBody obj, Vector3 factor);
1178public static extern void SetAngularFactorV2(IntPtr obj, Vector3 factor);
1179 615
1180[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 616public abstract Vector3 GetAngularFactor(BulletBody obj);
1181public static extern Vector3 GetAngularFactor2(IntPtr obj);
1182 617
1183[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 618public abstract bool IsInWorld(BulletBody obj);
1184public static extern bool IsInWorld2(IntPtr obj);
1185 619
1186[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 620public abstract void AddConstraintRef(BulletBody obj, BulletConstraint constrain);
1187public static extern void AddConstraintRef2(IntPtr obj, IntPtr constrain);
1188 621
1189[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 622public abstract void RemoveConstraintRef(BulletBody obj, BulletConstraint constrain);
1190public static extern void RemoveConstraintRef2(IntPtr obj, IntPtr constrain);
1191 623
1192[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 624public abstract BulletConstraint GetConstraintRef(BulletBody obj, int index);
1193public static extern IntPtr GetConstraintRef2(IntPtr obj, int index);
1194 625
1195[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 626public abstract int GetNumConstraintRefs(BulletBody obj);
1196public static extern int GetNumConstraintRefs2(IntPtr obj);
1197 627
1198[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 628public abstract bool SetCollisionGroupMask(BulletBody body, uint filter, uint mask);
1199public static extern bool SetCollisionGroupMask2(IntPtr body, uint filter, uint mask);
1200 629
1201// ===================================================================================== 630// =====================================================================================
1202// btCollisionShape entries 631// btCollisionShape entries
1203 632
1204[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 633public abstract float GetAngularMotionDisc(BulletShape shape);
1205public static extern float GetAngularMotionDisc2(IntPtr shape);
1206
1207[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1208public static extern float GetContactBreakingThreshold2(IntPtr shape, float defaultFactor);
1209 634
1210[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 635public abstract float GetContactBreakingThreshold(BulletShape shape, float defaultFactor);
1211public static extern bool IsPolyhedral2(IntPtr shape);
1212 636
1213[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 637public abstract bool IsPolyhedral(BulletShape shape);
1214public static extern bool IsConvex2d2(IntPtr shape);
1215 638
1216[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 639public abstract bool IsConvex2d(BulletShape shape);
1217public static extern bool IsConvex2(IntPtr shape);
1218 640
1219[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 641public abstract bool IsConvex(BulletShape shape);
1220public static extern bool IsNonMoving2(IntPtr shape);
1221 642
1222[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 643public abstract bool IsNonMoving(BulletShape shape);
1223public static extern bool IsConcave2(IntPtr shape);
1224 644
1225[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 645public abstract bool IsConcave(BulletShape shape);
1226public static extern bool IsCompound2(IntPtr shape);
1227 646
1228[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 647public abstract bool IsCompound(BulletShape shape);
1229public static extern bool IsSoftBody2(IntPtr shape);
1230 648
1231[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 649public abstract bool IsSoftBody(BulletShape shape);
1232public static extern bool IsInfinite2(IntPtr shape);
1233 650
1234[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 651public abstract bool IsInfinite(BulletShape shape);
1235public static extern void SetLocalScaling2(IntPtr shape, Vector3 scale);
1236 652
1237[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 653public abstract void SetLocalScaling(BulletShape shape, Vector3 scale);
1238public static extern Vector3 GetLocalScaling2(IntPtr shape);
1239 654
1240[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 655public abstract Vector3 GetLocalScaling(BulletShape shape);
1241public static extern Vector3 CalculateLocalInertia2(IntPtr shape, float mass);
1242 656
1243[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 657public abstract Vector3 CalculateLocalInertia(BulletShape shape, float mass);
1244public static extern int GetShapeType2(IntPtr shape);
1245 658
1246[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 659public abstract int GetShapeType(BulletShape shape);
1247public static extern void SetMargin2(IntPtr shape, float val);
1248 660
1249[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 661public abstract void SetMargin(BulletShape shape, float val);
1250public static extern float GetMargin2(IntPtr shape);
1251
1252// =====================================================================================
1253// Debugging
1254[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1255public static extern void DumpRigidBody2(IntPtr sim, IntPtr collisionObject);
1256 662
1257[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 663public abstract float GetMargin(BulletShape shape);
1258public static extern void DumpCollisionShape2(IntPtr sim, IntPtr collisionShape); 664 */
1259 665
1260[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 666};
1261public static extern void DumpMapInfo2(IntPtr sim, IntPtr manInfo);
1262
1263[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1264public static extern void DumpConstraint2(IntPtr sim, IntPtr constrain);
1265
1266[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1267public static extern void DumpActivationInfo2(IntPtr sim);
1268
1269[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1270public static extern void DumpAllInfo2(IntPtr sim);
1271
1272[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1273public static extern void DumpPhysicsStatistics2(IntPtr sim);
1274
1275}
1276} 667}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
index 8ec9871..4cb8e6d 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
@@ -31,6 +31,7 @@ CRASHES
31 31
32VEHICLES TODO LIST: 32VEHICLES TODO LIST:
33================================================= 33=================================================
34Angular motor direction is global coordinates rather than local coordinates
34Border crossing with linked vehicle causes crash 35Border crossing with linked vehicle causes crash
35Vehicles (Move smoothly) 36Vehicles (Move smoothly)
36Add vehicle collisions so IsColliding is properly reported. 37Add vehicle collisions so IsColliding is properly reported.
@@ -78,7 +79,7 @@ Small physical objects do not interact correctly
78 Create chain of .5x.5x.1 torui and make all but top physical so to hang. 79 Create chain of .5x.5x.1 torui and make all but top physical so to hang.
79 The chain will fall apart and pairs will dance around on ground 80 The chain will fall apart and pairs will dance around on ground
80 Chains of 1x1x.2 will stay connected but will dance. 81 Chains of 1x1x.2 will stay connected but will dance.
81 Chains above 2x2x.4 are move stable and get stablier as torui get larger. 82 Chains above 2x2x.4 are more stable and get stablier as torui get larger.
82Add PID motor for avatar movement (slow to stop, ...) 83Add PID motor for avatar movement (slow to stop, ...)
83setForce should set a constant force. Different than AddImpulse. 84setForce should set a constant force. Different than AddImpulse.
84Implement raycast. 85Implement raycast.
@@ -100,9 +101,13 @@ More efficient memory usage when passing hull information from BSPrim to BulletS
100Avatar movement motor check for zero or small movement. Somehow suppress small movements 101Avatar movement motor check for zero or small movement. Somehow suppress small movements
101 when avatar has stopped and is just standing. Simple test for near zero has 102 when avatar has stopped and is just standing. Simple test for near zero has
102 the problem of preventing starting up (increase from zero) especially when falling. 103 the problem of preventing starting up (increase from zero) especially when falling.
104Physical and phantom will drop through the terrain
105
103 106
104LINKSETS 107LINKSETS
105====================================================== 108======================================================
109Offset the center of the linkset to be the geometric center of all the prims
110 Not quite the same as the center-of-gravity
106Linksets should allow collisions to individual children 111Linksets should allow collisions to individual children
107 Add LocalID to children shapes in LinksetCompound and create events for individuals 112 Add LocalID to children shapes in LinksetCompound and create events for individuals
108LinksetCompound: when one of the children changes orientation (like tires 113LinksetCompound: when one of the children changes orientation (like tires
diff --git a/prebuild.xml b/prebuild.xml
index 741b660..4c18aa8 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -1747,6 +1747,7 @@
1747 <Reference name="OpenSim.Framework.Console"/> 1747 <Reference name="OpenSim.Framework.Console"/>
1748 <Reference name="OpenSim.Region.Physics.Manager"/> 1748 <Reference name="OpenSim.Region.Physics.Manager"/>
1749 <Reference name="OpenSim.Region.Physics.ConvexDecompositionDotNet"/> 1749 <Reference name="OpenSim.Region.Physics.ConvexDecompositionDotNet"/>
1750 <Reference name="BulletXNA.dll" path="../../../../bin/"/>
1750 <Reference name="log4net.dll" path="../../../../bin/"/> 1751 <Reference name="log4net.dll" path="../../../../bin/"/>
1751 1752
1752 <Files> 1753 <Files>