diff options
author | Robert Adams | 2012-12-29 21:43:43 -0800 |
---|---|---|
committer | Robert Adams | 2012-12-31 19:57:21 -0800 |
commit | 48f718f39fcd61501262878a8bcfbd98efed29d2 (patch) | |
tree | aa67dbaf54d75152f01302921bbc42226daaec8b | |
parent | BulletSim: change physical data structures to classes. Add default (diff) | |
download | opensim-SC_OLD-48f718f39fcd61501262878a8bcfbd98efed29d2.zip opensim-SC_OLD-48f718f39fcd61501262878a8bcfbd98efed29d2.tar.gz opensim-SC_OLD-48f718f39fcd61501262878a8bcfbd98efed29d2.tar.bz2 opensim-SC_OLD-48f718f39fcd61501262878a8bcfbd98efed29d2.tar.xz |
BulletSim: first round of conversion from direct BulletSimAPI interfacing by BulletSim core to using the BulletSimAPITemplate. Physical object creation and destruction first.
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 | ||
293 | public abstract class BulletSimAPITemplate | 293 | public abstract class BulletSimAPITemplate |
294 | { | 294 | { |
295 | /* | ||
295 | // Initialization and simulation | 296 | // Initialization and simulation |
296 | public abstract BulletWorld Initialize2(Vector3 maxPosition, IntPtr parms, | 297 | public 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 | ||
301 | public abstract bool UpdateParameter2(BulletWorld world, uint localID, String parm, float value); | 302 | public abstract bool UpdateParameter(BulletWorld world, uint localID, String parm, float value); |
302 | 303 | ||
303 | public abstract void SetHeightMap2(BulletWorld world, float[] heightmap); | 304 | public abstract void SetHeightMap(BulletWorld world, float[] heightmap); |
304 | 305 | ||
305 | public abstract void Shutdown2(BulletWorld sim); | 306 | public abstract void Shutdown(BulletWorld sim); |
306 | 307 | ||
307 | public abstract int PhysicsStep2(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep, | 308 | public 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 | ||
313 | public abstract bool PushUpdate2(BulletBody obj); | 314 | public 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 |
317 | public abstract BulletShape CreateMeshShape2(BulletWorld world, | 319 | public 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 | ||
321 | public abstract BulletShape CreateHullShape2(BulletWorld world, | 323 | public abstract BulletShape CreateHullShape(BulletWorld world, |
322 | int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls); | 324 | int hullCount, float[] hulls); |
323 | 325 | ||
324 | public abstract BulletShape BuildHullShapeFromMesh2(BulletWorld world, BulletShape meshShape); | 326 | public abstract BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape); |
325 | 327 | ||
326 | public abstract BulletShape BuildNativeShape2(BulletWorld world, ShapeData shapeData); | 328 | public abstract BulletShape BuildNativeShape(BulletWorld world, ShapeData shapeData); |
327 | 329 | ||
328 | public abstract bool IsNativeShape2(BulletShape shape); | 330 | public abstract bool IsNativeShape(BulletShape shape); |
329 | 331 | ||
330 | public abstract void SetShapeCollisionMargin(BulletShape shape, float margin); | 332 | public abstract void SetShapeCollisionMargin(BulletShape shape, float margin); |
331 | 333 | ||
332 | public abstract BulletShape BuildCapsuleShape2(BulletWorld world, float radius, float height, Vector3 scale); | 334 | public abstract BulletShape BuildCapsuleShape(BulletWorld world, float radius, float height, Vector3 scale); |
333 | |||
334 | public abstract BulletShape CreateCompoundShape2(BulletWorld sim, bool enableDynamicAabbTree); | ||
335 | |||
336 | public abstract int GetNumberOfCompoundChildren2(BulletShape cShape); | ||
337 | |||
338 | public abstract void AddChildShapeToCompoundShape2(BulletShape cShape, BulletShape addShape, Vector3 pos, Quaternion rot); | ||
339 | |||
340 | public abstract BulletShape GetChildShapeFromCompoundShapeIndex2(BulletShape cShape, int indx); | ||
341 | |||
342 | public abstract BulletShape RemoveChildShapeFromCompoundShapeIndex2(BulletShape cShape, int indx); | ||
343 | |||
344 | public abstract void RemoveChildShapeFromCompoundShape2(BulletShape cShape, BulletShape removeShape); | ||
345 | |||
346 | public abstract void RecalculateCompoundShapeLocalAabb2(BulletShape cShape); | ||
347 | |||
348 | public abstract BulletShape DuplicateCollisionShape2(BulletWorld sim, BulletShape srcShape, uint id); | ||
349 | |||
350 | public abstract BulletBody CreateBodyFromShapeAndInfo2(BulletWorld sim, BulletShape shape, uint id, IntPtr constructionInfo); | ||
351 | |||
352 | public abstract bool DeleteCollisionShape2(BulletWorld world, BulletShape shape); | ||
353 | |||
354 | public abstract int GetBodyType2(BulletBody obj); | ||
355 | |||
356 | public abstract BulletBody CreateBodyFromShape2(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot); | ||
357 | |||
358 | public abstract BulletBody CreateBodyWithDefaultMotionState2(BulletShape shape, uint id, Vector3 pos, Quaternion rot); | ||
359 | |||
360 | public abstract BulletBody CreateGhostFromShape2(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot); | ||
361 | |||
362 | public abstract IntPtr AllocateBodyInfo2(BulletBody obj); | ||
363 | |||
364 | public abstract void ReleaseBodyInfo2(IntPtr obj); | ||
365 | |||
366 | public abstract void DestroyObject2(BulletWorld sim, BulletBody obj); | ||
367 | |||
368 | // ===================================================================================== | ||
369 | // Terrain creation and helper routines | ||
370 | public abstract IntPtr CreateHeightMapInfo2(BulletWorld sim, uint id, Vector3 minCoords, Vector3 maxCoords, | ||
371 | [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin); | ||
372 | |||
373 | public abstract IntPtr FillHeightMapInfo2(BulletWorld sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords, | ||
374 | [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin); | ||
375 | |||
376 | public abstract bool ReleaseHeightMapInfo2(IntPtr heightMapInfo); | ||
377 | |||
378 | public abstract BulletBody CreateGroundPlaneShape2(uint id, float height, float collisionMargin); | ||
379 | |||
380 | public abstract BulletBody CreateTerrainShape2(IntPtr mapInfo); | ||
381 | |||
382 | // ===================================================================================== | ||
383 | // Constraint creation and helper routines | ||
384 | public 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 | |||
389 | public abstract BulletConstraint Create6DofConstraintToPoint2(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
390 | Vector3 joinPoint, | ||
391 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
392 | |||
393 | public 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 | |||
398 | public abstract void SetConstraintEnable2(BulletConstraint constrain, float numericTrueFalse); | ||
399 | |||
400 | public abstract void SetConstraintNumSolverIterations2(BulletConstraint constrain, float iterations); | ||
401 | |||
402 | public abstract bool SetFrames2(BulletConstraint constrain, | ||
403 | Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot); | ||
404 | |||
405 | public abstract bool SetLinearLimits2(BulletConstraint constrain, Vector3 low, Vector3 hi); | ||
406 | |||
407 | public abstract bool SetAngularLimits2(BulletConstraint constrain, Vector3 low, Vector3 hi); | ||
408 | |||
409 | public abstract bool UseFrameOffset2(BulletConstraint constrain, float enable); | ||
410 | |||
411 | public abstract bool TranslationalLimitMotor2(BulletConstraint constrain, float enable, float targetVel, float maxMotorForce); | ||
412 | |||
413 | public abstract bool SetBreakingImpulseThreshold2(BulletConstraint constrain, float threshold); | ||
414 | |||
415 | public abstract bool CalculateTransforms2(BulletConstraint constrain); | ||
416 | |||
417 | public abstract bool SetConstraintParam2(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis); | ||
418 | |||
419 | public abstract bool DestroyConstraint2(BulletWorld world, BulletConstraint constrain); | ||
420 | |||
421 | // ===================================================================================== | ||
422 | // btCollisionWorld entries | ||
423 | public abstract void UpdateSingleAabb2(BulletWorld world, BulletBody obj); | ||
424 | |||
425 | public abstract void UpdateAabbs2(BulletWorld world); | ||
426 | |||
427 | public abstract bool GetForceUpdateAllAabbs2(BulletWorld world); | ||
428 | |||
429 | public abstract void SetForceUpdateAllAabbs2(BulletWorld world, bool force); | ||
430 | |||
431 | // ===================================================================================== | ||
432 | // btDynamicsWorld entries | ||
433 | public abstract bool AddObjectToWorld2(BulletWorld world, BulletBody obj); | ||
434 | |||
435 | public abstract bool RemoveObjectFromWorld2(BulletWorld world, BulletBody obj); | ||
436 | |||
437 | public abstract bool AddConstraintToWorld2(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects); | ||
438 | |||
439 | public abstract bool RemoveConstraintFromWorld2(BulletWorld world, BulletConstraint constrain); | ||
440 | // ===================================================================================== | ||
441 | // btCollisionObject entries | ||
442 | public abstract Vector3 GetAnisotripicFriction2(BulletConstraint constrain); | ||
443 | |||
444 | public abstract Vector3 SetAnisotripicFriction2(BulletConstraint constrain, Vector3 frict); | ||
445 | |||
446 | public abstract bool HasAnisotripicFriction2(BulletConstraint constrain); | ||
447 | |||
448 | public abstract void SetContactProcessingThreshold2(BulletBody obj, float val); | ||
449 | |||
450 | public abstract float GetContactProcessingThreshold2(BulletBody obj); | ||
451 | |||
452 | public abstract bool IsStaticObject2(BulletBody obj); | ||
453 | |||
454 | public abstract bool IsKinematicObject2(BulletBody obj); | ||
455 | |||
456 | public abstract bool IsStaticOrKinematicObject2(BulletBody obj); | ||
457 | |||
458 | public abstract bool HasContactResponse2(BulletBody obj); | ||
459 | |||
460 | public abstract void SetCollisionShape2(BulletWorld sim, BulletBody obj, BulletBody shape); | ||
461 | |||
462 | public abstract BulletShape GetCollisionShape2(BulletBody obj); | ||
463 | |||
464 | public abstract int GetActivationState2(BulletBody obj); | ||
465 | |||
466 | public abstract void SetActivationState2(BulletBody obj, int state); | ||
467 | |||
468 | public abstract void SetDeactivationTime2(BulletBody obj, float dtime); | ||
469 | |||
470 | public abstract float GetDeactivationTime2(BulletBody obj); | ||
471 | |||
472 | public abstract void ForceActivationState2(BulletBody obj, ActivationState state); | ||
473 | |||
474 | public abstract void Activate2(BulletBody obj, bool forceActivation); | ||
475 | |||
476 | public abstract bool IsActive2(BulletBody obj); | ||
477 | |||
478 | public abstract void SetRestitution2(BulletBody obj, float val); | ||
479 | |||
480 | public abstract float GetRestitution2(BulletBody obj); | ||
481 | |||
482 | public abstract void SetFriction2(BulletBody obj, float val); | ||
483 | |||
484 | public abstract float GetFriction2(BulletBody obj); | ||
485 | |||
486 | /* Haven't defined the type 'Transform' | ||
487 | public abstract Transform GetWorldTransform2(BulletBody obj); | ||
488 | |||
489 | public abstract void setWorldTransform2(BulletBody obj, Transform trans); | ||
490 | */ | ||
491 | |||
492 | public abstract Vector3 GetPosition2(BulletBody obj); | ||
493 | |||
494 | public abstract Quaternion GetOrientation2(BulletBody obj); | ||
495 | |||
496 | public abstract void SetTranslation2(BulletBody obj, Vector3 position, Quaternion rotation); | ||
497 | |||
498 | public abstract IntPtr GetBroadphaseHandle2(BulletBody obj); | ||
499 | |||
500 | public abstract void SetBroadphaseHandle2(BulletBody obj, IntPtr handle); | ||
501 | |||
502 | /* | ||
503 | public abstract Transform GetInterpolationWorldTransform2(IntPtr obj); | ||
504 | |||
505 | public abstract void SetInterpolationWorldTransform2(IntPtr obj, Transform trans); | ||
506 | */ | ||
507 | |||
508 | public abstract void SetInterpolationLinearVelocity2(BulletBody obj, Vector3 vel); | ||
509 | |||
510 | public abstract void SetInterpolationAngularVelocity2(BulletBody obj, Vector3 vel); | ||
511 | |||
512 | public abstract void SetInterpolationVelocity2(BulletBody obj, Vector3 linearVel, Vector3 angularVel); | ||
513 | |||
514 | public abstract float GetHitFraction2(BulletBody obj); | ||
515 | |||
516 | public abstract void SetHitFraction2(BulletBody obj, float val); | ||
517 | |||
518 | public abstract CollisionFlags GetCollisionFlags2(BulletBody obj); | ||
519 | |||
520 | public abstract CollisionFlags SetCollisionFlags2(BulletBody obj, CollisionFlags flags); | ||
521 | |||
522 | public abstract CollisionFlags AddToCollisionFlags2(BulletBody obj, CollisionFlags flags); | ||
523 | |||
524 | public abstract CollisionFlags RemoveFromCollisionFlags2(BulletBody obj, CollisionFlags flags); | ||
525 | |||
526 | public abstract float GetCcdMotionThreshold2(BulletBody obj); | ||
527 | |||
528 | public abstract void SetCcdMotionThreshold2(BulletBody obj, float val); | ||
529 | |||
530 | public abstract float GetCcdSweptSphereRadius2(BulletBody obj); | ||
531 | |||
532 | public abstract void SetCcdSweptSphereRadius2(BulletBody obj, float val); | ||
533 | |||
534 | public abstract IntPtr GetUserPointer2(BulletBody obj); | ||
535 | |||
536 | public abstract void SetUserPointer2(BulletBody obj, IntPtr val); | ||
537 | |||
538 | // ===================================================================================== | ||
539 | // btRigidBody entries | ||
540 | public abstract void ApplyGravity2(BulletBody obj); | ||
541 | |||
542 | public abstract void SetGravity2(BulletBody obj, Vector3 val); | ||
543 | |||
544 | public abstract Vector3 GetGravity2(BulletBody obj); | ||
545 | |||
546 | public abstract void SetDamping2(BulletBody obj, float lin_damping, float ang_damping); | ||
547 | |||
548 | public abstract void SetLinearDamping2(BulletBody obj, float lin_damping); | ||
549 | |||
550 | public abstract void SetAngularDamping2(BulletBody obj, float ang_damping); | ||
551 | |||
552 | public abstract float GetLinearDamping2(BulletBody obj); | ||
553 | 335 | ||
554 | public abstract float GetAngularDamping2(BulletBody obj); | 336 | public abstract BulletShape CreateCompoundShape(BulletWorld sim, bool enableDynamicAabbTree); |
555 | 337 | ||
556 | public abstract float GetLinearSleepingThreshold2(BulletBody obj); | 338 | public abstract int GetNumberOfCompoundChildren(BulletShape cShape); |
557 | 339 | ||
340 | public abstract void AddChildShapeToCompoundShape(BulletShape cShape, BulletShape addShape, Vector3 pos, Quaternion rot); | ||
558 | 341 | ||
559 | public abstract void ApplyDamping2(BulletBody obj, float timeStep); | 342 | public abstract BulletShape GetChildShapeFromCompoundShapeIndex(BulletShape cShape, int indx); |
560 | 343 | ||
561 | public abstract void SetMassProps2(BulletBody obj, float mass, Vector3 inertia); | 344 | public abstract BulletShape RemoveChildShapeFromCompoundShapeIndex(BulletShape cShape, int indx); |
562 | 345 | ||
563 | public abstract Vector3 GetLinearFactor2(BulletBody obj); | 346 | public abstract void RemoveChildShapeFromCompoundShape(BulletShape cShape, BulletShape removeShape); |
564 | 347 | ||
565 | public abstract void SetLinearFactor2(BulletBody obj, Vector3 factor); | 348 | public abstract void RecalculateCompoundShapeLocalAabb(BulletShape cShape); |
566 | 349 | ||
567 | /* | 350 | public abstract BulletShape DuplicateCollisionShape(BulletWorld sim, BulletShape srcShape, uint id); |
568 | public abstract void SetCenterOfMassTransform2(BulletBody obj, Transform trans); | ||
569 | */ | ||
570 | |||
571 | public abstract void SetCenterOfMassByPosRot2(BulletBody obj, Vector3 pos, Quaternion rot); | ||
572 | |||
573 | // Add a force to the object as if its mass is one. | ||
574 | public abstract void ApplyCentralForce2(BulletBody obj, Vector3 force); | ||
575 | |||
576 | // Set the force being applied to the object as if its mass is one. | ||
577 | public abstract void SetObjectForce2(BulletBody obj, Vector3 force); | ||
578 | |||
579 | public abstract Vector3 GetTotalForce2(BulletBody obj); | ||
580 | 351 | ||
581 | public abstract Vector3 GetTotalTorque2(BulletBody obj); | 352 | public abstract BulletBody CreateBodyFromShapeAndInfo(BulletWorld sim, BulletShape shape, uint id, IntPtr constructionInfo); |
582 | 353 | ||
583 | public abstract Vector3 GetInvInertiaDiagLocal2(BulletBody obj); | 354 | public abstract bool DeleteCollisionShape(BulletWorld world, BulletShape shape); |
584 | 355 | ||
585 | public abstract void SetInvInertiaDiagLocal2(BulletBody obj, Vector3 inert); | 356 | public abstract int GetBodyType(BulletBody obj); |
586 | 357 | ||
587 | public abstract void SetSleepingThresholds2(BulletBody obj, float lin_threshold, float ang_threshold); | 358 | public abstract BulletBody CreateBodyFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot); |
588 | 359 | ||
589 | public abstract void ApplyTorque2(BulletBody obj, Vector3 torque); | 360 | public 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. | ||
592 | public 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. | ||
595 | public abstract void ApplyCentralImpulse2(BulletBody obj, Vector3 imp); | ||
596 | |||
597 | // Apply impulse to the object's torque. Force is scaled by object's mass. | ||
598 | public 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. | ||
601 | public abstract void ApplyImpulse2(BulletBody obj, Vector3 imp, Vector3 pos); | ||
602 | 361 | ||
603 | public abstract void ClearForces2(BulletBody obj); | 362 | public abstract BulletBody CreateGhostFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot); |
604 | 363 | ||
605 | public abstract void ClearAllForces2(BulletBody obj); | 364 | public abstract IntPtr AllocateBodyInfo(BulletBody obj); |
606 | 365 | ||
607 | public abstract void UpdateInertiaTensor2(BulletBody obj); | 366 | public abstract void ReleaseBodyInfo(IntPtr obj); |
608 | 367 | ||
368 | public abstract void DestroyObject(BulletWorld sim, BulletBody obj); | ||
609 | 369 | ||
610 | /* | 370 | /* |
611 | public abstract Transform GetCenterOfMassTransform2(BulletBody obj); | ||
612 | */ | ||
613 | |||
614 | public abstract Vector3 GetLinearVelocity2(BulletBody obj); | ||
615 | |||
616 | public abstract Vector3 GetAngularVelocity2(BulletBody obj); | ||
617 | |||
618 | public abstract void SetLinearVelocity2(BulletBody obj, Vector3 val); | ||
619 | |||
620 | public abstract void SetAngularVelocity2(BulletBody obj, Vector3 angularVelocity); | ||
621 | |||
622 | public abstract Vector3 GetVelocityInLocalPoint2(BulletBody obj, Vector3 pos); | ||
623 | |||
624 | public abstract void Translate2(BulletBody obj, Vector3 trans); | ||
625 | |||
626 | public abstract void UpdateDeactivation2(BulletBody obj, float timeStep); | ||
627 | |||
628 | public abstract bool WantsSleeping2(BulletBody obj); | ||
629 | |||
630 | public abstract void SetAngularFactor2(BulletBody obj, float factor); | ||
631 | |||
632 | public abstract void SetAngularFactorV2(BulletBody obj, Vector3 factor); | ||
633 | |||
634 | public abstract Vector3 GetAngularFactor2(BulletBody obj); | ||
635 | |||
636 | public abstract bool IsInWorld2(BulletBody obj); | ||
637 | |||
638 | public abstract void AddConstraintRef2(BulletBody obj, BulletConstraint constrain); | ||
639 | |||
640 | public abstract void RemoveConstraintRef2(BulletBody obj, BulletConstraint constrain); | ||
641 | |||
642 | public abstract BulletConstraint GetConstraintRef2(BulletBody obj, int index); | ||
643 | |||
644 | public abstract int GetNumConstraintRefs2(BulletBody obj); | ||
645 | |||
646 | public abstract bool SetCollisionGroupMask2(BulletBody body, uint filter, uint mask); | ||
647 | |||
648 | // ===================================================================================== | ||
649 | // btCollisionShape entries | ||
650 | |||
651 | public abstract float GetAngularMotionDisc2(BulletShape shape); | ||
652 | |||
653 | public abstract float GetContactBreakingThreshold2(BulletShape shape, float defaultFactor); | ||
654 | |||
655 | public abstract bool IsPolyhedral2(BulletShape shape); | ||
656 | |||
657 | public abstract bool IsConvex2d2(BulletShape shape); | ||
658 | |||
659 | public abstract bool IsConvex2(BulletShape shape); | ||
660 | |||
661 | public abstract bool IsNonMoving2(BulletShape shape); | ||
662 | |||
663 | public abstract bool IsConcave2(BulletShape shape); | ||
664 | |||
665 | public abstract bool IsCompound2(BulletShape shape); | ||
666 | |||
667 | public abstract bool IsSoftBody2(BulletShape shape); | ||
668 | |||
669 | public abstract bool IsInfinite2(BulletShape shape); | ||
670 | |||
671 | public abstract void SetLocalScaling2(BulletShape shape, Vector3 scale); | ||
672 | |||
673 | public abstract Vector3 GetLocalScaling2(BulletShape shape); | ||
674 | |||
675 | public abstract Vector3 CalculateLocalInertia2(BulletShape shape, float mass); | ||
676 | |||
677 | public abstract int GetShapeType2(BulletShape shape); | ||
678 | |||
679 | public abstract void SetMargin2(BulletShape shape, float val); | ||
680 | |||
681 | public abstract float GetMargin2(BulletShape shape); | ||
682 | |||
683 | }; | ||
684 | |||
685 | // =============================================================================== | ||
686 | static class BulletSimAPI { | ||
687 | // =============================================================================== | ||
688 | // Link back to the managed code for outputting log messages | ||
689 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
690 | public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg); | ||
691 | |||
692 | // =============================================================================== | ||
693 | // Initialization and simulation | ||
694 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
695 | public 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] | ||
701 | public static extern bool UpdateParameter2(IntPtr world, uint localID, String parm, float value); | ||
702 | |||
703 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
704 | public static extern void SetHeightMap2(IntPtr world, float[] heightmap); | ||
705 | |||
706 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
707 | public static extern void Shutdown2(IntPtr sim); | ||
708 | |||
709 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
710 | public 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] | ||
717 | public static extern bool PushUpdate2(IntPtr obj); | ||
718 | |||
719 | // ===================================================================================== | ||
720 | // Mesh, hull, shape and body creation helper routines | ||
721 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
722 | public 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] | ||
727 | public static extern IntPtr CreateHullShape2(IntPtr world, | ||
728 | int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls); | ||
729 | |||
730 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
731 | public static extern IntPtr BuildHullShapeFromMesh2(IntPtr world, IntPtr meshShape); | ||
732 | |||
733 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
734 | public static extern IntPtr BuildNativeShape2(IntPtr world, ShapeData shapeData); | ||
735 | |||
736 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
737 | public static extern bool IsNativeShape2(IntPtr shape); | ||
738 | |||
739 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
740 | public static extern void SetShapeCollisionMargin(IntPtr shape, float margin); | ||
741 | |||
742 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
743 | public static extern IntPtr BuildCapsuleShape2(IntPtr world, float radius, float height, Vector3 scale); | ||
744 | |||
745 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
746 | public static extern IntPtr CreateCompoundShape2(IntPtr sim, bool enableDynamicAabbTree); | ||
747 | |||
748 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
749 | public static extern int GetNumberOfCompoundChildren2(IntPtr cShape); | ||
750 | |||
751 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
752 | public static extern void AddChildShapeToCompoundShape2(IntPtr cShape, IntPtr addShape, Vector3 pos, Quaternion rot); | ||
753 | |||
754 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
755 | public static extern IntPtr GetChildShapeFromCompoundShapeIndex2(IntPtr cShape, int indx); | ||
756 | |||
757 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
758 | public static extern IntPtr RemoveChildShapeFromCompoundShapeIndex2(IntPtr cShape, int indx); | ||
759 | |||
760 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
761 | public static extern void RemoveChildShapeFromCompoundShape2(IntPtr cShape, IntPtr removeShape); | ||
762 | |||
763 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
764 | public static extern void RecalculateCompoundShapeLocalAabb2(IntPtr cShape); | ||
765 | |||
766 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
767 | public static extern IntPtr DuplicateCollisionShape2(IntPtr sim, IntPtr srcShape, uint id); | ||
768 | |||
769 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
770 | public static extern IntPtr CreateBodyFromShapeAndInfo2(IntPtr sim, IntPtr shape, uint id, IntPtr constructionInfo); | ||
771 | |||
772 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
773 | public static extern bool DeleteCollisionShape2(IntPtr world, IntPtr shape); | ||
774 | |||
775 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
776 | public static extern int GetBodyType2(IntPtr obj); | ||
777 | |||
778 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
779 | public static extern IntPtr CreateBodyFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot); | ||
780 | |||
781 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
782 | public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, uint id, Vector3 pos, Quaternion rot); | ||
783 | |||
784 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
785 | public static extern IntPtr CreateGhostFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot); | ||
786 | |||
787 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
788 | public static extern IntPtr AllocateBodyInfo2(IntPtr obj); | ||
789 | |||
790 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
791 | public static extern void ReleaseBodyInfo2(IntPtr obj); | ||
792 | |||
793 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
794 | public 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] | 373 | public abstract IntPtr CreateHeightMapInfo(BulletWorld sim, uint id, Vector3 minCoords, Vector3 maxCoords, |
799 | public 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] | 376 | public abstract IntPtr FillHeightMapInfo(BulletWorld sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords, |
803 | public 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] | 379 | public abstract bool ReleaseHeightMapInfo(IntPtr heightMapInfo); |
807 | public static extern bool ReleaseHeightMapInfo2(IntPtr heightMapInfo); | ||
808 | 380 | ||
809 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 381 | public abstract BulletBody CreateGroundPlaneShape(uint id, float height, float collisionMargin); |
810 | public static extern IntPtr CreateGroundPlaneShape2(uint id, float height, float collisionMargin); | ||
811 | 382 | ||
812 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 383 | public abstract BulletBody CreateTerrainShape(IntPtr mapInfo); |
813 | public 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] | 387 | public abstract BulletConstraint Create6DofConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, |
818 | public 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] | 392 | public abstract BulletConstraint Create6DofConstraintToPoint(BulletWorld world, BulletBody obj1, BulletBody obj2, |
824 | public 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] | 396 | public abstract BulletConstraint CreateHingeConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, |
829 | public 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] | 401 | public abstract void SetConstraintEnable(BulletConstraint constrain, float numericTrueFalse); |
835 | public static extern void SetConstraintEnable2(IntPtr constrain, float numericTrueFalse); | ||
836 | 402 | ||
837 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 403 | public abstract void SetConstraintNumSolverIterations(BulletConstraint constrain, float iterations); |
838 | public static extern void SetConstraintNumSolverIterations2(IntPtr constrain, float iterations); | ||
839 | 404 | ||
840 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 405 | public abstract bool SetFrames(BulletConstraint constrain, |
841 | public 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] | 408 | public abstract bool SetLinearLimits(BulletConstraint constrain, Vector3 low, Vector3 hi); |
845 | public static extern bool SetLinearLimits2(IntPtr constrain, Vector3 low, Vector3 hi); | ||
846 | 409 | ||
847 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 410 | public abstract bool SetAngularLimits(BulletConstraint constrain, Vector3 low, Vector3 hi); |
848 | public static extern bool SetAngularLimits2(IntPtr constrain, Vector3 low, Vector3 hi); | ||
849 | 411 | ||
850 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 412 | public abstract bool UseFrameOffset(BulletConstraint constrain, float enable); |
851 | public static extern bool UseFrameOffset2(IntPtr constrain, float enable); | ||
852 | 413 | ||
853 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 414 | public abstract bool TranslationalLimitMotor(BulletConstraint constrain, float enable, float targetVel, float maxMotorForce); |
854 | public static extern bool TranslationalLimitMotor2(IntPtr constrain, float enable, float targetVel, float maxMotorForce); | ||
855 | 415 | ||
856 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 416 | public abstract bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold); |
857 | public static extern bool SetBreakingImpulseThreshold2(IntPtr constrain, float threshold); | ||
858 | 417 | ||
859 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 418 | public abstract bool CalculateTransforms(BulletConstraint constrain); |
860 | public static extern bool CalculateTransforms2(IntPtr constrain); | ||
861 | 419 | ||
862 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 420 | public abstract bool SetConstraintParam(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis); |
863 | public static extern bool SetConstraintParam2(IntPtr constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis); | ||
864 | 421 | ||
865 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 422 | public abstract bool DestroyConstraint(BulletWorld world, BulletConstraint constrain); |
866 | public 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] | 426 | public abstract void UpdateSingleAabb(BulletWorld world, BulletBody obj); |
871 | public static extern void UpdateSingleAabb2(IntPtr world, IntPtr obj); | ||
872 | 427 | ||
873 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 428 | public abstract void UpdateAabbs(BulletWorld world); |
874 | public static extern void UpdateAabbs2(IntPtr world); | ||
875 | 429 | ||
876 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 430 | public abstract bool GetForceUpdateAllAabbs(BulletWorld world); |
877 | public static extern bool GetForceUpdateAllAabbs2(IntPtr world); | ||
878 | 431 | ||
879 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 432 | public abstract void SetForceUpdateAllAabbs(BulletWorld world, bool force); |
880 | public 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] | 436 | public abstract bool AddObjectToWorld(BulletWorld world, BulletBody obj); |
885 | public static extern bool AddObjectToWorld2(IntPtr world, IntPtr obj); | ||
886 | 437 | ||
887 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 438 | public abstract bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj); |
888 | public static extern bool RemoveObjectFromWorld2(IntPtr world, IntPtr obj); | ||
889 | 439 | ||
890 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 440 | public abstract bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects); |
891 | public static extern bool AddConstraintToWorld2(IntPtr world, IntPtr constrain, bool disableCollisionsBetweenLinkedObjects); | ||
892 | 441 | ||
893 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 442 | public abstract bool RemoveConstraintFromWorld(BulletWorld world, BulletConstraint constrain); |
894 | public static extern bool RemoveConstraintFromWorld2(IntPtr world, IntPtr constrain); | ||
895 | // ===================================================================================== | 443 | // ===================================================================================== |
896 | // btCollisionObject entries | 444 | // btCollisionObject entries |
897 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 445 | public abstract Vector3 GetAnisotripicFriction(BulletConstraint constrain); |
898 | public static extern Vector3 GetAnisotripicFriction2(IntPtr constrain); | ||
899 | 446 | ||
900 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 447 | public abstract Vector3 SetAnisotripicFriction(BulletConstraint constrain, Vector3 frict); |
901 | public static extern Vector3 SetAnisotripicFriction2(IntPtr constrain, Vector3 frict); | ||
902 | 448 | ||
903 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 449 | public abstract bool HasAnisotripicFriction(BulletConstraint constrain); |
904 | public static extern bool HasAnisotripicFriction2(IntPtr constrain); | ||
905 | 450 | ||
906 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 451 | public abstract void SetContactProcessingThreshold(BulletBody obj, float val); |
907 | public static extern void SetContactProcessingThreshold2(IntPtr obj, float val); | ||
908 | 452 | ||
909 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 453 | public abstract float GetContactProcessingThreshold(BulletBody obj); |
910 | public static extern float GetContactProcessingThreshold2(IntPtr obj); | ||
911 | 454 | ||
912 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 455 | public abstract bool IsStaticObject(BulletBody obj); |
913 | public static extern bool IsStaticObject2(IntPtr obj); | ||
914 | 456 | ||
915 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 457 | public abstract bool IsKinematicObject(BulletBody obj); |
916 | public static extern bool IsKinematicObject2(IntPtr obj); | ||
917 | 458 | ||
918 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 459 | public abstract bool IsStaticOrKinematicObject(BulletBody obj); |
919 | public static extern bool IsStaticOrKinematicObject2(IntPtr obj); | ||
920 | 460 | ||
921 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 461 | public abstract bool HasContactResponse(BulletBody obj); |
922 | public static extern bool HasContactResponse2(IntPtr obj); | ||
923 | 462 | ||
924 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 463 | public abstract void SetCollisionShape(BulletWorld sim, BulletBody obj, BulletBody shape); |
925 | public static extern void SetCollisionShape2(IntPtr sim, IntPtr obj, IntPtr shape); | ||
926 | 464 | ||
927 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 465 | public abstract BulletShape GetCollisionShape(BulletBody obj); |
928 | public static extern IntPtr GetCollisionShape2(IntPtr obj); | ||
929 | 466 | ||
930 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 467 | public abstract int GetActivationState(BulletBody obj); |
931 | public static extern int GetActivationState2(IntPtr obj); | ||
932 | 468 | ||
933 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 469 | public abstract void SetActivationState(BulletBody obj, int state); |
934 | public static extern void SetActivationState2(IntPtr obj, int state); | ||
935 | 470 | ||
936 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 471 | public abstract void SetDeactivationTime(BulletBody obj, float dtime); |
937 | public static extern void SetDeactivationTime2(IntPtr obj, float dtime); | ||
938 | 472 | ||
939 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 473 | public abstract float GetDeactivationTime(BulletBody obj); |
940 | public static extern float GetDeactivationTime2(IntPtr obj); | ||
941 | 474 | ||
942 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 475 | public abstract void ForceActivationState(BulletBody obj, ActivationState state); |
943 | public static extern void ForceActivationState2(IntPtr obj, ActivationState state); | ||
944 | 476 | ||
945 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 477 | public abstract void Activate(BulletBody obj, bool forceActivation); |
946 | public static extern void Activate2(IntPtr obj, bool forceActivation); | ||
947 | 478 | ||
948 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 479 | public abstract bool IsActive(BulletBody obj); |
949 | public static extern bool IsActive2(IntPtr obj); | ||
950 | 480 | ||
951 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 481 | public abstract void SetRestitution(BulletBody obj, float val); |
952 | public static extern void SetRestitution2(IntPtr obj, float val); | ||
953 | 482 | ||
954 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 483 | public abstract float GetRestitution(BulletBody obj); |
955 | public static extern float GetRestitution2(IntPtr obj); | ||
956 | 484 | ||
957 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 485 | public abstract void SetFriction(BulletBody obj, float val); |
958 | public static extern void SetFriction2(IntPtr obj, float val); | ||
959 | 486 | ||
960 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 487 | public abstract float GetFriction(BulletBody obj); |
961 | public static extern float GetFriction2(IntPtr obj); | ||
962 | 488 | ||
963 | /* Haven't defined the type 'Transform' | 489 | public abstract Vector3 GetPosition(BulletBody obj); |
964 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
965 | public static extern Transform GetWorldTransform2(IntPtr obj); | ||
966 | 490 | ||
967 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 491 | public abstract Quaternion GetOrientation(BulletBody obj); |
968 | public static extern void setWorldTransform2(IntPtr obj, Transform trans); | ||
969 | */ | ||
970 | 492 | ||
971 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 493 | public abstract void SetTranslation(BulletBody obj, Vector3 position, Quaternion rotation); |
972 | public static extern Vector3 GetPosition2(IntPtr obj); | ||
973 | 494 | ||
974 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 495 | public abstract IntPtr GetBroadphaseHandle(BulletBody obj); |
975 | public static extern Quaternion GetOrientation2(IntPtr obj); | ||
976 | 496 | ||
977 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 497 | public abstract void SetBroadphaseHandle(BulletBody obj, IntPtr handle); |
978 | public static extern void SetTranslation2(IntPtr obj, Vector3 position, Quaternion rotation); | ||
979 | 498 | ||
980 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 499 | public abstract void SetInterpolationLinearVelocity(BulletBody obj, Vector3 vel); |
981 | public static extern IntPtr GetBroadphaseHandle2(IntPtr obj); | ||
982 | 500 | ||
983 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 501 | public abstract void SetInterpolationAngularVelocity(BulletBody obj, Vector3 vel); |
984 | public static extern void SetBroadphaseHandle2(IntPtr obj, IntPtr handle); | ||
985 | 502 | ||
986 | /* | 503 | public abstract void SetInterpolationVelocity(BulletBody obj, Vector3 linearVel, Vector3 angularVel); |
987 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
988 | public static extern Transform GetInterpolationWorldTransform2(IntPtr obj); | ||
989 | 504 | ||
990 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 505 | public abstract float GetHitFraction(BulletBody obj); |
991 | public static extern void SetInterpolationWorldTransform2(IntPtr obj, Transform trans); | ||
992 | */ | ||
993 | |||
994 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
995 | public static extern void SetInterpolationLinearVelocity2(IntPtr obj, Vector3 vel); | ||
996 | |||
997 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
998 | public static extern void SetInterpolationAngularVelocity2(IntPtr obj, Vector3 vel); | ||
999 | |||
1000 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1001 | public static extern void SetInterpolationVelocity2(IntPtr obj, Vector3 linearVel, Vector3 angularVel); | ||
1002 | 506 | ||
1003 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 507 | public abstract void SetHitFraction(BulletBody obj, float val); |
1004 | public static extern float GetHitFraction2(IntPtr obj); | ||
1005 | 508 | ||
1006 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 509 | public abstract CollisionFlags GetCollisionFlags(BulletBody obj); |
1007 | public static extern void SetHitFraction2(IntPtr obj, float val); | ||
1008 | 510 | ||
1009 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 511 | public abstract CollisionFlags SetCollisionFlags(BulletBody obj, CollisionFlags flags); |
1010 | public static extern CollisionFlags GetCollisionFlags2(IntPtr obj); | ||
1011 | 512 | ||
1012 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 513 | public abstract CollisionFlags AddToCollisionFlags(BulletBody obj, CollisionFlags flags); |
1013 | public static extern CollisionFlags SetCollisionFlags2(IntPtr obj, CollisionFlags flags); | ||
1014 | 514 | ||
1015 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 515 | public abstract CollisionFlags RemoveFromCollisionFlags(BulletBody obj, CollisionFlags flags); |
1016 | public static extern CollisionFlags AddToCollisionFlags2(IntPtr obj, CollisionFlags flags); | ||
1017 | 516 | ||
1018 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 517 | public abstract float GetCcdMotionThreshold(BulletBody obj); |
1019 | public static extern CollisionFlags RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags); | ||
1020 | 518 | ||
1021 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 519 | public abstract void SetCcdMotionThreshold(BulletBody obj, float val); |
1022 | public static extern float GetCcdMotionThreshold2(IntPtr obj); | ||
1023 | 520 | ||
1024 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 521 | public abstract float GetCcdSweptSphereRadius(BulletBody obj); |
1025 | public static extern void SetCcdMotionThreshold2(IntPtr obj, float val); | ||
1026 | 522 | ||
1027 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 523 | public abstract void SetCcdSweptSphereRadius(BulletBody obj, float val); |
1028 | public static extern float GetCcdSweptSphereRadius2(IntPtr obj); | ||
1029 | 524 | ||
1030 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 525 | public abstract IntPtr GetUserPointer(BulletBody obj); |
1031 | public static extern void SetCcdSweptSphereRadius2(IntPtr obj, float val); | ||
1032 | 526 | ||
1033 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 527 | public abstract void SetUserPointer(BulletBody obj, IntPtr val); |
1034 | public static extern IntPtr GetUserPointer2(IntPtr obj); | ||
1035 | |||
1036 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1037 | public 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] | 531 | public abstract void ApplyGravity(BulletBody obj); |
1042 | public static extern void ApplyGravity2(IntPtr obj); | ||
1043 | |||
1044 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1045 | public static extern void SetGravity2(IntPtr obj, Vector3 val); | ||
1046 | 532 | ||
1047 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 533 | public abstract void SetGravity(BulletBody obj, Vector3 val); |
1048 | public static extern Vector3 GetGravity2(IntPtr obj); | ||
1049 | 534 | ||
1050 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 535 | public abstract Vector3 GetGravity(BulletBody obj); |
1051 | public static extern void SetDamping2(IntPtr obj, float lin_damping, float ang_damping); | ||
1052 | 536 | ||
1053 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 537 | public abstract void SetDamping(BulletBody obj, float lin_damping, float ang_damping); |
1054 | public static extern void SetLinearDamping2(IntPtr obj, float lin_damping); | ||
1055 | 538 | ||
1056 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 539 | public abstract void SetLinearDamping(BulletBody obj, float lin_damping); |
1057 | public static extern void SetAngularDamping2(IntPtr obj, float ang_damping); | ||
1058 | 540 | ||
1059 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 541 | public abstract void SetAngularDamping(BulletBody obj, float ang_damping); |
1060 | public static extern float GetLinearDamping2(IntPtr obj); | ||
1061 | 542 | ||
1062 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 543 | public abstract float GetLinearDamping(BulletBody obj); |
1063 | public static extern float GetAngularDamping2(IntPtr obj); | ||
1064 | 544 | ||
1065 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 545 | public abstract float GetAngularDamping(BulletBody obj); |
1066 | public static extern float GetLinearSleepingThreshold2(IntPtr obj); | ||
1067 | 546 | ||
1068 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 547 | public abstract float GetLinearSleepingThreshold(BulletBody obj); |
1069 | public static extern float GetAngularSleepingThreshold2(IntPtr obj); | ||
1070 | 548 | ||
1071 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1072 | public static extern void ApplyDamping2(IntPtr obj, float timeStep); | ||
1073 | 549 | ||
1074 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 550 | public abstract void ApplyDamping(BulletBody obj, float timeStep); |
1075 | public static extern void SetMassProps2(IntPtr obj, float mass, Vector3 inertia); | ||
1076 | 551 | ||
1077 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 552 | public abstract void SetMassProps(BulletBody obj, float mass, Vector3 inertia); |
1078 | public static extern Vector3 GetLinearFactor2(IntPtr obj); | ||
1079 | 553 | ||
1080 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 554 | public abstract Vector3 GetLinearFactor(BulletBody obj); |
1081 | public static extern void SetLinearFactor2(IntPtr obj, Vector3 factor); | ||
1082 | 555 | ||
1083 | /* | 556 | public abstract void SetLinearFactor(BulletBody obj, Vector3 factor); |
1084 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1085 | public static extern void SetCenterOfMassTransform2(IntPtr obj, Transform trans); | ||
1086 | */ | ||
1087 | 557 | ||
1088 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 558 | public abstract void SetCenterOfMassByPosRot(BulletBody obj, Vector3 pos, Quaternion rot); |
1089 | public 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] | 561 | public abstract void ApplyCentralForce(BulletBody obj, Vector3 force); |
1093 | public 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] | 564 | public abstract void SetObjectForce(BulletBody obj, Vector3 force); |
1097 | public static extern void SetObjectForce2(IntPtr obj, Vector3 force); | ||
1098 | 565 | ||
1099 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 566 | public abstract Vector3 GetTotalForce(BulletBody obj); |
1100 | public static extern Vector3 GetTotalForce2(IntPtr obj); | ||
1101 | 567 | ||
1102 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 568 | public abstract Vector3 GetTotalTorque(BulletBody obj); |
1103 | public static extern Vector3 GetTotalTorque2(IntPtr obj); | ||
1104 | 569 | ||
1105 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 570 | public abstract Vector3 GetInvInertiaDiagLocal(BulletBody obj); |
1106 | public static extern Vector3 GetInvInertiaDiagLocal2(IntPtr obj); | ||
1107 | 571 | ||
1108 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 572 | public abstract void SetInvInertiaDiagLocal(BulletBody obj, Vector3 inert); |
1109 | public static extern void SetInvInertiaDiagLocal2(IntPtr obj, Vector3 inert); | ||
1110 | 573 | ||
1111 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 574 | public abstract void SetSleepingThresholds(BulletBody obj, float lin_threshold, float ang_threshold); |
1112 | public static extern void SetSleepingThresholds2(IntPtr obj, float lin_threshold, float ang_threshold); | ||
1113 | 575 | ||
1114 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 576 | public abstract void ApplyTorque(BulletBody obj, Vector3 torque); |
1115 | public 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] | 579 | public abstract void ApplyForce(BulletBody obj, Vector3 force, Vector3 pos); |
1119 | public 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] | 582 | public abstract void ApplyCentralImpulse(BulletBody obj, Vector3 imp); |
1123 | public 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] | 585 | public abstract void ApplyTorqueImpulse(BulletBody obj, Vector3 imp); |
1127 | public 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] | 588 | public abstract void ApplyImpulse(BulletBody obj, Vector3 imp, Vector3 pos); |
1131 | public static extern void ApplyImpulse2(IntPtr obj, Vector3 imp, Vector3 pos); | ||
1132 | |||
1133 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1134 | public static extern void ClearForces2(IntPtr obj); | ||
1135 | 589 | ||
1136 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 590 | public abstract void ClearForces(BulletBody obj); |
1137 | public static extern void ClearAllForces2(IntPtr obj); | ||
1138 | 591 | ||
1139 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 592 | public abstract void ClearAllForces(BulletBody obj); |
1140 | public static extern void UpdateInertiaTensor2(IntPtr obj); | ||
1141 | 593 | ||
1142 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 594 | public abstract void UpdateInertiaTensor(BulletBody obj); |
1143 | public static extern Vector3 GetCenterOfMassPosition2(IntPtr obj); | ||
1144 | |||
1145 | /* | ||
1146 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1147 | public static extern Transform GetCenterOfMassTransform2(IntPtr obj); | ||
1148 | */ | ||
1149 | 595 | ||
1150 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 596 | public abstract Vector3 GetLinearVelocity(BulletBody obj); |
1151 | public static extern Vector3 GetLinearVelocity2(IntPtr obj); | ||
1152 | 597 | ||
1153 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 598 | public abstract Vector3 GetAngularVelocity(BulletBody obj); |
1154 | public static extern Vector3 GetAngularVelocity2(IntPtr obj); | ||
1155 | 599 | ||
1156 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 600 | public abstract void SetLinearVelocity(BulletBody obj, Vector3 val); |
1157 | public static extern void SetLinearVelocity2(IntPtr obj, Vector3 val); | ||
1158 | 601 | ||
1159 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 602 | public abstract void SetAngularVelocity(BulletBody obj, Vector3 angularVelocity); |
1160 | public static extern void SetAngularVelocity2(IntPtr obj, Vector3 angularVelocity); | ||
1161 | 603 | ||
1162 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 604 | public abstract Vector3 GetVelocityInLocalPoint(BulletBody obj, Vector3 pos); |
1163 | public static extern Vector3 GetVelocityInLocalPoint2(IntPtr obj, Vector3 pos); | ||
1164 | 605 | ||
1165 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 606 | public abstract void Translate(BulletBody obj, Vector3 trans); |
1166 | public static extern void Translate2(IntPtr obj, Vector3 trans); | ||
1167 | 607 | ||
1168 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 608 | public abstract void UpdateDeactivation(BulletBody obj, float timeStep); |
1169 | public static extern void UpdateDeactivation2(IntPtr obj, float timeStep); | ||
1170 | 609 | ||
1171 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 610 | public abstract bool WantsSleeping(BulletBody obj); |
1172 | public static extern bool WantsSleeping2(IntPtr obj); | ||
1173 | 611 | ||
1174 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 612 | public abstract void SetAngularFactor(BulletBody obj, float factor); |
1175 | public static extern void SetAngularFactor2(IntPtr obj, float factor); | ||
1176 | 613 | ||
1177 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 614 | public abstract void SetAngularFactorV(BulletBody obj, Vector3 factor); |
1178 | public static extern void SetAngularFactorV2(IntPtr obj, Vector3 factor); | ||
1179 | 615 | ||
1180 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 616 | public abstract Vector3 GetAngularFactor(BulletBody obj); |
1181 | public static extern Vector3 GetAngularFactor2(IntPtr obj); | ||
1182 | 617 | ||
1183 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 618 | public abstract bool IsInWorld(BulletBody obj); |
1184 | public static extern bool IsInWorld2(IntPtr obj); | ||
1185 | 619 | ||
1186 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 620 | public abstract void AddConstraintRef(BulletBody obj, BulletConstraint constrain); |
1187 | public static extern void AddConstraintRef2(IntPtr obj, IntPtr constrain); | ||
1188 | 621 | ||
1189 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 622 | public abstract void RemoveConstraintRef(BulletBody obj, BulletConstraint constrain); |
1190 | public static extern void RemoveConstraintRef2(IntPtr obj, IntPtr constrain); | ||
1191 | 623 | ||
1192 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 624 | public abstract BulletConstraint GetConstraintRef(BulletBody obj, int index); |
1193 | public static extern IntPtr GetConstraintRef2(IntPtr obj, int index); | ||
1194 | 625 | ||
1195 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 626 | public abstract int GetNumConstraintRefs(BulletBody obj); |
1196 | public static extern int GetNumConstraintRefs2(IntPtr obj); | ||
1197 | 627 | ||
1198 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 628 | public abstract bool SetCollisionGroupMask(BulletBody body, uint filter, uint mask); |
1199 | public 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] | 633 | public abstract float GetAngularMotionDisc(BulletShape shape); |
1205 | public static extern float GetAngularMotionDisc2(IntPtr shape); | ||
1206 | |||
1207 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1208 | public static extern float GetContactBreakingThreshold2(IntPtr shape, float defaultFactor); | ||
1209 | 634 | ||
1210 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 635 | public abstract float GetContactBreakingThreshold(BulletShape shape, float defaultFactor); |
1211 | public static extern bool IsPolyhedral2(IntPtr shape); | ||
1212 | 636 | ||
1213 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 637 | public abstract bool IsPolyhedral(BulletShape shape); |
1214 | public static extern bool IsConvex2d2(IntPtr shape); | ||
1215 | 638 | ||
1216 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 639 | public abstract bool IsConvex2d(BulletShape shape); |
1217 | public static extern bool IsConvex2(IntPtr shape); | ||
1218 | 640 | ||
1219 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 641 | public abstract bool IsConvex(BulletShape shape); |
1220 | public static extern bool IsNonMoving2(IntPtr shape); | ||
1221 | 642 | ||
1222 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 643 | public abstract bool IsNonMoving(BulletShape shape); |
1223 | public static extern bool IsConcave2(IntPtr shape); | ||
1224 | 644 | ||
1225 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 645 | public abstract bool IsConcave(BulletShape shape); |
1226 | public static extern bool IsCompound2(IntPtr shape); | ||
1227 | 646 | ||
1228 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 647 | public abstract bool IsCompound(BulletShape shape); |
1229 | public static extern bool IsSoftBody2(IntPtr shape); | ||
1230 | 648 | ||
1231 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 649 | public abstract bool IsSoftBody(BulletShape shape); |
1232 | public static extern bool IsInfinite2(IntPtr shape); | ||
1233 | 650 | ||
1234 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 651 | public abstract bool IsInfinite(BulletShape shape); |
1235 | public static extern void SetLocalScaling2(IntPtr shape, Vector3 scale); | ||
1236 | 652 | ||
1237 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 653 | public abstract void SetLocalScaling(BulletShape shape, Vector3 scale); |
1238 | public static extern Vector3 GetLocalScaling2(IntPtr shape); | ||
1239 | 654 | ||
1240 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 655 | public abstract Vector3 GetLocalScaling(BulletShape shape); |
1241 | public static extern Vector3 CalculateLocalInertia2(IntPtr shape, float mass); | ||
1242 | 656 | ||
1243 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 657 | public abstract Vector3 CalculateLocalInertia(BulletShape shape, float mass); |
1244 | public static extern int GetShapeType2(IntPtr shape); | ||
1245 | 658 | ||
1246 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 659 | public abstract int GetShapeType(BulletShape shape); |
1247 | public static extern void SetMargin2(IntPtr shape, float val); | ||
1248 | 660 | ||
1249 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 661 | public abstract void SetMargin(BulletShape shape, float val); |
1250 | public static extern float GetMargin2(IntPtr shape); | ||
1251 | |||
1252 | // ===================================================================================== | ||
1253 | // Debugging | ||
1254 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1255 | public static extern void DumpRigidBody2(IntPtr sim, IntPtr collisionObject); | ||
1256 | 662 | ||
1257 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 663 | public abstract float GetMargin(BulletShape shape); |
1258 | public static extern void DumpCollisionShape2(IntPtr sim, IntPtr collisionShape); | 664 | */ |
1259 | 665 | ||
1260 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 666 | }; |
1261 | public static extern void DumpMapInfo2(IntPtr sim, IntPtr manInfo); | ||
1262 | |||
1263 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1264 | public static extern void DumpConstraint2(IntPtr sim, IntPtr constrain); | ||
1265 | |||
1266 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1267 | public static extern void DumpActivationInfo2(IntPtr sim); | ||
1268 | |||
1269 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1270 | public static extern void DumpAllInfo2(IntPtr sim); | ||
1271 | |||
1272 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1273 | public 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 | ||
32 | VEHICLES TODO LIST: | 32 | VEHICLES TODO LIST: |
33 | ================================================= | 33 | ================================================= |
34 | Angular motor direction is global coordinates rather than local coordinates | ||
34 | Border crossing with linked vehicle causes crash | 35 | Border crossing with linked vehicle causes crash |
35 | Vehicles (Move smoothly) | 36 | Vehicles (Move smoothly) |
36 | Add vehicle collisions so IsColliding is properly reported. | 37 | Add 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. |
82 | Add PID motor for avatar movement (slow to stop, ...) | 83 | Add PID motor for avatar movement (slow to stop, ...) |
83 | setForce should set a constant force. Different than AddImpulse. | 84 | setForce should set a constant force. Different than AddImpulse. |
84 | Implement raycast. | 85 | Implement raycast. |
@@ -100,9 +101,13 @@ More efficient memory usage when passing hull information from BSPrim to BulletS | |||
100 | Avatar movement motor check for zero or small movement. Somehow suppress small movements | 101 | Avatar 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. |
104 | Physical and phantom will drop through the terrain | ||
105 | |||
103 | 106 | ||
104 | LINKSETS | 107 | LINKSETS |
105 | ====================================================== | 108 | ====================================================== |
109 | Offset the center of the linkset to be the geometric center of all the prims | ||
110 | Not quite the same as the center-of-gravity | ||
106 | Linksets should allow collisions to individual children | 111 | Linksets 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 |
108 | LinksetCompound: when one of the children changes orientation (like tires | 113 | LinksetCompound: 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> |