aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs291
1 files changed, 191 insertions, 100 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
index 9221cdb..1125d7e 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
@@ -38,35 +38,112 @@ namespace OpenSim.Region.Physics.BulletSPlugin {
38// The physics engine controller class created at initialization 38// The physics engine controller class created at initialization
39public struct BulletSim 39public struct BulletSim
40{ 40{
41 public BulletSim(uint worldId, BSScene bss, IntPtr xx) { worldID = worldId; scene = bss; Ptr = xx; } 41 public BulletSim(uint worldId, BSScene bss, IntPtr xx)
42 {
43 ptr = xx;
44 worldID = worldId;
45 physicsScene = bss;
46 }
47 public IntPtr ptr;
42 public uint worldID; 48 public uint worldID;
43 // The scene is only in here so very low level routines have a handle to print debug/error messages 49 // The scene is only in here so very low level routines have a handle to print debug/error messages
44 public BSScene scene; 50 public BSScene physicsScene;
45 public IntPtr Ptr; 51}
52
53// An allocated Bullet btRigidBody
54public struct BulletBody
55{
56 public BulletBody(uint id, IntPtr xx)
57 {
58 ID = id;
59 ptr = xx;
60 collisionFilter = 0;
61 collisionMask = 0;
62 }
63 public IntPtr ptr;
64 public uint ID;
65 public CollisionFilterGroups collisionFilter;
66 public CollisionFilterGroups collisionMask;
67 public override string ToString()
68 {
69 StringBuilder buff = new StringBuilder();
70 buff.Append("<id=");
71 buff.Append(ID.ToString());
72 buff.Append(",p=");
73 buff.Append(ptr.ToString("X"));
74 if (collisionFilter != 0 && collisionMask != 0)
75 {
76 buff.Append(",f=");
77 buff.Append(collisionFilter.ToString("X"));
78 buff.Append(",m=");
79 buff.Append(collisionMask.ToString("X"));
80 }
81 buff.Append(">");
82 return buff.ToString();
83 }
46} 84}
47 85
48public struct BulletShape 86public struct BulletShape
49{ 87{
50 public BulletShape(IntPtr xx) { Ptr = xx; } 88 public BulletShape(IntPtr xx)
51 public IntPtr Ptr; 89 {
90 ptr = xx;
91 type=ShapeData.PhysicsShapeType.SHAPE_UNKNOWN;
92 shapeKey = 0;
93 isNativeShape = false;
94 }
95 public BulletShape(IntPtr xx, ShapeData.PhysicsShapeType typ)
96 {
97 ptr = xx;
98 type = typ;
99 shapeKey = 0;
100 isNativeShape = false;
101 }
102 public IntPtr ptr;
103 public ShapeData.PhysicsShapeType type;
104 public ulong shapeKey;
105 public bool isNativeShape;
106 // Hulls have an underlying mesh. A pointer to it is hidden here.
107 public override string ToString()
108 {
109 StringBuilder buff = new StringBuilder();
110 buff.Append("<p=");
111 buff.Append(ptr.ToString("X"));
112 buff.Append(",s=");
113 buff.Append(type.ToString());
114 buff.Append(",k=");
115 buff.Append(shapeKey.ToString("X"));
116 buff.Append(",n=");
117 buff.Append(isNativeShape.ToString());
118 buff.Append(">");
119 return buff.ToString();
120 }
52} 121}
53 122
54// An allocated Bullet btRigidBody 123 // Constraint type values as defined by Bullet
55public struct BulletBody 124public enum ConstraintType : int
56{ 125{
57 public BulletBody(uint id, IntPtr xx) { ID = id; Ptr = xx; } 126 POINT2POINT_CONSTRAINT_TYPE = 3,
58 public IntPtr Ptr; 127 HINGE_CONSTRAINT_TYPE,
59 public uint ID; 128 CONETWIST_CONSTRAINT_TYPE,
129 D6_CONSTRAINT_TYPE,
130 SLIDER_CONSTRAINT_TYPE,
131 CONTACT_CONSTRAINT_TYPE,
132 D6_SPRING_CONSTRAINT_TYPE,
133 MAX_CONSTRAINT_TYPE
60} 134}
61 135
62// An allocated Bullet btConstraint 136// An allocated Bullet btConstraint
63public struct BulletConstraint 137public struct BulletConstraint
64{ 138{
65 public BulletConstraint(IntPtr xx) { Ptr = xx; } 139 public BulletConstraint(IntPtr xx)
66 public IntPtr Ptr; 140 {
141 ptr = xx;
142 }
143 public IntPtr ptr;
67} 144}
68 145
69// An allocated HeightMapThing which hold various heightmap info 146// An allocated HeightMapThing which holds various heightmap info.
70// Made a class rather than a struct so there would be only one 147// Made a class rather than a struct so there would be only one
71// instance of this and C# will pass around pointers rather 148// instance of this and C# will pass around pointers rather
72// than making copies. 149// than making copies.
@@ -96,14 +173,14 @@ public class BulletHeightMapInfo
96 173
97// =============================================================================== 174// ===============================================================================
98[StructLayout(LayoutKind.Sequential)] 175[StructLayout(LayoutKind.Sequential)]
99public struct ConvexHull 176public struct ConvexHull
100{ 177{
101 Vector3 Offset; 178 Vector3 Offset;
102 int VertexCount; 179 int VertexCount;
103 Vector3[] Vertices; 180 Vector3[] Vertices;
104} 181}
105[StructLayout(LayoutKind.Sequential)] 182[StructLayout(LayoutKind.Sequential)]
106public struct ShapeData 183public struct ShapeData
107{ 184{
108 public enum PhysicsShapeType 185 public enum PhysicsShapeType
109 { 186 {
@@ -114,7 +191,9 @@ public struct ShapeData
114 SHAPE_CYLINDER = 4, 191 SHAPE_CYLINDER = 4,
115 SHAPE_SPHERE = 5, 192 SHAPE_SPHERE = 5,
116 SHAPE_MESH = 6, 193 SHAPE_MESH = 6,
117 SHAPE_HULL = 7 194 SHAPE_HULL = 7,
195 SHAPE_GROUNDPLANE = 8,
196 SHAPE_TERRAIN = 9,
118 }; 197 };
119 public uint ID; 198 public uint ID;
120 public PhysicsShapeType Type; 199 public PhysicsShapeType Type;
@@ -130,13 +209,24 @@ public struct ShapeData
130 public float Restitution; 209 public float Restitution;
131 public float Collidable; // true of things bump into this 210 public float Collidable; // true of things bump into this
132 public float Static; // true if a static object. Otherwise gravity, etc. 211 public float Static; // true if a static object. Otherwise gravity, etc.
212 public float Solid; // true if object cannot be passed through
213 public Vector3 Size;
133 214
134 // note that bools are passed as floats since bool size changes by language and architecture 215 // note that bools are passed as floats since bool size changes by language and architecture
135 public const float numericTrue = 1f; 216 public const float numericTrue = 1f;
136 public const float numericFalse = 0f; 217 public const float numericFalse = 0f;
218
219 // The native shapes have predefined shape hash keys
220 public enum FixedShapeKey : ulong
221 {
222 KEY_BOX = 1,
223 KEY_SPHERE = 2,
224 KEY_CONE = 3,
225 KEY_CYLINDER = 4,
226 }
137} 227}
138[StructLayout(LayoutKind.Sequential)] 228[StructLayout(LayoutKind.Sequential)]
139public struct SweepHit 229public struct SweepHit
140{ 230{
141 public uint ID; 231 public uint ID;
142 public float Fraction; 232 public float Fraction;
@@ -227,7 +317,17 @@ public enum ActivationState : uint
227 ISLAND_SLEEPING, 317 ISLAND_SLEEPING,
228 WANTS_DEACTIVATION, 318 WANTS_DEACTIVATION,
229 DISABLE_DEACTIVATION, 319 DISABLE_DEACTIVATION,
230 DISABLE_SIMULATION 320 DISABLE_SIMULATION,
321}
322
323public enum CollisionObjectTypes : int
324{
325 CO_COLLISION_OBJECT = 1 << 0,
326 CO_RIGID_BODY = 1 << 1,
327 CO_GHOST_OBJECT = 1 << 2,
328 CO_SOFT_BODY = 1 << 3,
329 CO_HF_FLUID = 1 << 4,
330 CO_USER_TYPE = 1 << 5,
231} 331}
232 332
233// Values used by Bullet and BulletSim to control object properties. 333// Values used by Bullet and BulletSim to control object properties.
@@ -244,77 +344,60 @@ public enum CollisionFlags : uint
244 CF_DISABLE_SPU_COLLISION_PROCESS = 1 << 6, 344 CF_DISABLE_SPU_COLLISION_PROCESS = 1 << 6,
245 // Following used by BulletSim to control collisions 345 // Following used by BulletSim to control collisions
246 BS_SUBSCRIBE_COLLISION_EVENTS = 1 << 10, 346 BS_SUBSCRIBE_COLLISION_EVENTS = 1 << 10,
247 BS_VOLUME_DETECT_OBJECT = 1 << 11, 347 // BS_VOLUME_DETECT_OBJECT = 1 << 11,
248 BS_PHANTOM_OBJECT = 1 << 12, 348 // BS_PHANTOM_OBJECT = 1 << 12,
249 BS_PHYSICAL_OBJECT = 1 << 13, 349 // BS_PHYSICAL_OBJECT = 1 << 13,
250 BS_TERRAIN_OBJECT = 1 << 14, 350 // BS_TERRAIN_OBJECT = 1 << 14,
251 BS_NONE = 0, 351 BS_NONE = 0,
252 BS_ALL = 0xFFFFFFFF 352 BS_ALL = 0xFFFFFFFF,
353
354 // These are the collision flags switched depending on physical state.
355 // The other flags are used for other things and should not be fooled with.
356 BS_ACTIVE = CF_STATIC_OBJECT
357 | CF_KINEMATIC_OBJECT
358 | CF_NO_CONTACT_RESPONSE
359 // | BS_VOLUME_DETECT_OBJECT
360 // | BS_PHANTOM_OBJECT
361 // | BS_PHYSICAL_OBJECT,
253}; 362};
254 363
255// Values for collisions groups and masks 364// Values for collisions groups and masks
256public enum CollisionFilterGroups : uint 365public enum CollisionFilterGroups : uint
257{ 366{
258 NoneFilter = 0, 367 // Don't use the bit definitions!! Define the use in a
259 DefaultFilter = 1 << 0, 368 // filter/mask definition below. This way collision interactions
260 StaticFilter = 1 << 1, 369 // are more easily debugged.
261 KinematicFilter = 1 << 2, 370 BNoneFilter = 0,
262 DebrisFilter = 1 << 3, 371 BDefaultFilter = 1 << 0,
263 SensorTrigger = 1 << 4, 372 BStaticFilter = 1 << 1,
264 CharacterFilter = 1 << 5, 373 BKinematicFilter = 1 << 2,
265 AllFilter = 0xFFFFFFFF, 374 BDebrisFilter = 1 << 3,
375 BSensorTrigger = 1 << 4,
376 BCharacterFilter = 1 << 5,
377 BAllFilter = 0xFFFFFFFF,
266 // Filter groups defined by BulletSim 378 // Filter groups defined by BulletSim
267 GroundPlaneFilter = 1 << 10, 379 BGroundPlaneFilter = 1 << 10,
268 TerrainFilter = 1 << 11, 380 BTerrainFilter = 1 << 11,
269 RaycastFilter = 1 << 12, 381 BRaycastFilter = 1 << 12,
270 SolidFilter = 1 << 13, 382 BSolidFilter = 1 << 13,
271}; 383
384 // The collsion filters and masked are defined in one place -- don't want them scattered
385 AvatarFilter = BCharacterFilter,
386 AvatarMask = BAllFilter,
387 ObjectFilter = BSolidFilter,
388 ObjectMask = BAllFilter,
389 StaticObjectFilter = BStaticFilter,
390 StaticObjectMask = BAllFilter,
391 VolumeDetectFilter = BSensorTrigger,
392 VolumeDetectMask = ~BSensorTrigger,
393 TerrainFilter = BTerrainFilter,
394 TerrainMask = BAllFilter & ~BStaticFilter,
395 GroundPlaneFilter = BAllFilter,
396 GroundPlaneMask = BAllFilter
272 397
273 // For each type, we first clear and then set the collision flags 398};
274public enum ClearCollisionFlag : uint
275{
276 Terrain = CollisionFlags.BS_ALL,
277 Phantom = CollisionFlags.BS_ALL,
278 VolumeDetect = CollisionFlags.BS_ALL,
279 PhysicalObject = CollisionFlags.BS_ALL,
280 StaticObject = CollisionFlags.BS_ALL
281}
282 399
283public enum SetCollisionFlag : uint
284{
285 Terrain = CollisionFlags.CF_STATIC_OBJECT
286 | CollisionFlags.BS_TERRAIN_OBJECT,
287 Phantom = CollisionFlags.CF_STATIC_OBJECT
288 | CollisionFlags.BS_PHANTOM_OBJECT
289 | CollisionFlags.CF_NO_CONTACT_RESPONSE,
290 VolumeDetect = CollisionFlags.CF_STATIC_OBJECT
291 | CollisionFlags.BS_VOLUME_DETECT_OBJECT
292 | CollisionFlags.CF_NO_CONTACT_RESPONSE,
293 PhysicalObject = CollisionFlags.BS_PHYSICAL_OBJECT,
294 StaticObject = CollisionFlags.CF_STATIC_OBJECT,
295}
296 400
297// Collision filters used for different types of objects
298public enum SetCollisionFilter : uint
299{
300 Terrain = CollisionFilterGroups.AllFilter,
301 Phantom = CollisionFilterGroups.GroundPlaneFilter
302 | CollisionFilterGroups.TerrainFilter,
303 VolumeDetect = CollisionFilterGroups.AllFilter,
304 PhysicalObject = CollisionFilterGroups.AllFilter,
305 StaticObject = CollisionFilterGroups.AllFilter,
306}
307
308// Collision masks used for different types of objects
309public enum SetCollisionMask : uint
310{
311 Terrain = CollisionFilterGroups.AllFilter,
312 Phantom = CollisionFilterGroups.GroundPlaneFilter
313 | CollisionFilterGroups.TerrainFilter,
314 VolumeDetect = CollisionFilterGroups.AllFilter,
315 PhysicalObject = CollisionFilterGroups.AllFilter,
316 StaticObject = CollisionFilterGroups.AllFilter
317}
318 401
319// CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0 402// CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0
320// ERP controls amount of correction per tick. Usable range=0.1..0.8. Default=0.2. 403// ERP controls amount of correction per tick. Usable range=0.1..0.8. Default=0.2.
@@ -350,8 +433,8 @@ public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg
350public static extern string GetVersion(); 433public static extern string GetVersion();
351 434
352[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 435[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
353public static extern uint Initialize(Vector3 maxPosition, IntPtr parms, 436public static extern uint Initialize(Vector3 maxPosition, IntPtr parms,
354 int maxCollisions, IntPtr collisionArray, 437 int maxCollisions, IntPtr collisionArray,
355 int maxUpdates, IntPtr updateArray, 438 int maxUpdates, IntPtr updateArray,
356 DebugLogCallback logRoutine); 439 DebugLogCallback logRoutine);
357 440
@@ -370,19 +453,19 @@ public static extern bool UpdateParameter(uint worldID, uint localID,
370 453
371// =============================================================================== 454// ===============================================================================
372[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 455[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
373public static extern int PhysicsStep(uint worldID, float timeStep, int maxSubSteps, float fixedTimeStep, 456public static extern int PhysicsStep(uint worldID, float timeStep, int maxSubSteps, float fixedTimeStep,
374 out int updatedEntityCount, 457 out int updatedEntityCount,
375 out IntPtr updatedEntitiesPtr, 458 out IntPtr updatedEntitiesPtr,
376 out int collidersCount, 459 out int collidersCount,
377 out IntPtr collidersPtr); 460 out IntPtr collidersPtr);
378 461
379[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 462[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
380public static extern bool CreateHull(uint worldID, System.UInt64 meshKey, 463public static extern bool CreateHull(uint worldID, System.UInt64 meshKey,
381 int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls 464 int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls
382 ); 465 );
383 466
384[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 467[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
385public static extern bool CreateMesh(uint worldID, System.UInt64 meshKey, 468public static extern bool CreateMesh(uint worldID, System.UInt64 meshKey,
386 int indexCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices, 469 int indexCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices,
387 int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices 470 int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices
388 ); 471 );
@@ -496,7 +579,7 @@ public static extern void Shutdown2(IntPtr sim);
496 579
497[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 580[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
498public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep, 581public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep,
499 out int updatedEntityCount, 582 out int updatedEntityCount,
500 out IntPtr updatedEntitiesPtr, 583 out IntPtr updatedEntitiesPtr,
501 out int collidersCount, 584 out int collidersCount,
502 out IntPtr collidersPtr); 585 out IntPtr collidersPtr);
@@ -507,8 +590,8 @@ public static extern bool PushUpdate2(IntPtr obj);
507// ===================================================================================== 590// =====================================================================================
508// Mesh, hull, shape and body creation helper routines 591// Mesh, hull, shape and body creation helper routines
509[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 592[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
510public static extern IntPtr CreateMeshShape2(IntPtr world, 593public static extern IntPtr CreateMeshShape2(IntPtr world,
511 int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices, 594 int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices,
512 int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices ); 595 int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices );
513 596
514[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 597[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
@@ -516,11 +599,10 @@ public static extern IntPtr CreateHullShape2(IntPtr world,
516 int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls); 599 int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls);
517 600
518[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 601[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
519public static extern IntPtr BuildHullShape2(IntPtr world, IntPtr meshShape); 602public static extern IntPtr BuildHullShapeFromMesh2(IntPtr world, IntPtr meshShape);
520 603
521[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 604[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
522public static extern IntPtr BuildNativeShape2(IntPtr world, 605public static extern IntPtr BuildNativeShape2(IntPtr world, ShapeData shapeData);
523 float shapeType, float collisionMargin, Vector3 scale);
524 606
525[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 607[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
526public static extern bool IsNativeShape2(IntPtr shape); 608public static extern bool IsNativeShape2(IntPtr shape);
@@ -535,16 +617,25 @@ public static extern void AddChildToCompoundShape2(IntPtr cShape, IntPtr addShap
535public static extern void RemoveChildFromCompoundShape2(IntPtr cShape, IntPtr removeShape); 617public static extern void RemoveChildFromCompoundShape2(IntPtr cShape, IntPtr removeShape);
536 618
537[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 619[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
538public static extern IntPtr CreateBodyFromShapeAndInfo2(IntPtr sim, IntPtr shape, IntPtr constructionInfo); 620public static extern IntPtr DuplicateCollisionShape2(IntPtr sim, IntPtr srcShape, uint id);
621
622[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
623public static extern IntPtr CreateBodyFromShapeAndInfo2(IntPtr sim, IntPtr shape, uint id, IntPtr constructionInfo);
539 624
540[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 625[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
541public static extern bool DeleteCollisionShape2(IntPtr world, IntPtr shape); 626public static extern bool DeleteCollisionShape2(IntPtr world, IntPtr shape);
542 627
543[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 628[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
544public static extern IntPtr CreateBodyFromShape2(IntPtr sim, IntPtr shape, Vector3 pos, Quaternion rot); 629public static extern int GetBodyType2(IntPtr obj);
630
631[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
632public static extern IntPtr CreateBodyFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot);
545 633
546[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 634[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
547public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, Vector3 pos, Quaternion rot); 635public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, uint id, Vector3 pos, Quaternion rot);
636
637[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
638public static extern IntPtr CreateGhostFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot);
548 639
549[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 640[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
550public static extern IntPtr AllocateBodyInfo2(IntPtr obj); 641public static extern IntPtr AllocateBodyInfo2(IntPtr obj);
@@ -558,11 +649,11 @@ public static extern void DestroyObject2(IntPtr sim, IntPtr obj);
558// ===================================================================================== 649// =====================================================================================
559// Terrain creation and helper routines 650// Terrain creation and helper routines
560[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 651[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
561public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords, 652public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords,
562 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin); 653 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
563 654
564[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 655[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
565public static extern IntPtr FillHeightMapInfo2(IntPtr sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords, 656public static extern IntPtr FillHeightMapInfo2(IntPtr sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords,
566 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin); 657 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
567 658
568[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 659[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
@@ -600,7 +691,7 @@ public static extern void SetConstraintEnable2(IntPtr constrain, float numericTr
600public static extern void SetConstraintNumSolverIterations2(IntPtr constrain, float iterations); 691public static extern void SetConstraintNumSolverIterations2(IntPtr constrain, float iterations);
601 692
602[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 693[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
603public static extern bool SetFrames2(IntPtr constrain, 694public static extern bool SetFrames2(IntPtr constrain,
604 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot); 695 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot);
605 696
606[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 697[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
@@ -963,6 +1054,9 @@ public static extern Vector3 GetPushVelocity2(IntPtr obj);
963[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1054[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
964public static extern Vector3 GetTurnVelocity2(IntPtr obj); 1055public static extern Vector3 GetTurnVelocity2(IntPtr obj);
965 1056
1057[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1058public static extern void SetCollisionFilterMask2(IntPtr body, uint filter, uint mask);
1059
966// ===================================================================================== 1060// =====================================================================================
967// btCollisionShape entries 1061// btCollisionShape entries
968 1062
@@ -1014,9 +1108,6 @@ public static extern void SetMargin2(IntPtr shape, float val);
1014[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1108[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1015public static extern float GetMargin2(IntPtr shape); 1109public static extern float GetMargin2(IntPtr shape);
1016 1110
1017[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1018public static extern void SetCollisionFilterMask(IntPtr shape, uint filter, uint mask);
1019
1020// ===================================================================================== 1111// =====================================================================================
1021// Debugging 1112// Debugging
1022[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1113[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]