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.cs748
1 files changed, 666 insertions, 82 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
index 504bd3c..07149d8 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 }
50} 84}
51 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 }
120}
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,11 @@ 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,
197 SHAPE_COMPOUND = 22,
79 }; 198 };
80 public uint ID; 199 public uint ID;
81 public PhysicsShapeType Type; 200 public PhysicsShapeType Type;
@@ -91,13 +210,25 @@ public struct ShapeData
91 public float Restitution; 210 public float Restitution;
92 public float Collidable; // true of things bump into this 211 public float Collidable; // true of things bump into this
93 public float Static; // true if a static object. Otherwise gravity, etc. 212 public float Static; // true if a static object. Otherwise gravity, etc.
213 public float Solid; // true if object cannot be passed through
214 public Vector3 Size;
94 215
95 // note that bools are passed as floats since bool size changes by language and architecture 216 // note that bools are passed as floats since bool size changes by language and architecture
96 public const float numericTrue = 1f; 217 public const float numericTrue = 1f;
97 public const float numericFalse = 0f; 218 public const float numericFalse = 0f;
219
220 // The native shapes have predefined shape hash keys
221 public enum FixedShapeKey : ulong
222 {
223 KEY_BOX = 1,
224 KEY_SPHERE = 2,
225 KEY_CONE = 3,
226 KEY_CYLINDER = 4,
227 KEY_CAPSULE = 5,
228 }
98} 229}
99[StructLayout(LayoutKind.Sequential)] 230[StructLayout(LayoutKind.Sequential)]
100public struct SweepHit 231public struct SweepHit
101{ 232{
102 public uint ID; 233 public uint ID;
103 public float Fraction; 234 public float Fraction;
@@ -153,6 +284,7 @@ public struct ConfigurationParameters
153 public float terrainHitFraction; 284 public float terrainHitFraction;
154 public float terrainRestitution; 285 public float terrainRestitution;
155 public float avatarFriction; 286 public float avatarFriction;
287 public float avatarStandingFriction;
156 public float avatarDensity; 288 public float avatarDensity;
157 public float avatarRestitution; 289 public float avatarRestitution;
158 public float avatarCapsuleRadius; 290 public float avatarCapsuleRadius;
@@ -168,18 +300,45 @@ public struct ConfigurationParameters
168 public float shouldEnableFrictionCaching; 300 public float shouldEnableFrictionCaching;
169 public float numberOfSolverIterations; 301 public float numberOfSolverIterations;
170 302
303 public float linksetImplementation;
171 public float linkConstraintUseFrameOffset; 304 public float linkConstraintUseFrameOffset;
172 public float linkConstraintEnableTransMotor; 305 public float linkConstraintEnableTransMotor;
173 public float linkConstraintTransMotorMaxVel; 306 public float linkConstraintTransMotorMaxVel;
174 public float linkConstraintTransMotorMaxForce; 307 public float linkConstraintTransMotorMaxForce;
175 public float linkConstraintERP; 308 public float linkConstraintERP;
176 public float linkConstraintCFM; 309 public float linkConstraintCFM;
310 public float linkConstraintSolverIterations;
311
312 public float physicsLoggingFrames;
177 313
178 public const float numericTrue = 1f; 314 public const float numericTrue = 1f;
179 public const float numericFalse = 0f; 315 public const float numericFalse = 0f;
180} 316}
181 317
182// Values used by Bullet and BulletSim to control collisions 318
319// The states a bullet collision object can have
320public enum ActivationState : uint
321{
322 ACTIVE_TAG = 1,
323 ISLAND_SLEEPING,
324 WANTS_DEACTIVATION,
325 DISABLE_DEACTIVATION,
326 DISABLE_SIMULATION,
327}
328
329public enum CollisionObjectTypes : int
330{
331 CO_COLLISION_OBJECT = 1 << 0,
332 CO_RIGID_BODY = 1 << 1,
333 CO_GHOST_OBJECT = 1 << 2,
334 CO_SOFT_BODY = 1 << 3,
335 CO_HF_FLUID = 1 << 4,
336 CO_USER_TYPE = 1 << 5,
337}
338
339// Values used by Bullet and BulletSim to control object properties.
340// Bullet's "CollisionFlags" has more to do with operations on the
341// object (if collisions happen, if gravity effects it, ...).
183public enum CollisionFlags : uint 342public enum CollisionFlags : uint
184{ 343{
185 CF_STATIC_OBJECT = 1 << 0, 344 CF_STATIC_OBJECT = 1 << 0,
@@ -191,9 +350,54 @@ public enum CollisionFlags : uint
191 CF_DISABLE_SPU_COLLISION_PROCESS = 1 << 6, 350 CF_DISABLE_SPU_COLLISION_PROCESS = 1 << 6,
192 // Following used by BulletSim to control collisions 351 // Following used by BulletSim to control collisions
193 BS_SUBSCRIBE_COLLISION_EVENTS = 1 << 10, 352 BS_SUBSCRIBE_COLLISION_EVENTS = 1 << 10,
194 BS_VOLUME_DETECT_OBJECT = 1 << 11, 353 BS_FLOATS_ON_WATER = 1 << 11,
195 BS_PHANTOM_OBJECT = 1 << 12, 354 BS_NONE = 0,
196 BS_PHYSICAL_OBJECT = 1 << 13, 355 BS_ALL = 0xFFFFFFFF,
356
357 // These are the collision flags switched depending on physical state.
358 // The other flags are used for other things and should not be fooled with.
359 BS_ACTIVE = CF_STATIC_OBJECT
360 | CF_KINEMATIC_OBJECT
361 | CF_NO_CONTACT_RESPONSE
362};
363
364// Values for collisions groups and masks
365public enum CollisionFilterGroups : uint
366{
367 // Don't use the bit definitions!! Define the use in a
368 // filter/mask definition below. This way collision interactions
369 // are more easily debugged.
370 BNoneFilter = 0,
371 BDefaultFilter = 1 << 0,
372 BStaticFilter = 1 << 1,
373 BKinematicFilter = 1 << 2,
374 BDebrisFilter = 1 << 3,
375 BSensorTrigger = 1 << 4,
376 BCharacterFilter = 1 << 5,
377 BAllFilter = 0xFFFFFFFF,
378 // Filter groups defined by BulletSim
379 BGroundPlaneFilter = 1 << 10,
380 BTerrainFilter = 1 << 11,
381 BRaycastFilter = 1 << 12,
382 BSolidFilter = 1 << 13,
383 BLinksetFilter = 1 << 14,
384
385 // The collsion filters and masked are defined in one place -- don't want them scattered
386 AvatarFilter = BCharacterFilter,
387 AvatarMask = BAllFilter,
388 ObjectFilter = BSolidFilter,
389 ObjectMask = BAllFilter,
390 StaticObjectFilter = BStaticFilter,
391 StaticObjectMask = BAllFilter,
392 LinksetFilter = BLinksetFilter,
393 LinksetMask = BAllFilter & ~BLinksetFilter,
394 VolumeDetectFilter = BSensorTrigger,
395 VolumeDetectMask = ~BSensorTrigger,
396 TerrainFilter = BTerrainFilter,
397 TerrainMask = BAllFilter & ~BStaticFilter,
398 GroundPlaneFilter = BGroundPlaneFilter,
399 GroundPlaneMask = BAllFilter
400
197}; 401};
198 402
199// CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0 403// CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0
@@ -221,14 +425,23 @@ public enum ConstraintParamAxis : int
221// =============================================================================== 425// ===============================================================================
222static class BulletSimAPI { 426static class BulletSimAPI {
223 427
428// Link back to the managed code for outputting log messages
429[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
430public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg);
431
224[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 432[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
225[return: MarshalAs(UnmanagedType.LPStr)] 433[return: MarshalAs(UnmanagedType.LPStr)]
226public static extern string GetVersion(); 434public static extern string GetVersion();
227 435
436/* Remove the linkage to the old api methods
437[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
438public static extern uint Initialize(Vector3 maxPosition, IntPtr parms,
439 int maxCollisions, IntPtr collisionArray,
440 int maxUpdates, IntPtr updateArray,
441 DebugLogCallback logRoutine);
442
228[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 443[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
229public static extern uint Initialize(Vector3 maxPosition, IntPtr parms, 444public static extern void CreateInitialGroundPlaneAndTerrain(uint worldID);
230 int maxCollisions, IntPtr collisionArray,
231 int maxUpdates, IntPtr updateArray);
232 445
233[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 446[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
234public static extern void SetHeightmap(uint worldID, [MarshalAs(UnmanagedType.LPArray)] float[] heightMap); 447public static extern void SetHeightmap(uint worldID, [MarshalAs(UnmanagedType.LPArray)] float[] heightMap);
@@ -242,19 +455,19 @@ public static extern bool UpdateParameter(uint worldID, uint localID,
242 455
243// =============================================================================== 456// ===============================================================================
244[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 457[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
245public static extern int PhysicsStep(uint worldID, float timeStep, int maxSubSteps, float fixedTimeStep, 458public static extern int PhysicsStep(uint worldID, float timeStep, int maxSubSteps, float fixedTimeStep,
246 out int updatedEntityCount, 459 out int updatedEntityCount,
247 out IntPtr updatedEntitiesPtr, 460 out IntPtr updatedEntitiesPtr,
248 out int collidersCount, 461 out int collidersCount,
249 out IntPtr collidersPtr); 462 out IntPtr collidersPtr);
250 463
251[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 464[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
252public static extern bool CreateHull(uint worldID, System.UInt64 meshKey, 465public static extern bool CreateHull(uint worldID, System.UInt64 meshKey,
253 int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls 466 int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls
254 ); 467 );
255 468
256[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 469[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
257public static extern bool CreateMesh(uint worldID, System.UInt64 meshKey, 470public static extern bool CreateMesh(uint worldID, System.UInt64 meshKey,
258 int indexCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices, 471 int indexCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices,
259 int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices 472 int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices
260 ); 473 );
@@ -268,23 +481,6 @@ public static extern bool DestroyMesh(uint worldID, System.UInt64 meshKey);
268[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 481[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
269public static extern bool CreateObject(uint worldID, ShapeData shapeData); 482public static extern bool CreateObject(uint worldID, ShapeData shapeData);
270 483
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] 484[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
289public static extern Vector3 GetObjectPosition(uint WorldID, uint id); 485public static extern Vector3 GetObjectPosition(uint WorldID, uint id);
290 486
@@ -300,6 +496,7 @@ public static extern bool SetObjectVelocity(uint worldID, uint id, Vector3 veloc
300[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 496[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
301public static extern bool SetObjectAngularVelocity(uint worldID, uint id, Vector3 angularVelocity); 497public static extern bool SetObjectAngularVelocity(uint worldID, uint id, Vector3 angularVelocity);
302 498
499// Set the current force acting on the object
303[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 500[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
304public static extern bool SetObjectForce(uint worldID, uint id, Vector3 force); 501public static extern bool SetObjectForce(uint worldID, uint id, Vector3 force);
305 502
@@ -340,10 +537,8 @@ public static extern Vector3 RecoverFromPenetration(uint worldID, uint id);
340// =============================================================================== 537// ===============================================================================
341[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 538[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
342public static extern void DumpBulletStatistics(); 539public static extern void DumpBulletStatistics();
343 540*/
344// Log a debug message 541// Log a debug message
345[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
346public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg);
347[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 542[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
348public static extern void SetDebugLogCallback(DebugLogCallback callback); 543public static extern void SetDebugLogCallback(DebugLogCallback callback);
349 544
@@ -358,6 +553,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 553// The names have a "2" tacked on. This will be removed as the C# code gets rebuilt
359// and the old code is removed. 554// and the old code is removed.
360 555
556// Functions use while converting from API1 to API2. Can be removed when totally converted.
361[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 557[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
362public static extern IntPtr GetSimHandle2(uint worldID); 558public static extern IntPtr GetSimHandle2(uint worldID);
363 559
@@ -368,23 +564,25 @@ public static extern IntPtr GetBodyHandleWorldID2(uint worldID, uint id);
368public static extern IntPtr GetBodyHandle2(IntPtr world, uint id); 564public static extern IntPtr GetBodyHandle2(IntPtr world, uint id);
369 565
370// =============================================================================== 566// ===============================================================================
567// Initialization and simulation
371[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 568[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
372public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms, 569public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms,
373 int maxCollisions, IntPtr collisionArray, 570 int maxCollisions, IntPtr collisionArray,
374 int maxUpdates, IntPtr updateArray); 571 int maxUpdates, IntPtr updateArray,
572 DebugLogCallback logRoutine);
375 573
376[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 574[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
377public static extern bool UpdateParameter2(IntPtr world, uint localID, String parm, float value); 575public static extern bool UpdateParameter2(IntPtr world, uint localID, String parm, float value);
378 576
379[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 577[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
380public static extern void SetHeightmap2(IntPtr world, float[] heightmap); 578public static extern void SetHeightMap2(IntPtr world, float[] heightmap);
381 579
382[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 580[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
383public static extern void Shutdown2(IntPtr sim); 581public static extern void Shutdown2(IntPtr sim);
384 582
385[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 583[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
386public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep, 584public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep,
387 out int updatedEntityCount, 585 out int updatedEntityCount,
388 out IntPtr updatedEntitiesPtr, 586 out IntPtr updatedEntitiesPtr,
389 out int collidersCount, 587 out int collidersCount,
390 out IntPtr collidersPtr); 588 out IntPtr collidersPtr);
@@ -392,24 +590,102 @@ public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSt
392[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 590[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
393public static extern bool PushUpdate2(IntPtr obj); 591public static extern bool PushUpdate2(IntPtr obj);
394 592
395/* 593// =====================================================================================
594// Mesh, hull, shape and body creation helper routines
396[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 595[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
397public static extern IntPtr CreateMesh2(IntPtr world, int indicesCount, int* indices, int verticesCount, float* vertices ); 596public static extern IntPtr CreateMeshShape2(IntPtr world,
597 int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices,
598 int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices );
398 599
399[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 600[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
400public static extern bool BuildHull2(IntPtr world, IntPtr mesh); 601public static extern IntPtr CreateHullShape2(IntPtr world,
602 int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls);
401 603
402[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 604[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
403public static extern bool ReleaseHull2(IntPtr world, IntPtr mesh); 605public static extern IntPtr BuildHullShapeFromMesh2(IntPtr world, IntPtr meshShape);
404 606
405[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 607[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
406public static extern bool DestroyMesh2(IntPtr world, IntPtr mesh); 608public static extern IntPtr BuildNativeShape2(IntPtr world, ShapeData shapeData);
407 609
408[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 610[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
409public static extern IntPtr CreateObject2(IntPtr world, ShapeData shapeData); 611public static extern bool IsNativeShape2(IntPtr shape);
410*/ 612
613[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
614public static extern IntPtr BuildCapsuleShape2(IntPtr world, float radius, float height, Vector3 scale);
615
616[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
617public static extern IntPtr CreateCompoundShape2(IntPtr sim, bool enableDynamicAabbTree);
618
619[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
620public static extern int GetNumberOfCompoundChildren2(IntPtr cShape);
621
622[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
623public static extern void AddChildShapeToCompoundShape2(IntPtr cShape, IntPtr addShape, Vector3 pos, Quaternion rot);
624
625[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
626public static extern IntPtr GetChildShapeFromCompoundShapeIndex2(IntPtr cShape, int indx);
627
628[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
629public static extern IntPtr RemoveChildShapeFromCompoundShapeIndex2(IntPtr cShape, int indx);
630
631[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
632public static extern void RemoveChildShapeFromCompoundShape2(IntPtr cShape, IntPtr removeShape);
633
634[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
635public static extern void RecalculateCompoundShapeLocalAabb2(IntPtr cShape);
636
637[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
638public static extern IntPtr DuplicateCollisionShape2(IntPtr sim, IntPtr srcShape, uint id);
411 639
412[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 640[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
641public static extern IntPtr CreateBodyFromShapeAndInfo2(IntPtr sim, IntPtr shape, uint id, IntPtr constructionInfo);
642
643[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
644public static extern bool DeleteCollisionShape2(IntPtr world, IntPtr shape);
645
646[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
647public static extern int GetBodyType2(IntPtr obj);
648
649[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
650public static extern IntPtr CreateBodyFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot);
651
652[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
653public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, uint id, Vector3 pos, Quaternion rot);
654
655[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
656public static extern IntPtr CreateGhostFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot);
657
658[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
659public static extern IntPtr AllocateBodyInfo2(IntPtr obj);
660
661[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
662public static extern void ReleaseBodyInfo2(IntPtr obj);
663
664[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
665public static extern void DestroyObject2(IntPtr sim, IntPtr obj);
666
667// =====================================================================================
668// Terrain creation and helper routines
669[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
670public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords,
671 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
672
673[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
674public static extern IntPtr FillHeightMapInfo2(IntPtr sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords,
675 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
676
677[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
678public static extern bool ReleaseHeightMapInfo2(IntPtr heightMapInfo);
679
680[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
681public static extern IntPtr CreateGroundPlaneShape2(uint id, float height, float collisionMargin);
682
683[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
684public static extern IntPtr CreateTerrainShape2(IntPtr mapInfo);
685
686// =====================================================================================
687// Constraint creation and helper routines
688[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
413public static extern IntPtr Create6DofConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, 689public static extern IntPtr Create6DofConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2,
414 Vector3 frame1loc, Quaternion frame1rot, 690 Vector3 frame1loc, Quaternion frame1rot,
415 Vector3 frame2loc, Quaternion frame2rot, 691 Vector3 frame2loc, Quaternion frame2rot,
@@ -433,7 +709,7 @@ public static extern void SetConstraintEnable2(IntPtr constrain, float numericTr
433public static extern void SetConstraintNumSolverIterations2(IntPtr constrain, float iterations); 709public static extern void SetConstraintNumSolverIterations2(IntPtr constrain, float iterations);
434 710
435[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 711[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
436public static extern bool SetFrames2(IntPtr constrain, 712public static extern bool SetFrames2(IntPtr constrain,
437 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot); 713 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot);
438 714
439[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 715[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
@@ -460,11 +736,108 @@ public static extern bool SetConstraintParam2(IntPtr constrain, ConstraintParams
460[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 736[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
461public static extern bool DestroyConstraint2(IntPtr world, IntPtr constrain); 737public static extern bool DestroyConstraint2(IntPtr world, IntPtr constrain);
462 738
739// =====================================================================================
740// btCollisionWorld entries
741[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
742public static extern void UpdateSingleAabb2(IntPtr world, IntPtr obj);
743
744[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
745public static extern void UpdateAabbs2(IntPtr world);
746
747[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
748public static extern bool GetForceUpdateAllAabbs2(IntPtr world);
749
750[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
751public static extern void SetForceUpdateAllAabbs2(IntPtr world, bool force);
752
753// =====================================================================================
754// btDynamicsWorld entries
755[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
756public static extern bool AddObjectToWorld2(IntPtr world, IntPtr obj);
757
758[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
759public static extern bool RemoveObjectFromWorld2(IntPtr world, IntPtr obj);
760
761[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
762public static extern bool AddConstraintToWorld2(IntPtr world, IntPtr constrain, bool disableCollisionsBetweenLinkedObjects);
763
764[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
765public static extern bool RemoveConstraintFromWorld2(IntPtr world, IntPtr constrain);
766// =====================================================================================
767// btCollisionObject entries
768[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
769public static extern Vector3 GetAnisotripicFriction2(IntPtr constrain);
770
771[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
772public static extern Vector3 SetAnisotripicFriction2(IntPtr constrain, Vector3 frict);
773
774[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
775public static extern bool HasAnisotripicFriction2(IntPtr constrain);
776
777[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
778public static extern void SetContactProcessingThreshold2(IntPtr obj, float val);
779
780[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
781public static extern float GetContactProcessingThreshold2(IntPtr obj);
782
783[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
784public static extern bool IsStaticObject2(IntPtr obj);
785
786[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
787public static extern bool IsKinematicObject2(IntPtr obj);
788
789[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
790public static extern bool IsStaticOrKinematicObject2(IntPtr obj);
791
792[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
793public static extern bool HasContactResponse2(IntPtr obj);
794
795[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
796public static extern void SetCollisionShape2(IntPtr sim, IntPtr obj, IntPtr shape);
797
798[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
799public static extern IntPtr GetCollisionShape2(IntPtr obj);
800
801[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
802public static extern int GetActivationState2(IntPtr obj);
803
804[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
805public static extern void SetActivationState2(IntPtr obj, int state);
806
807[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
808public static extern void SetDeactivationTime2(IntPtr obj, float dtime);
809
810[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
811public static extern float GetDeactivationTime2(IntPtr obj);
812
463[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 813[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
464public static extern Vector3 AddObjectToWorld2(IntPtr world, IntPtr obj); 814public static extern void ForceActivationState2(IntPtr obj, ActivationState state);
465 815
466[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 816[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
467public static extern Vector3 RemoveObjectFromWorld2(IntPtr world, IntPtr obj); 817public static extern void Activate2(IntPtr obj, bool forceActivation);
818
819[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
820public static extern bool IsActive2(IntPtr obj);
821
822[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
823public static extern void SetRestitution2(IntPtr obj, float val);
824
825[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
826public static extern float GetRestitution2(IntPtr obj);
827
828[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
829public static extern void SetFriction2(IntPtr obj, float val);
830
831[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
832public static extern float GetFriction2(IntPtr obj);
833
834 /* Haven't defined the type 'Transform'
835[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
836public static extern Transform GetWorldTransform2(IntPtr obj);
837
838[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
839public static extern void setWorldTransform2(IntPtr obj, Transform trans);
840 */
468 841
469[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 842[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
470public static extern Vector3 GetPosition2(IntPtr obj); 843public static extern Vector3 GetPosition2(IntPtr obj);
@@ -473,85 +846,296 @@ public static extern Vector3 GetPosition2(IntPtr obj);
473public static extern Quaternion GetOrientation2(IntPtr obj); 846public static extern Quaternion GetOrientation2(IntPtr obj);
474 847
475[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 848[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
476public static extern bool SetTranslation2(IntPtr obj, Vector3 position, Quaternion rotation); 849public static extern void SetTranslation2(IntPtr obj, Vector3 position, Quaternion rotation);
477 850
478[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 851[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
479public static extern bool SetVelocity2(IntPtr obj, Vector3 velocity); 852public static extern IntPtr GetBroadphaseHandle2(IntPtr obj);
480 853
481[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 854[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
482public static extern bool SetAngularVelocity2(IntPtr obj, Vector3 angularVelocity); 855public static extern void SetBroadphaseHandle2(IntPtr obj, IntPtr handle);
483 856
857 /*
484[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 858[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
485public static extern bool SetObjectForce2(IntPtr obj, Vector3 force); 859public static extern Transform GetInterpolationWorldTransform2(IntPtr obj);
486 860
487[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 861[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
488public static extern bool AddObjectForce2(IntPtr obj, Vector3 force); 862public static extern void SetInterpolationWorldTransform2(IntPtr obj, Transform trans);
863 */
489 864
490[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 865[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
491public static extern bool SetCcdMotionThreshold2(IntPtr obj, float val); 866public static extern void SetInterpolationLinearVelocity2(IntPtr obj, Vector3 vel);
492 867
493[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 868[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
494public static extern bool SetCcdSweepSphereRadius2(IntPtr obj, float val); 869public static extern void SetInterpolationAngularVelocity2(IntPtr obj, Vector3 vel);
495 870
496[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 871[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
497public static extern bool SetDamping2(IntPtr obj, float lin_damping, float ang_damping); 872public static extern void SetInterpolationVelocity2(IntPtr obj, Vector3 linearVel, Vector3 angularVel);
498 873
499[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 874[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
500public static extern bool SetDeactivationTime2(IntPtr obj, float val); 875public static extern float GetHitFraction2(IntPtr obj);
501 876
502[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 877[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
503public static extern bool SetSleepingThresholds2(IntPtr obj, float lin_threshold, float ang_threshold); 878public static extern void SetHitFraction2(IntPtr obj, float val);
504 879
505[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 880[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
506public static extern bool SetContactProcessingThreshold2(IntPtr obj, float val); 881public static extern CollisionFlags GetCollisionFlags2(IntPtr obj);
507 882
508[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 883[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
509public static extern bool SetFriction2(IntPtr obj, float val); 884public static extern CollisionFlags SetCollisionFlags2(IntPtr obj, CollisionFlags flags);
510 885
511[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 886[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
512public static extern bool SetRestitution2(IntPtr obj, float val); 887public static extern CollisionFlags AddToCollisionFlags2(IntPtr obj, CollisionFlags flags);
513 888
514[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 889[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
515public static extern bool SetLinearVelocity2(IntPtr obj, Vector3 val); 890public static extern CollisionFlags RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags);
516 891
517[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 892[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
518public static extern bool SetInterpolation2(IntPtr obj, Vector3 lin, Vector3 ang); 893public static extern float GetCcdMotionThreshold2(IntPtr obj);
519 894
520[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 895[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
521public static extern CollisionFlags GetCollisionFlags2(IntPtr obj); 896public static extern void SetCcdMotionThreshold2(IntPtr obj, float val);
897
898[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
899public static extern float GetCcdSweptSphereRadius2(IntPtr obj);
900
901[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
902public static extern void SetCcdSweptSphereRadius2(IntPtr obj, float val);
903
904[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
905public static extern IntPtr GetUserPointer2(IntPtr obj);
906
907[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
908public static extern void SetUserPointer2(IntPtr obj, IntPtr val);
909
910// =====================================================================================
911// btRigidBody entries
912[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
913public static extern void ApplyGravity2(IntPtr obj);
914
915[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
916public static extern void SetGravity2(IntPtr obj, Vector3 val);
917
918[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
919public static extern Vector3 GetGravity2(IntPtr obj);
920
921[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
922public static extern void SetDamping2(IntPtr obj, float lin_damping, float ang_damping);
923
924[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
925public static extern void SetLinearDamping2(IntPtr obj, float lin_damping);
926
927[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
928public static extern void SetAngularDamping2(IntPtr obj, float ang_damping);
929
930[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
931public static extern float GetLinearDamping2(IntPtr obj);
932
933[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
934public static extern float GetAngularDamping2(IntPtr obj);
935
936[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
937public static extern float GetLinearSleepingThreshold2(IntPtr obj);
938
939[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
940public static extern float GetAngularSleepingThreshold2(IntPtr obj);
941
942[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
943public static extern void ApplyDamping2(IntPtr obj, float timeStep);
944
945[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
946public static extern void SetMassProps2(IntPtr obj, float mass, Vector3 inertia);
947
948[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
949public static extern Vector3 GetLinearFactor2(IntPtr obj);
950
951[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
952public static extern void SetLinearFactor2(IntPtr obj, Vector3 factor);
953
954 /*
955[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
956public static extern void SetCenterOfMassTransform2(IntPtr obj, Transform trans);
957 */
958
959[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
960public static extern void SetCenterOfMassByPosRot2(IntPtr obj, Vector3 pos, Quaternion rot);
961
962// Add a force to the object as if its mass is one.
963[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
964public static extern void ApplyCentralForce2(IntPtr obj, Vector3 force);
965
966// Set the force being applied to the object as if its mass is one.
967[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
968public static extern void SetObjectForce2(IntPtr obj, Vector3 force);
969
970[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
971public static extern Vector3 GetTotalForce2(IntPtr obj);
972
973[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
974public static extern Vector3 GetTotalTorque2(IntPtr obj);
975
976[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
977public static extern Vector3 GetInvInertiaDiagLocal2(IntPtr obj);
978
979[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
980public static extern void SetInvInertiaDiagLocal2(IntPtr obj, Vector3 inert);
981
982[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
983public static extern void SetSleepingThresholds2(IntPtr obj, float lin_threshold, float ang_threshold);
984
985[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
986public static extern void ApplyTorque2(IntPtr obj, Vector3 torque);
987
988// Apply force at the given point. Will add torque to the object.
989[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
990public static extern void ApplyForce2(IntPtr obj, Vector3 force, Vector3 pos);
991
992// Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass.
993[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
994public static extern void ApplyCentralImpulse2(IntPtr obj, Vector3 imp);
995
996// Apply impulse to the object's torque. Force is scaled by object's mass.
997[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
998public static extern void ApplyTorqueImpulse2(IntPtr obj, Vector3 imp);
999
1000// Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces.
1001[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1002public static extern void ApplyImpulse2(IntPtr obj, Vector3 imp, Vector3 pos);
1003
1004[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1005public static extern void ClearForces2(IntPtr obj);
1006
1007[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1008public static extern void ClearAllForces2(IntPtr obj);
1009
1010[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1011public static extern void UpdateInertiaTensor2(IntPtr obj);
1012
1013[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1014public static extern Vector3 GetCenterOfMassPosition2(IntPtr obj);
1015
1016 /*
1017[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1018public static extern Transform GetCenterOfMassTransform2(IntPtr obj);
1019 */
1020
1021[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1022public static extern Vector3 GetLinearVelocity2(IntPtr obj);
1023
1024[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1025public static extern Vector3 GetAngularVelocity2(IntPtr obj);
1026
1027[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1028public static extern void SetLinearVelocity2(IntPtr obj, Vector3 val);
1029
1030[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1031public static extern void SetAngularVelocity2(IntPtr obj, Vector3 angularVelocity);
1032
1033[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1034public static extern Vector3 GetVelocityInLocalPoint2(IntPtr obj, Vector3 pos);
1035
1036[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1037public static extern void Translate2(IntPtr obj, Vector3 trans);
1038
1039[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1040public static extern void UpdateDeactivation2(IntPtr obj, float timeStep);
1041
1042[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1043public static extern bool WantsSleeping2(IntPtr obj);
1044
1045[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1046public static extern void SetAngularFactor2(IntPtr obj, float factor);
1047
1048[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1049public static extern void SetAngularFactorV2(IntPtr obj, Vector3 factor);
1050
1051[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1052public static extern Vector3 GetAngularFactor2(IntPtr obj);
1053
1054[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1055public static extern bool IsInWorld2(IntPtr obj);
1056
1057[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1058public static extern void AddConstraintRef2(IntPtr obj, IntPtr constrain);
1059
1060[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1061public static extern void RemoveConstraintRef2(IntPtr obj, IntPtr constrain);
1062
1063[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1064public static extern IntPtr GetConstraintRef2(IntPtr obj, int index);
1065
1066[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1067public static extern int GetNumConstraintRefs2(IntPtr obj);
1068
1069[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1070public static extern void SetCollisionFilterMask2(IntPtr body, uint filter, uint mask);
1071
1072// =====================================================================================
1073// btCollisionShape entries
1074
1075[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1076public static extern float GetAngularMotionDisc2(IntPtr shape);
1077
1078[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1079public static extern float GetContactBreakingThreshold2(IntPtr shape, float defaultFactor);
1080
1081[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1082public static extern bool IsPolyhedral2(IntPtr shape);
1083
1084[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1085public static extern bool IsConvex2d2(IntPtr shape);
1086
1087[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1088public static extern bool IsConvex2(IntPtr shape);
1089
1090[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1091public static extern bool IsNonMoving2(IntPtr shape);
1092
1093[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1094public static extern bool IsConcave2(IntPtr shape);
1095
1096[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1097public static extern bool IsCompound2(IntPtr shape);
1098
1099[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1100public static extern bool IsSoftBody2(IntPtr shape);
1101
1102[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1103public static extern bool IsInfinite2(IntPtr shape);
522 1104
523[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1105[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
524public static extern IntPtr SetCollisionFlags2(IntPtr obj, CollisionFlags flags); 1106public static extern void SetLocalScaling2(IntPtr shape, Vector3 scale);
525 1107
526[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1108[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
527public static extern IntPtr AddToCollisionFlags2(IntPtr obj, CollisionFlags flags); 1109public static extern Vector3 GetLocalScaling2(IntPtr shape);
528 1110
529[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1111[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
530public static extern IntPtr RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags); 1112public static extern Vector3 CalculateLocalInertia2(IntPtr shape, float mass);
531 1113
532[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1114[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
533public static extern bool SetMassProps2(IntPtr obj, float mass, Vector3 inertia); 1115public static extern int GetShapeType2(IntPtr shape);
534 1116
535[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1117[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
536public static extern bool UpdateInertiaTensor2(IntPtr obj); 1118public static extern void SetMargin2(IntPtr shape, float val);
537 1119
538[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1120[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
539public static extern bool SetGravity2(IntPtr obj, Vector3 val); 1121public static extern float GetMargin2(IntPtr shape);
540 1122
1123// =====================================================================================
1124// Debugging
541[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1125[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
542public static extern IntPtr ClearForces2(IntPtr obj); 1126public static extern void DumpRigidBody2(IntPtr sim, IntPtr collisionObject);
543 1127
544[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1128[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
545public static extern IntPtr ClearAllForces2(IntPtr obj); 1129public static extern void DumpCollisionShape2(IntPtr sim, IntPtr collisionShape);
546 1130
547[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1131[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
548public static extern bool SetMargin2(IntPtr obj, float val); 1132public static extern void DumpConstraint2(IntPtr sim, IntPtr constrain);
549 1133
550[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1134[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
551public static extern bool UpdateSingleAabb2(IntPtr world, IntPtr obj); 1135public static extern void DumpAllInfo2(IntPtr sim);
552 1136
553[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1137[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
554public static extern bool DestroyObject2(IntPtr world, uint id); 1138public static extern void DumpMapInfo2(IntPtr sim, IntPtr manInfo);
555 1139
556[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1140[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
557public static extern void DumpPhysicsStatistics2(IntPtr sim); 1141public static extern void DumpPhysicsStatistics2(IntPtr sim);