diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs | 559 |
1 files changed, 516 insertions, 43 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs index 504bd3c..e579cf2 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs | |||
@@ -33,15 +33,25 @@ using OpenMetaverse; | |||
33 | namespace OpenSim.Region.Physics.BulletSPlugin { | 33 | namespace OpenSim.Region.Physics.BulletSPlugin { |
34 | 34 | ||
35 | // Classes to allow some type checking for the API | 35 | // Classes to allow some type checking for the API |
36 | // These hold pointers to allocated objects in the unmanaged space. | ||
37 | |||
38 | // The physics engine controller class created at initialization | ||
36 | public struct BulletSim | 39 | public struct BulletSim |
37 | { | 40 | { |
38 | public BulletSim(uint id, BSScene bss, IntPtr xx) { ID = id; scene = bss; Ptr = xx; } | 41 | public BulletSim(uint worldId, BSScene bss, IntPtr xx) { worldID = worldId; scene = bss; Ptr = xx; } |
39 | public uint ID; | 42 | public uint worldID; |
40 | // The scene is only in here so very low level routines have a handle to print debug/error messages | 43 | // The scene is only in here so very low level routines have a handle to print debug/error messages |
41 | public BSScene scene; | 44 | public BSScene scene; |
42 | public IntPtr Ptr; | 45 | public IntPtr Ptr; |
43 | } | 46 | } |
44 | 47 | ||
48 | public struct BulletShape | ||
49 | { | ||
50 | public BulletShape(IntPtr xx) { Ptr = xx; } | ||
51 | public IntPtr Ptr; | ||
52 | } | ||
53 | |||
54 | // An allocated Bullet btRigidBody | ||
45 | public struct BulletBody | 55 | public struct BulletBody |
46 | { | 56 | { |
47 | public BulletBody(uint id, IntPtr xx) { ID = id; Ptr = xx; } | 57 | public BulletBody(uint id, IntPtr xx) { ID = id; Ptr = xx; } |
@@ -49,12 +59,41 @@ public struct BulletBody | |||
49 | public uint ID; | 59 | public uint ID; |
50 | } | 60 | } |
51 | 61 | ||
62 | // An allocated Bullet btConstraint | ||
52 | public struct BulletConstraint | 63 | public struct BulletConstraint |
53 | { | 64 | { |
54 | public BulletConstraint(IntPtr xx) { Ptr = xx; } | 65 | public BulletConstraint(IntPtr xx) { Ptr = xx; } |
55 | public IntPtr Ptr; | 66 | public IntPtr Ptr; |
56 | } | 67 | } |
57 | 68 | ||
69 | // An allocated HeightMapThing which hold various heightmap info | ||
70 | // Made a class rather than a struct so there would be only one | ||
71 | // instance of this and C# will pass around pointers rather | ||
72 | // than making copies. | ||
73 | public class BulletHeightMapInfo | ||
74 | { | ||
75 | public BulletHeightMapInfo(uint id, float[] hm, IntPtr xx) { | ||
76 | ID = id; | ||
77 | Ptr = xx; | ||
78 | heightMap = hm; | ||
79 | terrainRegionBase = new Vector2(0f, 0f); | ||
80 | minCoords = new Vector3(100f, 100f, 25f); | ||
81 | maxCoords = new Vector3(101f, 101f, 26f); | ||
82 | minZ = maxZ = 0f; | ||
83 | sizeX = sizeY = 256f; | ||
84 | } | ||
85 | public uint ID; | ||
86 | public IntPtr Ptr; | ||
87 | public float[] heightMap; | ||
88 | public Vector2 terrainRegionBase; | ||
89 | public Vector3 minCoords; | ||
90 | public Vector3 maxCoords; | ||
91 | public float sizeX, sizeY; | ||
92 | public float minZ, maxZ; | ||
93 | public BulletShape terrainShape; | ||
94 | public BulletBody terrainBody; | ||
95 | } | ||
96 | |||
58 | // =============================================================================== | 97 | // =============================================================================== |
59 | [StructLayout(LayoutKind.Sequential)] | 98 | [StructLayout(LayoutKind.Sequential)] |
60 | public struct ConvexHull | 99 | public struct ConvexHull |
@@ -179,7 +218,20 @@ public struct ConfigurationParameters | |||
179 | public const float numericFalse = 0f; | 218 | public const float numericFalse = 0f; |
180 | } | 219 | } |
181 | 220 | ||
182 | // Values used by Bullet and BulletSim to control collisions | 221 | |
222 | // The states a bullet collision object can have | ||
223 | public enum ActivationState : uint | ||
224 | { | ||
225 | ACTIVE_TAG = 1, | ||
226 | ISLAND_SLEEPING, | ||
227 | WANTS_DEACTIVATION, | ||
228 | DISABLE_DEACTIVATION, | ||
229 | DISABLE_SIMULATION | ||
230 | } | ||
231 | |||
232 | // Values used by Bullet and BulletSim to control object properties. | ||
233 | // Bullet's "CollisionFlags" has more to do with operations on the | ||
234 | // object (if collisions happen, if gravity effects it, ...). | ||
183 | public enum CollisionFlags : uint | 235 | public enum CollisionFlags : uint |
184 | { | 236 | { |
185 | CF_STATIC_OBJECT = 1 << 0, | 237 | CF_STATIC_OBJECT = 1 << 0, |
@@ -194,8 +246,75 @@ public enum CollisionFlags : uint | |||
194 | BS_VOLUME_DETECT_OBJECT = 1 << 11, | 246 | BS_VOLUME_DETECT_OBJECT = 1 << 11, |
195 | BS_PHANTOM_OBJECT = 1 << 12, | 247 | BS_PHANTOM_OBJECT = 1 << 12, |
196 | BS_PHYSICAL_OBJECT = 1 << 13, | 248 | BS_PHYSICAL_OBJECT = 1 << 13, |
249 | BS_TERRAIN_OBJECT = 1 << 14, | ||
250 | BS_NONE = 0, | ||
251 | BS_ALL = 0xFFFFFFFF | ||
197 | }; | 252 | }; |
198 | 253 | ||
254 | // Values for collisions groups and masks | ||
255 | public enum CollisionFilterGroups : uint | ||
256 | { | ||
257 | NoneFilter = 0, | ||
258 | DefaultFilter = 1 << 0, | ||
259 | StaticFilter = 1 << 1, | ||
260 | KinematicFilter = 1 << 2, | ||
261 | DebrisFilter = 1 << 3, | ||
262 | SensorTrigger = 1 << 4, | ||
263 | CharacterFilter = 1 << 5, | ||
264 | AllFilter = 0xFFFFFFFF, | ||
265 | // Filter groups defined by BulletSim | ||
266 | GroundPlaneFilter = 1 << 10, | ||
267 | TerrainFilter = 1 << 11, | ||
268 | RaycastFilter = 1 << 12, | ||
269 | SolidFilter = 1 << 13, | ||
270 | }; | ||
271 | |||
272 | // For each type, we first clear and then set the collision flags | ||
273 | public enum ClearCollisionFlag : uint | ||
274 | { | ||
275 | Terrain = CollisionFlags.BS_ALL, | ||
276 | Phantom = CollisionFlags.BS_ALL, | ||
277 | VolumeDetect = CollisionFlags.BS_ALL, | ||
278 | PhysicalObject = CollisionFlags.BS_ALL, | ||
279 | StaticObject = CollisionFlags.BS_ALL | ||
280 | } | ||
281 | |||
282 | public enum SetCollisionFlag : uint | ||
283 | { | ||
284 | Terrain = CollisionFlags.CF_STATIC_OBJECT | ||
285 | | CollisionFlags.BS_TERRAIN_OBJECT, | ||
286 | Phantom = CollisionFlags.CF_STATIC_OBJECT | ||
287 | | CollisionFlags.BS_PHANTOM_OBJECT | ||
288 | | CollisionFlags.CF_NO_CONTACT_RESPONSE, | ||
289 | VolumeDetect = CollisionFlags.CF_STATIC_OBJECT | ||
290 | | CollisionFlags.BS_VOLUME_DETECT_OBJECT | ||
291 | | CollisionFlags.CF_NO_CONTACT_RESPONSE, | ||
292 | PhysicalObject = CollisionFlags.BS_PHYSICAL_OBJECT, | ||
293 | StaticObject = CollisionFlags.CF_STATIC_OBJECT, | ||
294 | } | ||
295 | |||
296 | // Collision filters used for different types of objects | ||
297 | public enum SetCollisionFilter : uint | ||
298 | { | ||
299 | Terrain = CollisionFilterGroups.AllFilter, | ||
300 | Phantom = CollisionFilterGroups.GroundPlaneFilter | ||
301 | | CollisionFilterGroups.TerrainFilter, | ||
302 | VolumeDetect = CollisionFilterGroups.AllFilter, | ||
303 | PhysicalObject = CollisionFilterGroups.AllFilter, | ||
304 | StaticObject = CollisionFilterGroups.AllFilter, | ||
305 | } | ||
306 | |||
307 | // Collision masks used for different types of objects | ||
308 | public enum SetCollisionMask : uint | ||
309 | { | ||
310 | Terrain = CollisionFilterGroups.AllFilter, | ||
311 | Phantom = CollisionFilterGroups.GroundPlaneFilter | ||
312 | | CollisionFilterGroups.TerrainFilter, | ||
313 | VolumeDetect = CollisionFilterGroups.AllFilter, | ||
314 | PhysicalObject = CollisionFilterGroups.AllFilter, | ||
315 | StaticObject = CollisionFilterGroups.AllFilter | ||
316 | } | ||
317 | |||
199 | // CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0 | 318 | // CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0 |
200 | // ERP controls amount of correction per tick. Usable range=0.1..0.8. Default=0.2. | 319 | // ERP controls amount of correction per tick. Usable range=0.1..0.8. Default=0.2. |
201 | public enum ConstraintParams : int | 320 | public enum ConstraintParams : int |
@@ -221,6 +340,10 @@ public enum ConstraintParamAxis : int | |||
221 | // =============================================================================== | 340 | // =============================================================================== |
222 | static class BulletSimAPI { | 341 | static class BulletSimAPI { |
223 | 342 | ||
343 | // Link back to the managed code for outputting log messages | ||
344 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
345 | public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg); | ||
346 | |||
224 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 347 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
225 | [return: MarshalAs(UnmanagedType.LPStr)] | 348 | [return: MarshalAs(UnmanagedType.LPStr)] |
226 | public static extern string GetVersion(); | 349 | public static extern string GetVersion(); |
@@ -228,7 +351,11 @@ public static extern string GetVersion(); | |||
228 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 351 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
229 | public static extern uint Initialize(Vector3 maxPosition, IntPtr parms, | 352 | public static extern uint Initialize(Vector3 maxPosition, IntPtr parms, |
230 | int maxCollisions, IntPtr collisionArray, | 353 | int maxCollisions, IntPtr collisionArray, |
231 | int maxUpdates, IntPtr updateArray); | 354 | int maxUpdates, IntPtr updateArray, |
355 | DebugLogCallback logRoutine); | ||
356 | |||
357 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
358 | public static extern void CreateInitialGroundPlaneAndTerrain(uint worldID); | ||
232 | 359 | ||
233 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 360 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
234 | public static extern void SetHeightmap(uint worldID, [MarshalAs(UnmanagedType.LPArray)] float[] heightMap); | 361 | public static extern void SetHeightmap(uint worldID, [MarshalAs(UnmanagedType.LPArray)] float[] heightMap); |
@@ -300,6 +427,7 @@ public static extern bool SetObjectVelocity(uint worldID, uint id, Vector3 veloc | |||
300 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 427 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
301 | public static extern bool SetObjectAngularVelocity(uint worldID, uint id, Vector3 angularVelocity); | 428 | public static extern bool SetObjectAngularVelocity(uint worldID, uint id, Vector3 angularVelocity); |
302 | 429 | ||
430 | // Set the current force acting on the object | ||
303 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 431 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
304 | public static extern bool SetObjectForce(uint worldID, uint id, Vector3 force); | 432 | public static extern bool SetObjectForce(uint worldID, uint id, Vector3 force); |
305 | 433 | ||
@@ -342,8 +470,6 @@ public static extern Vector3 RecoverFromPenetration(uint worldID, uint id); | |||
342 | public static extern void DumpBulletStatistics(); | 470 | public static extern void DumpBulletStatistics(); |
343 | 471 | ||
344 | // Log a debug message | 472 | // Log a debug message |
345 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
346 | public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg); | ||
347 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 473 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
348 | public static extern void SetDebugLogCallback(DebugLogCallback callback); | 474 | public static extern void SetDebugLogCallback(DebugLogCallback callback); |
349 | 475 | ||
@@ -358,6 +484,7 @@ public static extern void SetDebugLogCallback(DebugLogCallback callback); | |||
358 | // The names have a "2" tacked on. This will be removed as the C# code gets rebuilt | 484 | // The names have a "2" tacked on. This will be removed as the C# code gets rebuilt |
359 | // and the old code is removed. | 485 | // and the old code is removed. |
360 | 486 | ||
487 | // Functions use while converting from API1 to API2. Can be removed when totally converted. | ||
361 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 488 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
362 | public static extern IntPtr GetSimHandle2(uint worldID); | 489 | public static extern IntPtr GetSimHandle2(uint worldID); |
363 | 490 | ||
@@ -368,6 +495,7 @@ public static extern IntPtr GetBodyHandleWorldID2(uint worldID, uint id); | |||
368 | public static extern IntPtr GetBodyHandle2(IntPtr world, uint id); | 495 | public static extern IntPtr GetBodyHandle2(IntPtr world, uint id); |
369 | 496 | ||
370 | // =============================================================================== | 497 | // =============================================================================== |
498 | // Initialization and simulation | ||
371 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 499 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
372 | public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms, | 500 | public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms, |
373 | int maxCollisions, IntPtr collisionArray, | 501 | int maxCollisions, IntPtr collisionArray, |
@@ -377,7 +505,7 @@ public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms, | |||
377 | public static extern bool UpdateParameter2(IntPtr world, uint localID, String parm, float value); | 505 | public static extern bool UpdateParameter2(IntPtr world, uint localID, String parm, float value); |
378 | 506 | ||
379 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 507 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
380 | public static extern void SetHeightmap2(IntPtr world, float[] heightmap); | 508 | public static extern void SetHeightMap2(IntPtr world, float[] heightmap); |
381 | 509 | ||
382 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 510 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
383 | public static extern void Shutdown2(IntPtr sim); | 511 | public static extern void Shutdown2(IntPtr sim); |
@@ -392,23 +520,69 @@ public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSt | |||
392 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 520 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
393 | public static extern bool PushUpdate2(IntPtr obj); | 521 | public static extern bool PushUpdate2(IntPtr obj); |
394 | 522 | ||
395 | /* | 523 | // ===================================================================================== |
524 | // Mesh, hull, shape and body creation helper routines | ||
525 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
526 | public static extern IntPtr CreateMeshShape2(IntPtr world, | ||
527 | int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices, | ||
528 | int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices ); | ||
529 | |||
530 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
531 | public static extern IntPtr CreateHullShape2(IntPtr world, | ||
532 | int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls); | ||
533 | |||
534 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
535 | public static extern IntPtr BuildHullShape2(IntPtr world, IntPtr meshShape); | ||
536 | |||
537 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
538 | public static extern IntPtr BuildNativeShape2(IntPtr world, | ||
539 | float shapeType, float collisionMargin, Vector3 scale); | ||
540 | |||
541 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
542 | public static extern bool DeleteCollisionShape2(IntPtr world, IntPtr shape); | ||
543 | |||
544 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
545 | public static extern IntPtr CreateBodyFromShape2(IntPtr sim, IntPtr shape, Vector3 pos, Quaternion rot); | ||
546 | |||
547 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
548 | public static extern IntPtr CreateBodyFromShapeAndInfo2(IntPtr sim, IntPtr shape, IntPtr constructionInfo); | ||
549 | |||
550 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
551 | public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, Vector3 pos, Quaternion rot); | ||
552 | |||
553 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
554 | public static extern IntPtr AllocateBodyInfo2(IntPtr obj); | ||
555 | |||
556 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
557 | public static extern void ReleaseBodyInfo2(IntPtr obj); | ||
558 | |||
559 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
560 | public static extern void DestroyObject2(IntPtr sim, IntPtr obj); | ||
561 | |||
562 | // ===================================================================================== | ||
563 | // Terrain creation and helper routines | ||
564 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
565 | public static extern void DumpMapInfo(IntPtr sim, IntPtr manInfo); | ||
566 | |||
396 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 567 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
397 | public static extern IntPtr CreateMesh2(IntPtr world, int indicesCount, int* indices, int verticesCount, float* vertices ); | 568 | public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords, |
569 | [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin); | ||
398 | 570 | ||
399 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 571 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
400 | public static extern bool BuildHull2(IntPtr world, IntPtr mesh); | 572 | public static extern IntPtr FillHeightMapInfo2(IntPtr sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords, |
573 | [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin); | ||
401 | 574 | ||
402 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 575 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
403 | public static extern bool ReleaseHull2(IntPtr world, IntPtr mesh); | 576 | public static extern bool ReleaseHeightMapInfo2(IntPtr heightMapInfo); |
404 | 577 | ||
405 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 578 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
406 | public static extern bool DestroyMesh2(IntPtr world, IntPtr mesh); | 579 | public static extern IntPtr CreateGroundPlaneShape2(uint id, float height, float collisionMargin); |
407 | 580 | ||
408 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 581 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
409 | public static extern IntPtr CreateObject2(IntPtr world, ShapeData shapeData); | 582 | public static extern IntPtr CreateTerrainShape2(IntPtr mapInfo); |
410 | */ | ||
411 | 583 | ||
584 | // ===================================================================================== | ||
585 | // Constraint creation and helper routines | ||
412 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 586 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
413 | public static extern IntPtr Create6DofConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, | 587 | public static extern IntPtr Create6DofConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, |
414 | Vector3 frame1loc, Quaternion frame1rot, | 588 | Vector3 frame1loc, Quaternion frame1rot, |
@@ -460,11 +634,108 @@ public static extern bool SetConstraintParam2(IntPtr constrain, ConstraintParams | |||
460 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 634 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
461 | public static extern bool DestroyConstraint2(IntPtr world, IntPtr constrain); | 635 | public static extern bool DestroyConstraint2(IntPtr world, IntPtr constrain); |
462 | 636 | ||
637 | // ===================================================================================== | ||
638 | // btCollisionWorld entries | ||
463 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 639 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
464 | public static extern Vector3 AddObjectToWorld2(IntPtr world, IntPtr obj); | 640 | public static extern void UpdateSingleAabb2(IntPtr world, IntPtr obj); |
465 | 641 | ||
466 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 642 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
467 | public static extern Vector3 RemoveObjectFromWorld2(IntPtr world, IntPtr obj); | 643 | public static extern void UpdateAabbs2(IntPtr world); |
644 | |||
645 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
646 | public static extern bool GetForceUpdateAllAabbs2(IntPtr world); | ||
647 | |||
648 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
649 | public static extern void SetForceUpdateAllAabbs2(IntPtr world, bool force); | ||
650 | |||
651 | // ===================================================================================== | ||
652 | // btDynamicsWorld entries | ||
653 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
654 | public static extern bool AddObjectToWorld2(IntPtr world, IntPtr obj); | ||
655 | |||
656 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
657 | public static extern bool RemoveObjectFromWorld2(IntPtr world, IntPtr obj); | ||
658 | |||
659 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
660 | public static extern bool AddConstraintToWorld2(IntPtr world, IntPtr constrain, bool disableCollisionsBetweenLinkedObjects); | ||
661 | |||
662 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
663 | public static extern bool RemoveConstraintFromWorld2(IntPtr world, IntPtr constrain); | ||
664 | // ===================================================================================== | ||
665 | // btCollisionObject entries | ||
666 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
667 | public static extern Vector3 GetAnisotripicFriction2(IntPtr constrain); | ||
668 | |||
669 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
670 | public static extern Vector3 SetAnisotripicFriction2(IntPtr constrain, Vector3 frict); | ||
671 | |||
672 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
673 | public static extern bool HasAnisotripicFriction2(IntPtr constrain); | ||
674 | |||
675 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
676 | public static extern void SetContactProcessingThreshold2(IntPtr obj, float val); | ||
677 | |||
678 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
679 | public static extern float GetContactProcessingThreshold2(IntPtr obj); | ||
680 | |||
681 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
682 | public static extern bool IsStaticObject2(IntPtr obj); | ||
683 | |||
684 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
685 | public static extern bool IsKinematicObject2(IntPtr obj); | ||
686 | |||
687 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
688 | public static extern bool IsStaticOrKinematicObject2(IntPtr obj); | ||
689 | |||
690 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
691 | public static extern bool HasContactResponse2(IntPtr obj); | ||
692 | |||
693 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
694 | public static extern void SetCollisionShape2(IntPtr sim, IntPtr obj, IntPtr shape); | ||
695 | |||
696 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
697 | public static extern IntPtr GetCollisionShape2(IntPtr obj); | ||
698 | |||
699 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
700 | public static extern int GetActivationState2(IntPtr obj); | ||
701 | |||
702 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
703 | public static extern void SetActivationState2(IntPtr obj, int state); | ||
704 | |||
705 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
706 | public static extern void SetDeactivationTime2(IntPtr obj, float dtime); | ||
707 | |||
708 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
709 | public static extern float GetDeactivationTime2(IntPtr obj); | ||
710 | |||
711 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
712 | public static extern void ForceActivationState2(IntPtr obj, ActivationState state); | ||
713 | |||
714 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
715 | public static extern void Activate2(IntPtr obj, bool forceActivation); | ||
716 | |||
717 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
718 | public static extern bool IsActive2(IntPtr obj); | ||
719 | |||
720 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
721 | public static extern void SetRestitution2(IntPtr obj, float val); | ||
722 | |||
723 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
724 | public static extern float GetRestitution2(IntPtr obj); | ||
725 | |||
726 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
727 | public static extern void SetFriction2(IntPtr obj, float val); | ||
728 | |||
729 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
730 | public static extern float GetFriction2(IntPtr obj); | ||
731 | |||
732 | /* Haven't defined the type 'Transform' | ||
733 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
734 | public static extern Transform GetWorldTransform2(IntPtr obj); | ||
735 | |||
736 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
737 | public static extern void setWorldTransform2(IntPtr obj, Transform trans); | ||
738 | */ | ||
468 | 739 | ||
469 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 740 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
470 | public static extern Vector3 GetPosition2(IntPtr obj); | 741 | public static extern Vector3 GetPosition2(IntPtr obj); |
@@ -473,86 +744,288 @@ public static extern Vector3 GetPosition2(IntPtr obj); | |||
473 | public static extern Quaternion GetOrientation2(IntPtr obj); | 744 | public static extern Quaternion GetOrientation2(IntPtr obj); |
474 | 745 | ||
475 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 746 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
476 | public static extern bool SetTranslation2(IntPtr obj, Vector3 position, Quaternion rotation); | 747 | public static extern void SetTranslation2(IntPtr obj, Vector3 position, Quaternion rotation); |
477 | 748 | ||
478 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 749 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
479 | public static extern bool SetVelocity2(IntPtr obj, Vector3 velocity); | 750 | public static extern IntPtr GetBroadphaseHandle2(IntPtr obj); |
480 | 751 | ||
481 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 752 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
482 | public static extern bool SetAngularVelocity2(IntPtr obj, Vector3 angularVelocity); | 753 | public static extern void SetBroadphaseHandle2(IntPtr obj, IntPtr handle); |
483 | 754 | ||
755 | /* | ||
484 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 756 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
485 | public static extern bool SetObjectForce2(IntPtr obj, Vector3 force); | 757 | public static extern Transform GetInterpolationWorldTransform2(IntPtr obj); |
486 | 758 | ||
487 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 759 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
488 | public static extern bool AddObjectForce2(IntPtr obj, Vector3 force); | 760 | public static extern void SetInterpolationWorldTransform2(IntPtr obj, Transform trans); |
761 | */ | ||
489 | 762 | ||
490 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 763 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
491 | public static extern bool SetCcdMotionThreshold2(IntPtr obj, float val); | 764 | public static extern void SetInterpolationLinearVelocity2(IntPtr obj, Vector3 vel); |
492 | 765 | ||
493 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 766 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
494 | public static extern bool SetCcdSweepSphereRadius2(IntPtr obj, float val); | 767 | public static extern void SetInterpolationAngularVelocity2(IntPtr obj, Vector3 vel); |
495 | 768 | ||
496 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 769 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
497 | public static extern bool SetDamping2(IntPtr obj, float lin_damping, float ang_damping); | 770 | public static extern void SetInterpolationVelocity2(IntPtr obj, Vector3 linearVel, Vector3 angularVel); |
498 | 771 | ||
499 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 772 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
500 | public static extern bool SetDeactivationTime2(IntPtr obj, float val); | 773 | public static extern float GetHitFraction2(IntPtr obj); |
501 | 774 | ||
502 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 775 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
503 | public static extern bool SetSleepingThresholds2(IntPtr obj, float lin_threshold, float ang_threshold); | 776 | public static extern void SetHitFraction2(IntPtr obj, float val); |
504 | 777 | ||
505 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 778 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
506 | public static extern bool SetContactProcessingThreshold2(IntPtr obj, float val); | 779 | public static extern CollisionFlags GetCollisionFlags2(IntPtr obj); |
507 | 780 | ||
508 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 781 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
509 | public static extern bool SetFriction2(IntPtr obj, float val); | 782 | public static extern CollisionFlags SetCollisionFlags2(IntPtr obj, CollisionFlags flags); |
510 | 783 | ||
511 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 784 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
512 | public static extern bool SetRestitution2(IntPtr obj, float val); | 785 | public static extern CollisionFlags AddToCollisionFlags2(IntPtr obj, CollisionFlags flags); |
513 | 786 | ||
514 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 787 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
515 | public static extern bool SetLinearVelocity2(IntPtr obj, Vector3 val); | 788 | public static extern CollisionFlags RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags); |
516 | 789 | ||
517 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 790 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
518 | public static extern bool SetInterpolation2(IntPtr obj, Vector3 lin, Vector3 ang); | 791 | public static extern float GetCcdMotionThreshold2(IntPtr obj); |
519 | 792 | ||
520 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 793 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
521 | public static extern CollisionFlags GetCollisionFlags2(IntPtr obj); | 794 | public static extern void SetCcdMotionThreshold2(IntPtr obj, float val); |
795 | |||
796 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
797 | public static extern float GetCcdSweepSphereRadius2(IntPtr obj); | ||
798 | |||
799 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
800 | public static extern void SetCcdSweepSphereRadius2(IntPtr obj, float val); | ||
801 | |||
802 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
803 | public static extern IntPtr GetUserPointer2(IntPtr obj); | ||
804 | |||
805 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
806 | public static extern void SetUserPointer2(IntPtr obj, IntPtr val); | ||
807 | |||
808 | // ===================================================================================== | ||
809 | // btRigidBody entries | ||
810 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
811 | public static extern void ApplyGravity2(IntPtr obj); | ||
812 | |||
813 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
814 | public static extern void SetGravity2(IntPtr obj, Vector3 val); | ||
815 | |||
816 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
817 | public static extern Vector3 GetGravity2(IntPtr obj); | ||
818 | |||
819 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
820 | public static extern void SetDamping2(IntPtr obj, float lin_damping, float ang_damping); | ||
821 | |||
822 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
823 | public static extern float GetLinearDamping2(IntPtr obj); | ||
824 | |||
825 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
826 | public static extern float GetAngularDamping2(IntPtr obj); | ||
827 | |||
828 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
829 | public static extern float GetLinearSleepingThreshold2(IntPtr obj); | ||
830 | |||
831 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
832 | public static extern float GetAngularSleepingThreshold2(IntPtr obj); | ||
833 | |||
834 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
835 | public static extern void ApplyDamping2(IntPtr obj, float timeStep); | ||
836 | |||
837 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
838 | public static extern void SetMassProps2(IntPtr obj, float mass, Vector3 inertia); | ||
839 | |||
840 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
841 | public static extern Vector3 GetLinearFactor2(IntPtr obj); | ||
842 | |||
843 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
844 | public static extern void SetLinearFactor2(IntPtr obj, Vector3 factor); | ||
845 | |||
846 | /* | ||
847 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
848 | public static extern void SetCenterOfMassTransform2(IntPtr obj, Transform trans); | ||
849 | */ | ||
850 | |||
851 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
852 | public static extern void SetCenterOfMassByPosRot2(IntPtr obj, Vector3 pos, Quaternion rot); | ||
853 | |||
854 | // Add a force to the object as if its mass is one. | ||
855 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
856 | public static extern void ApplyCentralForce2(IntPtr obj, Vector3 force); | ||
857 | |||
858 | // Set the force being applied to the object as if its mass is one. | ||
859 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
860 | public static extern void SetObjectForce2(IntPtr obj, Vector3 force); | ||
861 | |||
862 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
863 | public static extern Vector3 GetTotalForce2(IntPtr obj); | ||
864 | |||
865 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
866 | public static extern Vector3 GetTotalTorque2(IntPtr obj); | ||
867 | |||
868 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
869 | public static extern Vector3 GetInvInertiaDiagLocal2(IntPtr obj); | ||
870 | |||
871 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
872 | public static extern void SetInvInertiaDiagLocal2(IntPtr obj, Vector3 inert); | ||
873 | |||
874 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
875 | public static extern void SetSleepingThresholds2(IntPtr obj, float lin_threshold, float ang_threshold); | ||
876 | |||
877 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
878 | public static extern void ApplyTorque2(IntPtr obj, Vector3 torque); | ||
879 | |||
880 | // Apply force at the given point. Will add torque to the object. | ||
881 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
882 | public static extern void ApplyForce2(IntPtr obj, Vector3 force, Vector3 pos); | ||
883 | |||
884 | // Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass. | ||
885 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
886 | public static extern void ApplyCentralImpulse2(IntPtr obj, Vector3 imp); | ||
887 | |||
888 | // Apply impulse to the object's torque. Force is scaled by object's mass. | ||
889 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
890 | public static extern void ApplyTorqueImpulse2(IntPtr obj, Vector3 imp); | ||
891 | |||
892 | // Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces. | ||
893 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
894 | public static extern void ApplyImpulse2(IntPtr obj, Vector3 imp, Vector3 pos); | ||
895 | |||
896 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
897 | public static extern void ClearForces2(IntPtr obj); | ||
898 | |||
899 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
900 | public static extern void ClearAllForces2(IntPtr obj); | ||
901 | |||
902 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
903 | public static extern void UpdateInertiaTensor2(IntPtr obj); | ||
904 | |||
905 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
906 | public static extern Vector3 GetCenterOfMassPosition2(IntPtr obj); | ||
907 | |||
908 | /* | ||
909 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
910 | public static extern Transform GetCenterOfMassTransform2(IntPtr obj); | ||
911 | */ | ||
912 | |||
913 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
914 | public static extern Vector3 GetLinearVelocity2(IntPtr obj); | ||
915 | |||
916 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
917 | public static extern Vector3 GetAngularVelocity2(IntPtr obj); | ||
918 | |||
919 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
920 | public static extern void SetLinearVelocity2(IntPtr obj, Vector3 val); | ||
921 | |||
922 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
923 | public static extern void SetAngularVelocity2(IntPtr obj, Vector3 angularVelocity); | ||
924 | |||
925 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
926 | public static extern Vector3 GetVelocityInLocalPoint2(IntPtr obj, Vector3 pos); | ||
927 | |||
928 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
929 | public static extern void Translate2(IntPtr obj, Vector3 trans); | ||
930 | |||
931 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
932 | public static extern void UpdateDeactivation2(IntPtr obj, float timeStep); | ||
933 | |||
934 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
935 | public static extern bool WantsSleeping2(IntPtr obj); | ||
936 | |||
937 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
938 | public static extern void SetAngularFactor2(IntPtr obj, float factor); | ||
939 | |||
940 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
941 | public static extern void SetAngularFactorV2(IntPtr obj, Vector3 factor); | ||
942 | |||
943 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
944 | public static extern Vector3 GetAngularFactor2(IntPtr obj); | ||
945 | |||
946 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
947 | public static extern bool IsInWorld2(IntPtr obj); | ||
948 | |||
949 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
950 | public static extern void AddConstraintRef2(IntPtr obj, IntPtr constrain); | ||
951 | |||
952 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
953 | public static extern void RemoveConstraintRef2(IntPtr obj, IntPtr constrain); | ||
954 | |||
955 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
956 | public static extern IntPtr GetConstraintRef2(IntPtr obj, int index); | ||
957 | |||
958 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
959 | public static extern int GetNumConstraintRefs2(IntPtr obj); | ||
960 | |||
961 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
962 | public static extern Vector3 GetDeltaLinearVelocity2(IntPtr obj); | ||
963 | |||
964 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
965 | public static extern Vector3 GetDeltaAngularVelocity2(IntPtr obj); | ||
966 | |||
967 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
968 | public static extern Vector3 GetPushVelocity2(IntPtr obj); | ||
969 | |||
970 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
971 | public static extern Vector3 GetTurnVelocity2(IntPtr obj); | ||
972 | |||
973 | // ===================================================================================== | ||
974 | // btCollisionShape entries | ||
975 | |||
976 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
977 | public static extern float GetAngularMotionDisc2(IntPtr shape); | ||
978 | |||
979 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
980 | public static extern float GetContactBreakingThreshold2(IntPtr shape, float defaultFactor); | ||
981 | |||
982 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
983 | public static extern bool IsPolyhedral2(IntPtr shape); | ||
984 | |||
985 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
986 | public static extern bool IsConvex2d2(IntPtr shape); | ||
987 | |||
988 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
989 | public static extern bool IsConvex2(IntPtr shape); | ||
990 | |||
991 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
992 | public static extern bool IsNonMoving2(IntPtr shape); | ||
522 | 993 | ||
523 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 994 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
524 | public static extern IntPtr SetCollisionFlags2(IntPtr obj, CollisionFlags flags); | 995 | public static extern bool IsConcave2(IntPtr shape); |
525 | 996 | ||
526 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 997 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
527 | public static extern IntPtr AddToCollisionFlags2(IntPtr obj, CollisionFlags flags); | 998 | public static extern bool IsCompound2(IntPtr shape); |
528 | 999 | ||
529 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1000 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
530 | public static extern IntPtr RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags); | 1001 | public static extern bool IsSoftBody2(IntPtr shape); |
531 | 1002 | ||
532 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1003 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
533 | public static extern bool SetMassProps2(IntPtr obj, float mass, Vector3 inertia); | 1004 | public static extern bool IsInfinite2(IntPtr shape); |
534 | 1005 | ||
535 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1006 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
536 | public static extern bool UpdateInertiaTensor2(IntPtr obj); | 1007 | public static extern void SetLocalScaling2(IntPtr shape, Vector3 scale); |
537 | 1008 | ||
538 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1009 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
539 | public static extern bool SetGravity2(IntPtr obj, Vector3 val); | 1010 | public static extern Vector3 GetLocalScaling2(IntPtr shape); |
540 | 1011 | ||
541 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1012 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
542 | public static extern IntPtr ClearForces2(IntPtr obj); | 1013 | public static extern void CalculateLocalInertia2(IntPtr shape, float mass, Vector3 inertia); |
543 | 1014 | ||
544 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1015 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
545 | public static extern IntPtr ClearAllForces2(IntPtr obj); | 1016 | public static extern int GetShapeType2(IntPtr shape); |
546 | 1017 | ||
547 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1018 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
548 | public static extern bool SetMargin2(IntPtr obj, float val); | 1019 | public static extern void SetMargin2(IntPtr shape, float val); |
549 | 1020 | ||
550 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1021 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
551 | public static extern bool UpdateSingleAabb2(IntPtr world, IntPtr obj); | 1022 | public static extern float GetMargin2(IntPtr shape); |
552 | 1023 | ||
553 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1024 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
554 | public static extern bool DestroyObject2(IntPtr world, uint id); | 1025 | public static extern void SetCollisionFilterMask(IntPtr shape, uint filter, uint mask); |
555 | 1026 | ||
1027 | // ===================================================================================== | ||
1028 | // Debugging | ||
556 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1029 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
557 | public static extern void DumpPhysicsStatistics2(IntPtr sim); | 1030 | public static extern void DumpPhysicsStatistics2(IntPtr sim); |
558 | 1031 | ||