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.cs716
1 files changed, 636 insertions, 80 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
index 504bd3c..276111c 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
@@ -33,38 +33,153 @@ using OpenMetaverse;
33namespace OpenSim.Region.Physics.BulletSPlugin { 33namespace 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
36public struct BulletSim 39public 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)
39 public uint ID; 42 {
43 ptr = xx;
44 worldID = worldId;
45 physicsScene = bss;
46 }
47 public IntPtr ptr;
48 public uint worldID;
40 // 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
41 public BSScene scene; 50 public BSScene physicsScene;
42 public IntPtr Ptr;
43} 51}
44 52
53// An allocated Bullet btRigidBody
45public struct BulletBody 54public struct BulletBody
46{ 55{
47 public BulletBody(uint id, IntPtr xx) { ID = id; Ptr = xx; } 56 public BulletBody(uint id, IntPtr xx)
48 public IntPtr Ptr; 57 {
58 ID = id;
59 ptr = xx;
60 collisionFilter = 0;
61 collisionMask = 0;
62 }
63 public IntPtr ptr;
49 public uint ID; 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 }
84}
85
86public struct BulletShape
87{
88 public BulletShape(IntPtr xx)
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 System.UInt64 shapeKey;
105 public bool isNativeShape;
106 public override string ToString()
107 {
108 StringBuilder buff = new StringBuilder();
109 buff.Append("<p=");
110 buff.Append(ptr.ToString("X"));
111 buff.Append(",s=");
112 buff.Append(type.ToString());
113 buff.Append(",k=");
114 buff.Append(shapeKey.ToString("X"));
115 buff.Append(",n=");
116 buff.Append(isNativeShape.ToString());
117 buff.Append(">");
118 return buff.ToString();
119 }
50} 120}
51 121
122 // Constraint type values as defined by Bullet
123public enum ConstraintType : int
124{
125 POINT2POINT_CONSTRAINT_TYPE = 3,
126 HINGE_CONSTRAINT_TYPE,
127 CONETWIST_CONSTRAINT_TYPE,
128 D6_CONSTRAINT_TYPE,
129 SLIDER_CONSTRAINT_TYPE,
130 CONTACT_CONSTRAINT_TYPE,
131 D6_SPRING_CONSTRAINT_TYPE,
132 MAX_CONSTRAINT_TYPE
133}
134
135// An allocated Bullet btConstraint
52public struct BulletConstraint 136public struct BulletConstraint
53{ 137{
54 public BulletConstraint(IntPtr xx) { Ptr = xx; } 138 public BulletConstraint(IntPtr xx)
139 {
140 ptr = xx;
141 }
142 public IntPtr ptr;
143}
144
145// An allocated HeightMapThing which holds various heightmap info.
146// Made a class rather than a struct so there would be only one
147// instance of this and C# will pass around pointers rather
148// than making copies.
149public class BulletHeightMapInfo
150{
151 public BulletHeightMapInfo(uint id, float[] hm, IntPtr xx) {
152 ID = id;
153 Ptr = xx;
154 heightMap = hm;
155 terrainRegionBase = new Vector2(0f, 0f);
156 minCoords = new Vector3(100f, 100f, 25f);
157 maxCoords = new Vector3(101f, 101f, 26f);
158 minZ = maxZ = 0f;
159 sizeX = sizeY = 256f;
160 }
161 public uint ID;
55 public IntPtr Ptr; 162 public IntPtr Ptr;
163 public float[] heightMap;
164 public Vector2 terrainRegionBase;
165 public Vector3 minCoords;
166 public Vector3 maxCoords;
167 public float sizeX, sizeY;
168 public float minZ, maxZ;
169 public BulletShape terrainShape;
170 public BulletBody terrainBody;
56} 171}
57 172
58// =============================================================================== 173// ===============================================================================
59[StructLayout(LayoutKind.Sequential)] 174[StructLayout(LayoutKind.Sequential)]
60public struct ConvexHull 175public struct ConvexHull
61{ 176{
62 Vector3 Offset; 177 Vector3 Offset;
63 int VertexCount; 178 int VertexCount;
64 Vector3[] Vertices; 179 Vector3[] Vertices;
65} 180}
66[StructLayout(LayoutKind.Sequential)] 181[StructLayout(LayoutKind.Sequential)]
67public struct ShapeData 182public struct ShapeData
68{ 183{
69 public enum PhysicsShapeType 184 public enum PhysicsShapeType
70 { 185 {
@@ -75,7 +190,10 @@ public struct ShapeData
75 SHAPE_CYLINDER = 4, 190 SHAPE_CYLINDER = 4,
76 SHAPE_SPHERE = 5, 191 SHAPE_SPHERE = 5,
77 SHAPE_MESH = 6, 192 SHAPE_MESH = 6,
78 SHAPE_HULL = 7 193 SHAPE_HULL = 7,
194 // following defined by BulletSim
195 SHAPE_GROUNDPLANE = 20,
196 SHAPE_TERRAIN = 21,
79 }; 197 };
80 public uint ID; 198 public uint ID;
81 public PhysicsShapeType Type; 199 public PhysicsShapeType Type;
@@ -91,13 +209,24 @@ public struct ShapeData
91 public float Restitution; 209 public float Restitution;
92 public float Collidable; // true of things bump into this 210 public float Collidable; // true of things bump into this
93 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;
94 214
95 // 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
96 public const float numericTrue = 1f; 216 public const float numericTrue = 1f;
97 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 }
98} 227}
99[StructLayout(LayoutKind.Sequential)] 228[StructLayout(LayoutKind.Sequential)]
100public struct SweepHit 229public struct SweepHit
101{ 230{
102 public uint ID; 231 public uint ID;
103 public float Fraction; 232 public float Fraction;
@@ -174,12 +303,38 @@ public struct ConfigurationParameters
174 public float linkConstraintTransMotorMaxForce; 303 public float linkConstraintTransMotorMaxForce;
175 public float linkConstraintERP; 304 public float linkConstraintERP;
176 public float linkConstraintCFM; 305 public float linkConstraintCFM;
306 public float linkConstraintSolverIterations;
307
308 public float physicsLoggingFrames;
177 309
178 public const float numericTrue = 1f; 310 public const float numericTrue = 1f;
179 public const float numericFalse = 0f; 311 public const float numericFalse = 0f;
180} 312}
181 313
182// Values used by Bullet and BulletSim to control collisions 314
315// The states a bullet collision object can have
316public enum ActivationState : uint
317{
318 ACTIVE_TAG = 1,
319 ISLAND_SLEEPING,
320 WANTS_DEACTIVATION,
321 DISABLE_DEACTIVATION,
322 DISABLE_SIMULATION,
323}
324
325public enum CollisionObjectTypes : int
326{
327 CO_COLLISION_OBJECT = 1 << 0,
328 CO_RIGID_BODY = 1 << 1,
329 CO_GHOST_OBJECT = 1 << 2,
330 CO_SOFT_BODY = 1 << 3,
331 CO_HF_FLUID = 1 << 4,
332 CO_USER_TYPE = 1 << 5,
333}
334
335// Values used by Bullet and BulletSim to control object properties.
336// Bullet's "CollisionFlags" has more to do with operations on the
337// object (if collisions happen, if gravity effects it, ...).
183public enum CollisionFlags : uint 338public enum CollisionFlags : uint
184{ 339{
185 CF_STATIC_OBJECT = 1 << 0, 340 CF_STATIC_OBJECT = 1 << 0,
@@ -191,11 +346,55 @@ public enum CollisionFlags : uint
191 CF_DISABLE_SPU_COLLISION_PROCESS = 1 << 6, 346 CF_DISABLE_SPU_COLLISION_PROCESS = 1 << 6,
192 // Following used by BulletSim to control collisions 347 // Following used by BulletSim to control collisions
193 BS_SUBSCRIBE_COLLISION_EVENTS = 1 << 10, 348 BS_SUBSCRIBE_COLLISION_EVENTS = 1 << 10,
194 BS_VOLUME_DETECT_OBJECT = 1 << 11, 349 BS_FLOATS_ON_WATER = 1 << 11,
195 BS_PHANTOM_OBJECT = 1 << 12, 350 BS_NONE = 0,
196 BS_PHYSICAL_OBJECT = 1 << 13, 351 BS_ALL = 0xFFFFFFFF,
352
353 // These are the collision flags switched depending on physical state.
354 // The other flags are used for other things and should not be fooled with.
355 BS_ACTIVE = CF_STATIC_OBJECT
356 | CF_KINEMATIC_OBJECT
357 | CF_NO_CONTACT_RESPONSE
358};
359
360// Values for collisions groups and masks
361public enum CollisionFilterGroups : uint
362{
363 // Don't use the bit definitions!! Define the use in a
364 // filter/mask definition below. This way collision interactions
365 // are more easily debugged.
366 BNoneFilter = 0,
367 BDefaultFilter = 1 << 0,
368 BStaticFilter = 1 << 1,
369 BKinematicFilter = 1 << 2,
370 BDebrisFilter = 1 << 3,
371 BSensorTrigger = 1 << 4,
372 BCharacterFilter = 1 << 5,
373 BAllFilter = 0xFFFFFFFF,
374 // Filter groups defined by BulletSim
375 BGroundPlaneFilter = 1 << 10,
376 BTerrainFilter = 1 << 11,
377 BRaycastFilter = 1 << 12,
378 BSolidFilter = 1 << 13,
379
380 // The collsion filters and masked are defined in one place -- don't want them scattered
381 AvatarFilter = BCharacterFilter,
382 AvatarMask = BAllFilter,
383 ObjectFilter = BSolidFilter,
384 ObjectMask = BAllFilter,
385 StaticObjectFilter = BStaticFilter,
386 StaticObjectMask = BAllFilter,
387 VolumeDetectFilter = BSensorTrigger,
388 VolumeDetectMask = ~BSensorTrigger,
389 TerrainFilter = BTerrainFilter,
390 TerrainMask = BAllFilter & ~BStaticFilter,
391 GroundPlaneFilter = BAllFilter,
392 GroundPlaneMask = BAllFilter
393
197}; 394};
198 395
396
397
199// CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0 398// 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. 399// ERP controls amount of correction per tick. Usable range=0.1..0.8. Default=0.2.
201public enum ConstraintParams : int 400public enum ConstraintParams : int
@@ -221,14 +420,22 @@ public enum ConstraintParamAxis : int
221// =============================================================================== 420// ===============================================================================
222static class BulletSimAPI { 421static class BulletSimAPI {
223 422
423// Link back to the managed code for outputting log messages
424[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
425public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg);
426
224[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 427[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
225[return: MarshalAs(UnmanagedType.LPStr)] 428[return: MarshalAs(UnmanagedType.LPStr)]
226public static extern string GetVersion(); 429public static extern string GetVersion();
227 430
228[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 431[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
229public static extern uint Initialize(Vector3 maxPosition, IntPtr parms, 432public static extern uint Initialize(Vector3 maxPosition, IntPtr parms,
230 int maxCollisions, IntPtr collisionArray, 433 int maxCollisions, IntPtr collisionArray,
231 int maxUpdates, IntPtr updateArray); 434 int maxUpdates, IntPtr updateArray,
435 DebugLogCallback logRoutine);
436
437[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
438public static extern void CreateInitialGroundPlaneAndTerrain(uint worldID);
232 439
233[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 440[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
234public static extern void SetHeightmap(uint worldID, [MarshalAs(UnmanagedType.LPArray)] float[] heightMap); 441public static extern void SetHeightmap(uint worldID, [MarshalAs(UnmanagedType.LPArray)] float[] heightMap);
@@ -242,19 +449,19 @@ public static extern bool UpdateParameter(uint worldID, uint localID,
242 449
243// =============================================================================== 450// ===============================================================================
244[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 451[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
245public static extern int PhysicsStep(uint worldID, float timeStep, int maxSubSteps, float fixedTimeStep, 452public static extern int PhysicsStep(uint worldID, float timeStep, int maxSubSteps, float fixedTimeStep,
246 out int updatedEntityCount, 453 out int updatedEntityCount,
247 out IntPtr updatedEntitiesPtr, 454 out IntPtr updatedEntitiesPtr,
248 out int collidersCount, 455 out int collidersCount,
249 out IntPtr collidersPtr); 456 out IntPtr collidersPtr);
250 457
251[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 458[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
252public static extern bool CreateHull(uint worldID, System.UInt64 meshKey, 459public static extern bool CreateHull(uint worldID, System.UInt64 meshKey,
253 int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls 460 int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls
254 ); 461 );
255 462
256[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 463[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
257public static extern bool CreateMesh(uint worldID, System.UInt64 meshKey, 464public static extern bool CreateMesh(uint worldID, System.UInt64 meshKey,
258 int indexCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices, 465 int indexCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices,
259 int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices 466 int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices
260 ); 467 );
@@ -268,23 +475,6 @@ public static extern bool DestroyMesh(uint worldID, System.UInt64 meshKey);
268[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 475[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
269public static extern bool CreateObject(uint worldID, ShapeData shapeData); 476public static extern bool CreateObject(uint worldID, ShapeData shapeData);
270 477
271/* Remove old functionality
272[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
273public static extern void CreateLinkset(uint worldID, int objectCount, ShapeData[] shapeDatas);
274
275[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
276public static extern void AddConstraint(uint worldID, uint id1, uint id2,
277 Vector3 frame1, Quaternion frame1rot,
278 Vector3 frame2, Quaternion frame2rot,
279 Vector3 lowLinear, Vector3 hiLinear, Vector3 lowAngular, Vector3 hiAngular);
280
281[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
282public static extern bool RemoveConstraintByID(uint worldID, uint id1);
283
284[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
285public static extern bool RemoveConstraint(uint worldID, uint id1, uint id2);
286 */
287
288[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 478[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
289public static extern Vector3 GetObjectPosition(uint WorldID, uint id); 479public static extern Vector3 GetObjectPosition(uint WorldID, uint id);
290 480
@@ -300,6 +490,7 @@ public static extern bool SetObjectVelocity(uint worldID, uint id, Vector3 veloc
300[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 490[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
301public static extern bool SetObjectAngularVelocity(uint worldID, uint id, Vector3 angularVelocity); 491public static extern bool SetObjectAngularVelocity(uint worldID, uint id, Vector3 angularVelocity);
302 492
493// Set the current force acting on the object
303[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 494[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
304public static extern bool SetObjectForce(uint worldID, uint id, Vector3 force); 495public static extern bool SetObjectForce(uint worldID, uint id, Vector3 force);
305 496
@@ -342,8 +533,6 @@ public static extern Vector3 RecoverFromPenetration(uint worldID, uint id);
342public static extern void DumpBulletStatistics(); 533public static extern void DumpBulletStatistics();
343 534
344// Log a debug message 535// Log a debug message
345[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
346public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg);
347[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 536[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
348public static extern void SetDebugLogCallback(DebugLogCallback callback); 537public static extern void SetDebugLogCallback(DebugLogCallback callback);
349 538
@@ -358,6 +547,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 547// The names have a "2" tacked on. This will be removed as the C# code gets rebuilt
359// and the old code is removed. 548// and the old code is removed.
360 549
550// Functions use while converting from API1 to API2. Can be removed when totally converted.
361[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 551[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
362public static extern IntPtr GetSimHandle2(uint worldID); 552public static extern IntPtr GetSimHandle2(uint worldID);
363 553
@@ -368,6 +558,7 @@ public static extern IntPtr GetBodyHandleWorldID2(uint worldID, uint id);
368public static extern IntPtr GetBodyHandle2(IntPtr world, uint id); 558public static extern IntPtr GetBodyHandle2(IntPtr world, uint id);
369 559
370// =============================================================================== 560// ===============================================================================
561// Initialization and simulation
371[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 562[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
372public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms, 563public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms,
373 int maxCollisions, IntPtr collisionArray, 564 int maxCollisions, IntPtr collisionArray,
@@ -377,14 +568,14 @@ public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms,
377public static extern bool UpdateParameter2(IntPtr world, uint localID, String parm, float value); 568public static extern bool UpdateParameter2(IntPtr world, uint localID, String parm, float value);
378 569
379[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 570[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
380public static extern void SetHeightmap2(IntPtr world, float[] heightmap); 571public static extern void SetHeightMap2(IntPtr world, float[] heightmap);
381 572
382[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 573[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
383public static extern void Shutdown2(IntPtr sim); 574public static extern void Shutdown2(IntPtr sim);
384 575
385[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 576[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
386public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep, 577public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep,
387 out int updatedEntityCount, 578 out int updatedEntityCount,
388 out IntPtr updatedEntitiesPtr, 579 out IntPtr updatedEntitiesPtr,
389 out int collidersCount, 580 out int collidersCount,
390 out IntPtr collidersPtr); 581 out IntPtr collidersPtr);
@@ -392,24 +583,87 @@ public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSt
392[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 583[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
393public static extern bool PushUpdate2(IntPtr obj); 584public static extern bool PushUpdate2(IntPtr obj);
394 585
395/* 586// =====================================================================================
587// Mesh, hull, shape and body creation helper routines
588[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
589public static extern IntPtr CreateMeshShape2(IntPtr world,
590 int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices,
591 int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices );
592
593[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
594public static extern IntPtr CreateHullShape2(IntPtr world,
595 int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls);
596
597[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
598public static extern IntPtr BuildHullShapeFromMesh2(IntPtr world, IntPtr meshShape);
599
600[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
601public static extern IntPtr BuildNativeShape2(IntPtr world, ShapeData shapeData);
602
603[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
604public static extern bool IsNativeShape2(IntPtr shape);
605
606[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
607public static extern IntPtr CreateCompoundShape2(IntPtr sim);
608
609[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
610public static extern void AddChildToCompoundShape2(IntPtr cShape, IntPtr addShape, Vector3 pos, Quaternion rot);
611
612[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
613public static extern void RemoveChildFromCompoundShape2(IntPtr cShape, IntPtr removeShape);
614
615[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
616public static extern IntPtr DuplicateCollisionShape2(IntPtr sim, IntPtr srcShape, uint id);
617
618[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
619public static extern IntPtr CreateBodyFromShapeAndInfo2(IntPtr sim, IntPtr shape, uint id, IntPtr constructionInfo);
620
621[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
622public static extern bool DeleteCollisionShape2(IntPtr world, IntPtr shape);
623
624[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
625public static extern int GetBodyType2(IntPtr obj);
626
396[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 627[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
397public static extern IntPtr CreateMesh2(IntPtr world, int indicesCount, int* indices, int verticesCount, float* vertices ); 628public static extern IntPtr CreateBodyFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot);
398 629
399[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 630[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
400public static extern bool BuildHull2(IntPtr world, IntPtr mesh); 631public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, uint id, Vector3 pos, Quaternion rot);
401 632
402[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 633[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
403public static extern bool ReleaseHull2(IntPtr world, IntPtr mesh); 634public static extern IntPtr CreateGhostFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot);
404 635
405[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 636[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
406public static extern bool DestroyMesh2(IntPtr world, IntPtr mesh); 637public static extern IntPtr AllocateBodyInfo2(IntPtr obj);
407 638
408[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 639[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
409public static extern IntPtr CreateObject2(IntPtr world, ShapeData shapeData); 640public static extern void ReleaseBodyInfo2(IntPtr obj);
410*/
411 641
412[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 642[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
643public static extern void DestroyObject2(IntPtr sim, IntPtr obj);
644
645// =====================================================================================
646// Terrain creation and helper routines
647[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
648public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords,
649 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
650
651[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
652public static extern IntPtr FillHeightMapInfo2(IntPtr sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords,
653 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
654
655[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
656public static extern bool ReleaseHeightMapInfo2(IntPtr heightMapInfo);
657
658[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
659public static extern IntPtr CreateGroundPlaneShape2(uint id, float height, float collisionMargin);
660
661[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
662public static extern IntPtr CreateTerrainShape2(IntPtr mapInfo);
663
664// =====================================================================================
665// Constraint creation and helper routines
666[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
413public static extern IntPtr Create6DofConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, 667public static extern IntPtr Create6DofConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2,
414 Vector3 frame1loc, Quaternion frame1rot, 668 Vector3 frame1loc, Quaternion frame1rot,
415 Vector3 frame2loc, Quaternion frame2rot, 669 Vector3 frame2loc, Quaternion frame2rot,
@@ -433,7 +687,7 @@ public static extern void SetConstraintEnable2(IntPtr constrain, float numericTr
433public static extern void SetConstraintNumSolverIterations2(IntPtr constrain, float iterations); 687public static extern void SetConstraintNumSolverIterations2(IntPtr constrain, float iterations);
434 688
435[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 689[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
436public static extern bool SetFrames2(IntPtr constrain, 690public static extern bool SetFrames2(IntPtr constrain,
437 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot); 691 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot);
438 692
439[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 693[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
@@ -460,11 +714,108 @@ public static extern bool SetConstraintParam2(IntPtr constrain, ConstraintParams
460[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 714[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
461public static extern bool DestroyConstraint2(IntPtr world, IntPtr constrain); 715public static extern bool DestroyConstraint2(IntPtr world, IntPtr constrain);
462 716
717// =====================================================================================
718// btCollisionWorld entries
719[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
720public static extern void UpdateSingleAabb2(IntPtr world, IntPtr obj);
721
722[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
723public static extern void UpdateAabbs2(IntPtr world);
724
725[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
726public static extern bool GetForceUpdateAllAabbs2(IntPtr world);
727
728[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
729public static extern void SetForceUpdateAllAabbs2(IntPtr world, bool force);
730
731// =====================================================================================
732// btDynamicsWorld entries
733[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
734public static extern bool AddObjectToWorld2(IntPtr world, IntPtr obj);
735
736[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
737public static extern bool RemoveObjectFromWorld2(IntPtr world, IntPtr obj);
738
739[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
740public static extern bool AddConstraintToWorld2(IntPtr world, IntPtr constrain, bool disableCollisionsBetweenLinkedObjects);
741
742[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
743public static extern bool RemoveConstraintFromWorld2(IntPtr world, IntPtr constrain);
744// =====================================================================================
745// btCollisionObject entries
746[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
747public static extern Vector3 GetAnisotripicFriction2(IntPtr constrain);
748
749[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
750public static extern Vector3 SetAnisotripicFriction2(IntPtr constrain, Vector3 frict);
751
752[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
753public static extern bool HasAnisotripicFriction2(IntPtr constrain);
754
755[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
756public static extern void SetContactProcessingThreshold2(IntPtr obj, float val);
757
758[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
759public static extern float GetContactProcessingThreshold2(IntPtr obj);
760
761[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
762public static extern bool IsStaticObject2(IntPtr obj);
763
764[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
765public static extern bool IsKinematicObject2(IntPtr obj);
766
767[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
768public static extern bool IsStaticOrKinematicObject2(IntPtr obj);
769
770[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
771public static extern bool HasContactResponse2(IntPtr obj);
772
773[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
774public static extern void SetCollisionShape2(IntPtr sim, IntPtr obj, IntPtr shape);
775
776[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
777public static extern IntPtr GetCollisionShape2(IntPtr obj);
778
779[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
780public static extern int GetActivationState2(IntPtr obj);
781
782[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
783public static extern void SetActivationState2(IntPtr obj, int state);
784
785[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
786public static extern void SetDeactivationTime2(IntPtr obj, float dtime);
787
788[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
789public static extern float GetDeactivationTime2(IntPtr obj);
790
791[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
792public static extern void ForceActivationState2(IntPtr obj, ActivationState state);
793
794[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
795public static extern void Activate2(IntPtr obj, bool forceActivation);
796
797[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
798public static extern bool IsActive2(IntPtr obj);
799
800[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
801public static extern void SetRestitution2(IntPtr obj, float val);
802
803[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
804public static extern float GetRestitution2(IntPtr obj);
805
806[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
807public static extern void SetFriction2(IntPtr obj, float val);
808
463[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 809[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
464public static extern Vector3 AddObjectToWorld2(IntPtr world, IntPtr obj); 810public static extern float GetFriction2(IntPtr obj);
465 811
812 /* Haven't defined the type 'Transform'
466[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 813[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
467public static extern Vector3 RemoveObjectFromWorld2(IntPtr world, IntPtr obj); 814public static extern Transform GetWorldTransform2(IntPtr obj);
815
816[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
817public static extern void setWorldTransform2(IntPtr obj, Transform trans);
818 */
468 819
469[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 820[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
470public static extern Vector3 GetPosition2(IntPtr obj); 821public static extern Vector3 GetPosition2(IntPtr obj);
@@ -473,85 +824,290 @@ public static extern Vector3 GetPosition2(IntPtr obj);
473public static extern Quaternion GetOrientation2(IntPtr obj); 824public static extern Quaternion GetOrientation2(IntPtr obj);
474 825
475[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 826[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
476public static extern bool SetTranslation2(IntPtr obj, Vector3 position, Quaternion rotation); 827public static extern void SetTranslation2(IntPtr obj, Vector3 position, Quaternion rotation);
477 828
478[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 829[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
479public static extern bool SetVelocity2(IntPtr obj, Vector3 velocity); 830public static extern IntPtr GetBroadphaseHandle2(IntPtr obj);
480 831
481[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 832[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
482public static extern bool SetAngularVelocity2(IntPtr obj, Vector3 angularVelocity); 833public static extern void SetBroadphaseHandle2(IntPtr obj, IntPtr handle);
483 834
835 /*
484[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 836[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
485public static extern bool SetObjectForce2(IntPtr obj, Vector3 force); 837public static extern Transform GetInterpolationWorldTransform2(IntPtr obj);
486 838
487[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 839[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
488public static extern bool AddObjectForce2(IntPtr obj, Vector3 force); 840public static extern void SetInterpolationWorldTransform2(IntPtr obj, Transform trans);
841 */
489 842
490[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 843[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
491public static extern bool SetCcdMotionThreshold2(IntPtr obj, float val); 844public static extern void SetInterpolationLinearVelocity2(IntPtr obj, Vector3 vel);
492 845
493[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 846[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
494public static extern bool SetCcdSweepSphereRadius2(IntPtr obj, float val); 847public static extern void SetInterpolationAngularVelocity2(IntPtr obj, Vector3 vel);
495 848
496[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 849[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
497public static extern bool SetDamping2(IntPtr obj, float lin_damping, float ang_damping); 850public static extern void SetInterpolationVelocity2(IntPtr obj, Vector3 linearVel, Vector3 angularVel);
498 851
499[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 852[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
500public static extern bool SetDeactivationTime2(IntPtr obj, float val); 853public static extern float GetHitFraction2(IntPtr obj);
501 854
502[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 855[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
503public static extern bool SetSleepingThresholds2(IntPtr obj, float lin_threshold, float ang_threshold); 856public static extern void SetHitFraction2(IntPtr obj, float val);
504 857
505[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 858[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
506public static extern bool SetContactProcessingThreshold2(IntPtr obj, float val); 859public static extern CollisionFlags GetCollisionFlags2(IntPtr obj);
507 860
508[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 861[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
509public static extern bool SetFriction2(IntPtr obj, float val); 862public static extern CollisionFlags SetCollisionFlags2(IntPtr obj, CollisionFlags flags);
510 863
511[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 864[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
512public static extern bool SetRestitution2(IntPtr obj, float val); 865public static extern CollisionFlags AddToCollisionFlags2(IntPtr obj, CollisionFlags flags);
513 866
514[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 867[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
515public static extern bool SetLinearVelocity2(IntPtr obj, Vector3 val); 868public static extern CollisionFlags RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags);
516 869
517[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 870[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
518public static extern bool SetInterpolation2(IntPtr obj, Vector3 lin, Vector3 ang); 871public static extern float GetCcdMotionThreshold2(IntPtr obj);
519 872
520[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 873[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
521public static extern CollisionFlags GetCollisionFlags2(IntPtr obj); 874public static extern void SetCcdMotionThreshold2(IntPtr obj, float val);
875
876[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
877public static extern float GetCcdSweepSphereRadius2(IntPtr obj);
878
879[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
880public static extern void SetCcdSweepSphereRadius2(IntPtr obj, float val);
881
882[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
883public static extern IntPtr GetUserPointer2(IntPtr obj);
884
885[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
886public static extern void SetUserPointer2(IntPtr obj, IntPtr val);
887
888// =====================================================================================
889// btRigidBody entries
890[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
891public static extern void ApplyGravity2(IntPtr obj);
892
893[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
894public static extern void SetGravity2(IntPtr obj, Vector3 val);
895
896[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
897public static extern Vector3 GetGravity2(IntPtr obj);
898
899[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
900public static extern void SetDamping2(IntPtr obj, float lin_damping, float ang_damping);
901
902[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
903public static extern float GetLinearDamping2(IntPtr obj);
904
905[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
906public static extern float GetAngularDamping2(IntPtr obj);
907
908[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
909public static extern float GetLinearSleepingThreshold2(IntPtr obj);
910
911[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
912public static extern float GetAngularSleepingThreshold2(IntPtr obj);
913
914[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
915public static extern void ApplyDamping2(IntPtr obj, float timeStep);
916
917[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
918public static extern void SetMassProps2(IntPtr obj, float mass, Vector3 inertia);
919
920[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
921public static extern Vector3 GetLinearFactor2(IntPtr obj);
922
923[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
924public static extern void SetLinearFactor2(IntPtr obj, Vector3 factor);
925
926 /*
927[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
928public static extern void SetCenterOfMassTransform2(IntPtr obj, Transform trans);
929 */
930
931[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
932public static extern void SetCenterOfMassByPosRot2(IntPtr obj, Vector3 pos, Quaternion rot);
933
934// Add a force to the object as if its mass is one.
935[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
936public static extern void ApplyCentralForce2(IntPtr obj, Vector3 force);
937
938// Set the force being applied to the object as if its mass is one.
939[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
940public static extern void SetObjectForce2(IntPtr obj, Vector3 force);
941
942[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
943public static extern Vector3 GetTotalForce2(IntPtr obj);
944
945[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
946public static extern Vector3 GetTotalTorque2(IntPtr obj);
947
948[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
949public static extern Vector3 GetInvInertiaDiagLocal2(IntPtr obj);
950
951[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
952public static extern void SetInvInertiaDiagLocal2(IntPtr obj, Vector3 inert);
953
954[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
955public static extern void SetSleepingThresholds2(IntPtr obj, float lin_threshold, float ang_threshold);
956
957[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
958public static extern void ApplyTorque2(IntPtr obj, Vector3 torque);
959
960// Apply force at the given point. Will add torque to the object.
961[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
962public static extern void ApplyForce2(IntPtr obj, Vector3 force, Vector3 pos);
963
964// Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass.
965[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
966public static extern void ApplyCentralImpulse2(IntPtr obj, Vector3 imp);
967
968// Apply impulse to the object's torque. Force is scaled by object's mass.
969[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
970public static extern void ApplyTorqueImpulse2(IntPtr obj, Vector3 imp);
971
972// Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces.
973[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
974public static extern void ApplyImpulse2(IntPtr obj, Vector3 imp, Vector3 pos);
975
976[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
977public static extern void ClearForces2(IntPtr obj);
978
979[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
980public static extern void ClearAllForces2(IntPtr obj);
981
982[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
983public static extern void UpdateInertiaTensor2(IntPtr obj);
984
985[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
986public static extern Vector3 GetCenterOfMassPosition2(IntPtr obj);
987
988 /*
989[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
990public static extern Transform GetCenterOfMassTransform2(IntPtr obj);
991 */
992
993[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
994public static extern Vector3 GetLinearVelocity2(IntPtr obj);
995
996[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
997public static extern Vector3 GetAngularVelocity2(IntPtr obj);
998
999[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1000public static extern void SetLinearVelocity2(IntPtr obj, Vector3 val);
1001
1002[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1003public static extern void SetAngularVelocity2(IntPtr obj, Vector3 angularVelocity);
1004
1005[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1006public static extern Vector3 GetVelocityInLocalPoint2(IntPtr obj, Vector3 pos);
1007
1008[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1009public static extern void Translate2(IntPtr obj, Vector3 trans);
1010
1011[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1012public static extern void UpdateDeactivation2(IntPtr obj, float timeStep);
1013
1014[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1015public static extern bool WantsSleeping2(IntPtr obj);
1016
1017[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1018public static extern void SetAngularFactor2(IntPtr obj, float factor);
1019
1020[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1021public static extern void SetAngularFactorV2(IntPtr obj, Vector3 factor);
1022
1023[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1024public static extern Vector3 GetAngularFactor2(IntPtr obj);
1025
1026[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1027public static extern bool IsInWorld2(IntPtr obj);
1028
1029[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1030public static extern void AddConstraintRef2(IntPtr obj, IntPtr constrain);
1031
1032[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1033public static extern void RemoveConstraintRef2(IntPtr obj, IntPtr constrain);
1034
1035[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1036public static extern IntPtr GetConstraintRef2(IntPtr obj, int index);
1037
1038[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1039public static extern int GetNumConstraintRefs2(IntPtr obj);
1040
1041[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1042public static extern void SetCollisionFilterMask2(IntPtr body, uint filter, uint mask);
1043
1044// =====================================================================================
1045// btCollisionShape entries
1046
1047[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1048public static extern float GetAngularMotionDisc2(IntPtr shape);
1049
1050[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1051public static extern float GetContactBreakingThreshold2(IntPtr shape, float defaultFactor);
1052
1053[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1054public static extern bool IsPolyhedral2(IntPtr shape);
1055
1056[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1057public static extern bool IsConvex2d2(IntPtr shape);
1058
1059[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1060public static extern bool IsConvex2(IntPtr shape);
1061
1062[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1063public static extern bool IsNonMoving2(IntPtr shape);
1064
1065[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1066public static extern bool IsConcave2(IntPtr shape);
1067
1068[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1069public static extern bool IsCompound2(IntPtr shape);
1070
1071[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1072public static extern bool IsSoftBody2(IntPtr shape);
1073
1074[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1075public static extern bool IsInfinite2(IntPtr shape);
522 1076
523[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1077[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
524public static extern IntPtr SetCollisionFlags2(IntPtr obj, CollisionFlags flags); 1078public static extern void SetLocalScaling2(IntPtr shape, Vector3 scale);
525 1079
526[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1080[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
527public static extern IntPtr AddToCollisionFlags2(IntPtr obj, CollisionFlags flags); 1081public static extern Vector3 GetLocalScaling2(IntPtr shape);
528 1082
529[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1083[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
530public static extern IntPtr RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags); 1084public static extern Vector3 CalculateLocalInertia2(IntPtr shape, float mass);
531 1085
532[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1086[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
533public static extern bool SetMassProps2(IntPtr obj, float mass, Vector3 inertia); 1087public static extern int GetShapeType2(IntPtr shape);
534 1088
535[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1089[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
536public static extern bool UpdateInertiaTensor2(IntPtr obj); 1090public static extern void SetMargin2(IntPtr shape, float val);
537 1091
538[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1092[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
539public static extern bool SetGravity2(IntPtr obj, Vector3 val); 1093public static extern float GetMargin2(IntPtr shape);
540 1094
1095// =====================================================================================
1096// Debugging
541[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1097[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
542public static extern IntPtr ClearForces2(IntPtr obj); 1098public static extern void DumpRigidBody2(IntPtr sim, IntPtr collisionObject);
543 1099
544[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1100[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
545public static extern IntPtr ClearAllForces2(IntPtr obj); 1101public static extern void DumpCollisionShape2(IntPtr sim, IntPtr collisionShape);
546 1102
547[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1103[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
548public static extern bool SetMargin2(IntPtr obj, float val); 1104public static extern void DumpConstraint2(IntPtr sim, IntPtr constrain);
549 1105
550[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1106[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
551public static extern bool UpdateSingleAabb2(IntPtr world, IntPtr obj); 1107public static extern void DumpAllInfo2(IntPtr sim);
552 1108
553[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1109[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
554public static extern bool DestroyObject2(IntPtr world, uint id); 1110public static extern void DumpMapInfo2(IntPtr sim, IntPtr manInfo);
555 1111
556[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1112[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
557public static extern void DumpPhysicsStatistics2(IntPtr sim); 1113public static extern void DumpPhysicsStatistics2(IntPtr sim);