diff options
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
Conflicts:
bin/Regions/Regions.ini.example
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs | 1015 |
1 files changed, 0 insertions, 1015 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs deleted file mode 100644 index e60a760..0000000 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs +++ /dev/null | |||
@@ -1,1015 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyrightD | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Runtime.InteropServices; | ||
29 | using System.Security; | ||
30 | using System.Text; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Region.Physics.BulletSPlugin { | ||
34 | |||
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 | ||
39 | public struct BulletSim | ||
40 | { | ||
41 | public BulletSim(uint worldId, BSScene bss, IntPtr xx) | ||
42 | { | ||
43 | ptr = xx; | ||
44 | worldID = worldId; | ||
45 | physicsScene = bss; | ||
46 | } | ||
47 | public IntPtr ptr; | ||
48 | public uint worldID; | ||
49 | // The scene is only in here so very low level routines have a handle to print debug/error messages | ||
50 | public BSScene physicsScene; | ||
51 | } | ||
52 | |||
53 | // An allocated Bullet btRigidBody | ||
54 | public struct BulletBody | ||
55 | { | ||
56 | public BulletBody(uint id, IntPtr xx) | ||
57 | { | ||
58 | ID = id; | ||
59 | ptr = xx; | ||
60 | collisionFilter = 0; | ||
61 | collisionMask = 0; | ||
62 | } | ||
63 | public IntPtr ptr; | ||
64 | public uint ID; | ||
65 | public CollisionFilterGroups collisionFilter; | ||
66 | public CollisionFilterGroups collisionMask; | ||
67 | public override string ToString() | ||
68 | { | ||
69 | StringBuilder buff = new StringBuilder(); | ||
70 | buff.Append("<id="); | ||
71 | buff.Append(ID.ToString()); | ||
72 | buff.Append(",p="); | ||
73 | buff.Append(ptr.ToString("X")); | ||
74 | if (collisionFilter != 0 || collisionMask != 0) | ||
75 | { | ||
76 | buff.Append(",f="); | ||
77 | buff.Append(collisionFilter.ToString("X")); | ||
78 | buff.Append(",m="); | ||
79 | buff.Append(collisionMask.ToString("X")); | ||
80 | } | ||
81 | buff.Append(">"); | ||
82 | return buff.ToString(); | ||
83 | } | ||
84 | } | ||
85 | |||
86 | public struct BulletShape | ||
87 | { | ||
88 | public BulletShape(IntPtr xx) | ||
89 | { | ||
90 | ptr = xx; | ||
91 | type=BSPhysicsShapeType.SHAPE_UNKNOWN; | ||
92 | shapeKey = (System.UInt64)FixedShapeKey.KEY_NONE; | ||
93 | isNativeShape = false; | ||
94 | } | ||
95 | public BulletShape(IntPtr xx, BSPhysicsShapeType typ) | ||
96 | { | ||
97 | ptr = xx; | ||
98 | type = typ; | ||
99 | shapeKey = 0; | ||
100 | isNativeShape = false; | ||
101 | } | ||
102 | public IntPtr ptr; | ||
103 | public BSPhysicsShapeType 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 | ||
123 | public 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 | ||
136 | public struct BulletConstraint | ||
137 | { | ||
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. | ||
149 | public class BulletHeightMapInfo | ||
150 | { | ||
151 | public BulletHeightMapInfo(uint id, float[] hm, IntPtr xx) { | ||
152 | ID = id; | ||
153 | Ptr = xx; | ||
154 | heightMap = hm; | ||
155 | terrainRegionBase = Vector3.Zero; | ||
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; | ||
162 | public IntPtr Ptr; | ||
163 | public float[] heightMap; | ||
164 | public Vector3 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; | ||
171 | } | ||
172 | |||
173 | // =============================================================================== | ||
174 | [StructLayout(LayoutKind.Sequential)] | ||
175 | public struct ConvexHull | ||
176 | { | ||
177 | Vector3 Offset; | ||
178 | int VertexCount; | ||
179 | Vector3[] Vertices; | ||
180 | } | ||
181 | public enum BSPhysicsShapeType | ||
182 | { | ||
183 | SHAPE_UNKNOWN = 0, | ||
184 | SHAPE_CAPSULE = 1, | ||
185 | SHAPE_BOX = 2, | ||
186 | SHAPE_CONE = 3, | ||
187 | SHAPE_CYLINDER = 4, | ||
188 | SHAPE_SPHERE = 5, | ||
189 | SHAPE_MESH = 6, | ||
190 | SHAPE_HULL = 7, | ||
191 | // following defined by BulletSim | ||
192 | SHAPE_GROUNDPLANE = 20, | ||
193 | SHAPE_TERRAIN = 21, | ||
194 | SHAPE_COMPOUND = 22, | ||
195 | SHAPE_HEIGHTMAP = 23, | ||
196 | }; | ||
197 | |||
198 | // The native shapes have predefined shape hash keys | ||
199 | public enum FixedShapeKey : ulong | ||
200 | { | ||
201 | KEY_NONE = 0, | ||
202 | KEY_BOX = 1, | ||
203 | KEY_SPHERE = 2, | ||
204 | KEY_CONE = 3, | ||
205 | KEY_CYLINDER = 4, | ||
206 | KEY_CAPSULE = 5, | ||
207 | } | ||
208 | |||
209 | [StructLayout(LayoutKind.Sequential)] | ||
210 | public struct ShapeData | ||
211 | { | ||
212 | public uint ID; | ||
213 | public BSPhysicsShapeType Type; | ||
214 | public Vector3 Position; | ||
215 | public Quaternion Rotation; | ||
216 | public Vector3 Velocity; | ||
217 | public Vector3 Scale; | ||
218 | public float Mass; | ||
219 | public float Buoyancy; | ||
220 | public System.UInt64 HullKey; | ||
221 | public System.UInt64 MeshKey; | ||
222 | public float Friction; | ||
223 | public float Restitution; | ||
224 | public float Collidable; // true of things bump into this | ||
225 | public float Static; // true if a static object. Otherwise gravity, etc. | ||
226 | public float Solid; // true if object cannot be passed through | ||
227 | public Vector3 Size; | ||
228 | |||
229 | // note that bools are passed as floats since bool size changes by language and architecture | ||
230 | public const float numericTrue = 1f; | ||
231 | public const float numericFalse = 0f; | ||
232 | } | ||
233 | [StructLayout(LayoutKind.Sequential)] | ||
234 | public struct SweepHit | ||
235 | { | ||
236 | public uint ID; | ||
237 | public float Fraction; | ||
238 | public Vector3 Normal; | ||
239 | public Vector3 Point; | ||
240 | } | ||
241 | [StructLayout(LayoutKind.Sequential)] | ||
242 | public struct RaycastHit | ||
243 | { | ||
244 | public uint ID; | ||
245 | public float Fraction; | ||
246 | public Vector3 Normal; | ||
247 | } | ||
248 | [StructLayout(LayoutKind.Sequential)] | ||
249 | public struct CollisionDesc | ||
250 | { | ||
251 | public uint aID; | ||
252 | public uint bID; | ||
253 | public Vector3 point; | ||
254 | public Vector3 normal; | ||
255 | } | ||
256 | [StructLayout(LayoutKind.Sequential)] | ||
257 | public struct EntityProperties | ||
258 | { | ||
259 | public uint ID; | ||
260 | public Vector3 Position; | ||
261 | public Quaternion Rotation; | ||
262 | public Vector3 Velocity; | ||
263 | public Vector3 Acceleration; | ||
264 | public Vector3 RotationalVelocity; | ||
265 | } | ||
266 | |||
267 | // Format of this structure must match the definition in the C++ code | ||
268 | [StructLayout(LayoutKind.Sequential)] | ||
269 | public struct ConfigurationParameters | ||
270 | { | ||
271 | public float defaultFriction; | ||
272 | public float defaultDensity; | ||
273 | public float defaultRestitution; | ||
274 | public float collisionMargin; | ||
275 | public float gravity; | ||
276 | |||
277 | public float linearDamping; | ||
278 | public float angularDamping; | ||
279 | public float deactivationTime; | ||
280 | public float linearSleepingThreshold; | ||
281 | public float angularSleepingThreshold; | ||
282 | public float ccdMotionThreshold; | ||
283 | public float ccdSweptSphereRadius; | ||
284 | public float contactProcessingThreshold; | ||
285 | |||
286 | public float terrainImplementation; | ||
287 | public float terrainFriction; | ||
288 | public float terrainHitFraction; | ||
289 | public float terrainRestitution; | ||
290 | public float avatarFriction; | ||
291 | public float avatarStandingFriction; | ||
292 | public float avatarDensity; | ||
293 | public float avatarRestitution; | ||
294 | public float avatarCapsuleWidth; | ||
295 | public float avatarCapsuleDepth; | ||
296 | public float avatarCapsuleHeight; | ||
297 | public float avatarContactProcessingThreshold; | ||
298 | |||
299 | public float maxPersistantManifoldPoolSize; | ||
300 | public float maxCollisionAlgorithmPoolSize; | ||
301 | public float shouldDisableContactPoolDynamicAllocation; | ||
302 | public float shouldForceUpdateAllAabbs; | ||
303 | public float shouldRandomizeSolverOrder; | ||
304 | public float shouldSplitSimulationIslands; | ||
305 | public float shouldEnableFrictionCaching; | ||
306 | public float numberOfSolverIterations; | ||
307 | |||
308 | public float linksetImplementation; | ||
309 | public float linkConstraintUseFrameOffset; | ||
310 | public float linkConstraintEnableTransMotor; | ||
311 | public float linkConstraintTransMotorMaxVel; | ||
312 | public float linkConstraintTransMotorMaxForce; | ||
313 | public float linkConstraintERP; | ||
314 | public float linkConstraintCFM; | ||
315 | public float linkConstraintSolverIterations; | ||
316 | |||
317 | public float physicsLoggingFrames; | ||
318 | |||
319 | public const float numericTrue = 1f; | ||
320 | public const float numericFalse = 0f; | ||
321 | } | ||
322 | |||
323 | |||
324 | // The states a bullet collision object can have | ||
325 | public enum ActivationState : uint | ||
326 | { | ||
327 | ACTIVE_TAG = 1, | ||
328 | ISLAND_SLEEPING, | ||
329 | WANTS_DEACTIVATION, | ||
330 | DISABLE_DEACTIVATION, | ||
331 | DISABLE_SIMULATION, | ||
332 | } | ||
333 | |||
334 | public enum CollisionObjectTypes : int | ||
335 | { | ||
336 | CO_COLLISION_OBJECT = 1 << 0, | ||
337 | CO_RIGID_BODY = 1 << 1, | ||
338 | CO_GHOST_OBJECT = 1 << 2, | ||
339 | CO_SOFT_BODY = 1 << 3, | ||
340 | CO_HF_FLUID = 1 << 4, | ||
341 | CO_USER_TYPE = 1 << 5, | ||
342 | } | ||
343 | |||
344 | // Values used by Bullet and BulletSim to control object properties. | ||
345 | // Bullet's "CollisionFlags" has more to do with operations on the | ||
346 | // object (if collisions happen, if gravity effects it, ...). | ||
347 | public enum CollisionFlags : uint | ||
348 | { | ||
349 | CF_STATIC_OBJECT = 1 << 0, | ||
350 | CF_KINEMATIC_OBJECT = 1 << 1, | ||
351 | CF_NO_CONTACT_RESPONSE = 1 << 2, | ||
352 | CF_CUSTOM_MATERIAL_CALLBACK = 1 << 3, | ||
353 | CF_CHARACTER_OBJECT = 1 << 4, | ||
354 | CF_DISABLE_VISUALIZE_OBJECT = 1 << 5, | ||
355 | CF_DISABLE_SPU_COLLISION_PROCESS = 1 << 6, | ||
356 | // Following used by BulletSim to control collisions | ||
357 | BS_SUBSCRIBE_COLLISION_EVENTS = 1 << 10, | ||
358 | BS_FLOATS_ON_WATER = 1 << 11, | ||
359 | BS_NONE = 0, | ||
360 | BS_ALL = 0xFFFFFFFF, | ||
361 | |||
362 | // These are the collision flags switched depending on physical state. | ||
363 | // The other flags are used for other things and should not be fooled with. | ||
364 | BS_ACTIVE = CF_STATIC_OBJECT | ||
365 | | CF_KINEMATIC_OBJECT | ||
366 | | CF_NO_CONTACT_RESPONSE | ||
367 | }; | ||
368 | |||
369 | // Values for collisions groups and masks | ||
370 | public enum CollisionFilterGroups : uint | ||
371 | { | ||
372 | // Don't use the bit definitions!! Define the use in a | ||
373 | // filter/mask definition below. This way collision interactions | ||
374 | // are more easily debugged. | ||
375 | BNoneFilter = 0, | ||
376 | BDefaultFilter = 1 << 0, | ||
377 | BStaticFilter = 1 << 1, | ||
378 | BKinematicFilter = 1 << 2, | ||
379 | BDebrisFilter = 1 << 3, | ||
380 | BSensorTrigger = 1 << 4, | ||
381 | BCharacterFilter = 1 << 5, | ||
382 | BAllFilter = 0xFFFFFFFF, | ||
383 | // Filter groups defined by BulletSim | ||
384 | BGroundPlaneFilter = 1 << 10, | ||
385 | BTerrainFilter = 1 << 11, | ||
386 | BRaycastFilter = 1 << 12, | ||
387 | BSolidFilter = 1 << 13, | ||
388 | BLinksetFilter = 1 << 14, | ||
389 | |||
390 | // The collsion filters and masked are defined in one place -- don't want them scattered | ||
391 | AvatarFilter = BCharacterFilter, | ||
392 | AvatarMask = BAllFilter, | ||
393 | ObjectFilter = BSolidFilter, | ||
394 | ObjectMask = BAllFilter, | ||
395 | StaticObjectFilter = BStaticFilter, | ||
396 | StaticObjectMask = BAllFilter & ~BStaticFilter, // static objects don't collide with each other | ||
397 | LinksetFilter = BLinksetFilter, | ||
398 | LinksetMask = BAllFilter & ~BLinksetFilter, // linkset objects don't collide with each other | ||
399 | VolumeDetectFilter = BSensorTrigger, | ||
400 | VolumeDetectMask = ~BSensorTrigger, | ||
401 | TerrainFilter = BTerrainFilter, | ||
402 | TerrainMask = BAllFilter & ~BStaticFilter, // static objects on the ground don't collide | ||
403 | GroundPlaneFilter = BGroundPlaneFilter, | ||
404 | GroundPlaneMask = BAllFilter | ||
405 | |||
406 | }; | ||
407 | |||
408 | // CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0 | ||
409 | // ERP controls amount of correction per tick. Usable range=0.1..0.8. Default=0.2. | ||
410 | public enum ConstraintParams : int | ||
411 | { | ||
412 | BT_CONSTRAINT_ERP = 1, // this one is not used in Bullet as of 20120730 | ||
413 | BT_CONSTRAINT_STOP_ERP, | ||
414 | BT_CONSTRAINT_CFM, | ||
415 | BT_CONSTRAINT_STOP_CFM, | ||
416 | }; | ||
417 | public enum ConstraintParamAxis : int | ||
418 | { | ||
419 | AXIS_LINEAR_X = 0, | ||
420 | AXIS_LINEAR_Y, | ||
421 | AXIS_LINEAR_Z, | ||
422 | AXIS_ANGULAR_X, | ||
423 | AXIS_ANGULAR_Y, | ||
424 | AXIS_ANGULAR_Z, | ||
425 | AXIS_LINEAR_ALL = 20, // these last three added by BulletSim so we don't have to do zillions of calls | ||
426 | AXIS_ANGULAR_ALL, | ||
427 | AXIS_ALL | ||
428 | }; | ||
429 | |||
430 | // =============================================================================== | ||
431 | static class BulletSimAPI { | ||
432 | |||
433 | // Link back to the managed code for outputting log messages | ||
434 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
435 | public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg); | ||
436 | |||
437 | // =============================================================================== | ||
438 | // Initialization and simulation | ||
439 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
440 | public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms, | ||
441 | int maxCollisions, IntPtr collisionArray, | ||
442 | int maxUpdates, IntPtr updateArray, | ||
443 | DebugLogCallback logRoutine); | ||
444 | |||
445 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
446 | public static extern bool UpdateParameter2(IntPtr world, uint localID, String parm, float value); | ||
447 | |||
448 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
449 | public static extern void SetHeightMap2(IntPtr world, float[] heightmap); | ||
450 | |||
451 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
452 | public static extern void Shutdown2(IntPtr sim); | ||
453 | |||
454 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
455 | public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep, | ||
456 | out int updatedEntityCount, | ||
457 | out IntPtr updatedEntitiesPtr, | ||
458 | out int collidersCount, | ||
459 | out IntPtr collidersPtr); | ||
460 | |||
461 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
462 | public static extern bool PushUpdate2(IntPtr obj); | ||
463 | |||
464 | // ===================================================================================== | ||
465 | // Mesh, hull, shape and body creation helper routines | ||
466 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
467 | public static extern IntPtr CreateMeshShape2(IntPtr world, | ||
468 | int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices, | ||
469 | int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices ); | ||
470 | |||
471 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
472 | public static extern IntPtr CreateHullShape2(IntPtr world, | ||
473 | int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls); | ||
474 | |||
475 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
476 | public static extern IntPtr BuildHullShapeFromMesh2(IntPtr world, IntPtr meshShape); | ||
477 | |||
478 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
479 | public static extern IntPtr BuildNativeShape2(IntPtr world, ShapeData shapeData); | ||
480 | |||
481 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
482 | public static extern bool IsNativeShape2(IntPtr shape); | ||
483 | |||
484 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
485 | public static extern IntPtr BuildCapsuleShape2(IntPtr world, float radius, float height, Vector3 scale); | ||
486 | |||
487 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
488 | public static extern IntPtr CreateCompoundShape2(IntPtr sim, bool enableDynamicAabbTree); | ||
489 | |||
490 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
491 | public static extern int GetNumberOfCompoundChildren2(IntPtr cShape); | ||
492 | |||
493 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
494 | public static extern void AddChildShapeToCompoundShape2(IntPtr cShape, IntPtr addShape, Vector3 pos, Quaternion rot); | ||
495 | |||
496 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
497 | public static extern IntPtr GetChildShapeFromCompoundShapeIndex2(IntPtr cShape, int indx); | ||
498 | |||
499 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
500 | public static extern IntPtr RemoveChildShapeFromCompoundShapeIndex2(IntPtr cShape, int indx); | ||
501 | |||
502 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
503 | public static extern void RemoveChildShapeFromCompoundShape2(IntPtr cShape, IntPtr removeShape); | ||
504 | |||
505 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
506 | public static extern void RecalculateCompoundShapeLocalAabb2(IntPtr cShape); | ||
507 | |||
508 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
509 | public static extern IntPtr DuplicateCollisionShape2(IntPtr sim, IntPtr srcShape, uint id); | ||
510 | |||
511 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
512 | public static extern IntPtr CreateBodyFromShapeAndInfo2(IntPtr sim, IntPtr shape, uint id, IntPtr constructionInfo); | ||
513 | |||
514 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
515 | public static extern bool DeleteCollisionShape2(IntPtr world, IntPtr shape); | ||
516 | |||
517 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
518 | public static extern int GetBodyType2(IntPtr obj); | ||
519 | |||
520 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
521 | public static extern IntPtr CreateBodyFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot); | ||
522 | |||
523 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
524 | public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, uint id, Vector3 pos, Quaternion rot); | ||
525 | |||
526 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
527 | public static extern IntPtr CreateGhostFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot); | ||
528 | |||
529 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
530 | public static extern IntPtr AllocateBodyInfo2(IntPtr obj); | ||
531 | |||
532 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
533 | public static extern void ReleaseBodyInfo2(IntPtr obj); | ||
534 | |||
535 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
536 | public static extern void DestroyObject2(IntPtr sim, IntPtr obj); | ||
537 | |||
538 | // ===================================================================================== | ||
539 | // Terrain creation and helper routines | ||
540 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
541 | public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords, | ||
542 | [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin); | ||
543 | |||
544 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
545 | public static extern IntPtr FillHeightMapInfo2(IntPtr sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords, | ||
546 | [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin); | ||
547 | |||
548 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
549 | public static extern bool ReleaseHeightMapInfo2(IntPtr heightMapInfo); | ||
550 | |||
551 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
552 | public static extern IntPtr CreateGroundPlaneShape2(uint id, float height, float collisionMargin); | ||
553 | |||
554 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
555 | public static extern IntPtr CreateTerrainShape2(IntPtr mapInfo); | ||
556 | |||
557 | // ===================================================================================== | ||
558 | // Constraint creation and helper routines | ||
559 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
560 | public static extern IntPtr Create6DofConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, | ||
561 | Vector3 frame1loc, Quaternion frame1rot, | ||
562 | Vector3 frame2loc, Quaternion frame2rot, | ||
563 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
564 | |||
565 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
566 | public static extern IntPtr Create6DofConstraintToPoint2(IntPtr world, IntPtr obj1, IntPtr obj2, | ||
567 | Vector3 joinPoint, | ||
568 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
569 | |||
570 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
571 | public static extern IntPtr CreateHingeConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, | ||
572 | Vector3 pivotinA, Vector3 pivotinB, | ||
573 | Vector3 axisInA, Vector3 axisInB, | ||
574 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
575 | |||
576 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
577 | public static extern void SetConstraintEnable2(IntPtr constrain, float numericTrueFalse); | ||
578 | |||
579 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
580 | public static extern void SetConstraintNumSolverIterations2(IntPtr constrain, float iterations); | ||
581 | |||
582 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
583 | public static extern bool SetFrames2(IntPtr constrain, | ||
584 | Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot); | ||
585 | |||
586 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
587 | public static extern bool SetLinearLimits2(IntPtr constrain, Vector3 low, Vector3 hi); | ||
588 | |||
589 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
590 | public static extern bool SetAngularLimits2(IntPtr constrain, Vector3 low, Vector3 hi); | ||
591 | |||
592 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
593 | public static extern bool UseFrameOffset2(IntPtr constrain, float enable); | ||
594 | |||
595 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
596 | public static extern bool TranslationalLimitMotor2(IntPtr constrain, float enable, float targetVel, float maxMotorForce); | ||
597 | |||
598 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
599 | public static extern bool SetBreakingImpulseThreshold2(IntPtr constrain, float threshold); | ||
600 | |||
601 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
602 | public static extern bool CalculateTransforms2(IntPtr constrain); | ||
603 | |||
604 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
605 | public static extern bool SetConstraintParam2(IntPtr constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis); | ||
606 | |||
607 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
608 | public static extern bool DestroyConstraint2(IntPtr world, IntPtr constrain); | ||
609 | |||
610 | // ===================================================================================== | ||
611 | // btCollisionWorld entries | ||
612 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
613 | public static extern void UpdateSingleAabb2(IntPtr world, IntPtr obj); | ||
614 | |||
615 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
616 | public static extern void UpdateAabbs2(IntPtr world); | ||
617 | |||
618 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
619 | public static extern bool GetForceUpdateAllAabbs2(IntPtr world); | ||
620 | |||
621 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
622 | public static extern void SetForceUpdateAllAabbs2(IntPtr world, bool force); | ||
623 | |||
624 | // ===================================================================================== | ||
625 | // btDynamicsWorld entries | ||
626 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
627 | public static extern bool AddObjectToWorld2(IntPtr world, IntPtr obj); | ||
628 | |||
629 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
630 | public static extern bool RemoveObjectFromWorld2(IntPtr world, IntPtr obj); | ||
631 | |||
632 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
633 | public static extern bool AddConstraintToWorld2(IntPtr world, IntPtr constrain, bool disableCollisionsBetweenLinkedObjects); | ||
634 | |||
635 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
636 | public static extern bool RemoveConstraintFromWorld2(IntPtr world, IntPtr constrain); | ||
637 | // ===================================================================================== | ||
638 | // btCollisionObject entries | ||
639 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
640 | public static extern Vector3 GetAnisotripicFriction2(IntPtr constrain); | ||
641 | |||
642 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
643 | public static extern Vector3 SetAnisotripicFriction2(IntPtr constrain, Vector3 frict); | ||
644 | |||
645 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
646 | public static extern bool HasAnisotripicFriction2(IntPtr constrain); | ||
647 | |||
648 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
649 | public static extern void SetContactProcessingThreshold2(IntPtr obj, float val); | ||
650 | |||
651 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
652 | public static extern float GetContactProcessingThreshold2(IntPtr obj); | ||
653 | |||
654 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
655 | public static extern bool IsStaticObject2(IntPtr obj); | ||
656 | |||
657 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
658 | public static extern bool IsKinematicObject2(IntPtr obj); | ||
659 | |||
660 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
661 | public static extern bool IsStaticOrKinematicObject2(IntPtr obj); | ||
662 | |||
663 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
664 | public static extern bool HasContactResponse2(IntPtr obj); | ||
665 | |||
666 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
667 | public static extern void SetCollisionShape2(IntPtr sim, IntPtr obj, IntPtr shape); | ||
668 | |||
669 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
670 | public static extern IntPtr GetCollisionShape2(IntPtr obj); | ||
671 | |||
672 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
673 | public static extern int GetActivationState2(IntPtr obj); | ||
674 | |||
675 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
676 | public static extern void SetActivationState2(IntPtr obj, int state); | ||
677 | |||
678 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
679 | public static extern void SetDeactivationTime2(IntPtr obj, float dtime); | ||
680 | |||
681 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
682 | public static extern float GetDeactivationTime2(IntPtr obj); | ||
683 | |||
684 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
685 | public static extern void ForceActivationState2(IntPtr obj, ActivationState state); | ||
686 | |||
687 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
688 | public static extern void Activate2(IntPtr obj, bool forceActivation); | ||
689 | |||
690 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
691 | public static extern bool IsActive2(IntPtr obj); | ||
692 | |||
693 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
694 | public static extern void SetRestitution2(IntPtr obj, float val); | ||
695 | |||
696 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
697 | public static extern float GetRestitution2(IntPtr obj); | ||
698 | |||
699 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
700 | public static extern void SetFriction2(IntPtr obj, float val); | ||
701 | |||
702 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
703 | public static extern float GetFriction2(IntPtr obj); | ||
704 | |||
705 | /* Haven't defined the type 'Transform' | ||
706 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
707 | public static extern Transform GetWorldTransform2(IntPtr obj); | ||
708 | |||
709 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
710 | public static extern void setWorldTransform2(IntPtr obj, Transform trans); | ||
711 | */ | ||
712 | |||
713 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
714 | public static extern Vector3 GetPosition2(IntPtr obj); | ||
715 | |||
716 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
717 | public static extern Quaternion GetOrientation2(IntPtr obj); | ||
718 | |||
719 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
720 | public static extern void SetTranslation2(IntPtr obj, Vector3 position, Quaternion rotation); | ||
721 | |||
722 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
723 | public static extern IntPtr GetBroadphaseHandle2(IntPtr obj); | ||
724 | |||
725 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
726 | public static extern void SetBroadphaseHandle2(IntPtr obj, IntPtr handle); | ||
727 | |||
728 | /* | ||
729 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
730 | public static extern Transform GetInterpolationWorldTransform2(IntPtr obj); | ||
731 | |||
732 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
733 | public static extern void SetInterpolationWorldTransform2(IntPtr obj, Transform trans); | ||
734 | */ | ||
735 | |||
736 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
737 | public static extern void SetInterpolationLinearVelocity2(IntPtr obj, Vector3 vel); | ||
738 | |||
739 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
740 | public static extern void SetInterpolationAngularVelocity2(IntPtr obj, Vector3 vel); | ||
741 | |||
742 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
743 | public static extern void SetInterpolationVelocity2(IntPtr obj, Vector3 linearVel, Vector3 angularVel); | ||
744 | |||
745 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
746 | public static extern float GetHitFraction2(IntPtr obj); | ||
747 | |||
748 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
749 | public static extern void SetHitFraction2(IntPtr obj, float val); | ||
750 | |||
751 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
752 | public static extern CollisionFlags GetCollisionFlags2(IntPtr obj); | ||
753 | |||
754 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
755 | public static extern CollisionFlags SetCollisionFlags2(IntPtr obj, CollisionFlags flags); | ||
756 | |||
757 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
758 | public static extern CollisionFlags AddToCollisionFlags2(IntPtr obj, CollisionFlags flags); | ||
759 | |||
760 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
761 | public static extern CollisionFlags RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags); | ||
762 | |||
763 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
764 | public static extern float GetCcdMotionThreshold2(IntPtr obj); | ||
765 | |||
766 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
767 | public static extern void SetCcdMotionThreshold2(IntPtr obj, float val); | ||
768 | |||
769 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
770 | public static extern float GetCcdSweptSphereRadius2(IntPtr obj); | ||
771 | |||
772 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
773 | public static extern void SetCcdSweptSphereRadius2(IntPtr obj, float val); | ||
774 | |||
775 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
776 | public static extern IntPtr GetUserPointer2(IntPtr obj); | ||
777 | |||
778 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
779 | public static extern void SetUserPointer2(IntPtr obj, IntPtr val); | ||
780 | |||
781 | // ===================================================================================== | ||
782 | // btRigidBody entries | ||
783 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
784 | public static extern void ApplyGravity2(IntPtr obj); | ||
785 | |||
786 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
787 | public static extern void SetGravity2(IntPtr obj, Vector3 val); | ||
788 | |||
789 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
790 | public static extern Vector3 GetGravity2(IntPtr obj); | ||
791 | |||
792 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
793 | public static extern void SetDamping2(IntPtr obj, float lin_damping, float ang_damping); | ||
794 | |||
795 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
796 | public static extern void SetLinearDamping2(IntPtr obj, float lin_damping); | ||
797 | |||
798 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
799 | public static extern void SetAngularDamping2(IntPtr obj, float ang_damping); | ||
800 | |||
801 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
802 | public static extern float GetLinearDamping2(IntPtr obj); | ||
803 | |||
804 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
805 | public static extern float GetAngularDamping2(IntPtr obj); | ||
806 | |||
807 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
808 | public static extern float GetLinearSleepingThreshold2(IntPtr obj); | ||
809 | |||
810 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
811 | public static extern float GetAngularSleepingThreshold2(IntPtr obj); | ||
812 | |||
813 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
814 | public static extern void ApplyDamping2(IntPtr obj, float timeStep); | ||
815 | |||
816 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
817 | public static extern void SetMassProps2(IntPtr obj, float mass, Vector3 inertia); | ||
818 | |||
819 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
820 | public static extern Vector3 GetLinearFactor2(IntPtr obj); | ||
821 | |||
822 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
823 | public static extern void SetLinearFactor2(IntPtr obj, Vector3 factor); | ||
824 | |||
825 | /* | ||
826 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
827 | public static extern void SetCenterOfMassTransform2(IntPtr obj, Transform trans); | ||
828 | */ | ||
829 | |||
830 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
831 | public static extern void SetCenterOfMassByPosRot2(IntPtr obj, Vector3 pos, Quaternion rot); | ||
832 | |||
833 | // Add a force to the object as if its mass is one. | ||
834 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
835 | public static extern void ApplyCentralForce2(IntPtr obj, Vector3 force); | ||
836 | |||
837 | // Set the force being applied to the object as if its mass is one. | ||
838 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
839 | public static extern void SetObjectForce2(IntPtr obj, Vector3 force); | ||
840 | |||
841 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
842 | public static extern Vector3 GetTotalForce2(IntPtr obj); | ||
843 | |||
844 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
845 | public static extern Vector3 GetTotalTorque2(IntPtr obj); | ||
846 | |||
847 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
848 | public static extern Vector3 GetInvInertiaDiagLocal2(IntPtr obj); | ||
849 | |||
850 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
851 | public static extern void SetInvInertiaDiagLocal2(IntPtr obj, Vector3 inert); | ||
852 | |||
853 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
854 | public static extern void SetSleepingThresholds2(IntPtr obj, float lin_threshold, float ang_threshold); | ||
855 | |||
856 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
857 | public static extern void ApplyTorque2(IntPtr obj, Vector3 torque); | ||
858 | |||
859 | // Apply force at the given point. Will add torque to the object. | ||
860 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
861 | public static extern void ApplyForce2(IntPtr obj, Vector3 force, Vector3 pos); | ||
862 | |||
863 | // Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass. | ||
864 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
865 | public static extern void ApplyCentralImpulse2(IntPtr obj, Vector3 imp); | ||
866 | |||
867 | // Apply impulse to the object's torque. Force is scaled by object's mass. | ||
868 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
869 | public static extern void ApplyTorqueImpulse2(IntPtr obj, Vector3 imp); | ||
870 | |||
871 | // Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces. | ||
872 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
873 | public static extern void ApplyImpulse2(IntPtr obj, Vector3 imp, Vector3 pos); | ||
874 | |||
875 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
876 | public static extern void ClearForces2(IntPtr obj); | ||
877 | |||
878 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
879 | public static extern void ClearAllForces2(IntPtr obj); | ||
880 | |||
881 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
882 | public static extern void UpdateInertiaTensor2(IntPtr obj); | ||
883 | |||
884 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
885 | public static extern Vector3 GetCenterOfMassPosition2(IntPtr obj); | ||
886 | |||
887 | /* | ||
888 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
889 | public static extern Transform GetCenterOfMassTransform2(IntPtr obj); | ||
890 | */ | ||
891 | |||
892 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
893 | public static extern Vector3 GetLinearVelocity2(IntPtr obj); | ||
894 | |||
895 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
896 | public static extern Vector3 GetAngularVelocity2(IntPtr obj); | ||
897 | |||
898 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
899 | public static extern void SetLinearVelocity2(IntPtr obj, Vector3 val); | ||
900 | |||
901 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
902 | public static extern void SetAngularVelocity2(IntPtr obj, Vector3 angularVelocity); | ||
903 | |||
904 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
905 | public static extern Vector3 GetVelocityInLocalPoint2(IntPtr obj, Vector3 pos); | ||
906 | |||
907 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
908 | public static extern void Translate2(IntPtr obj, Vector3 trans); | ||
909 | |||
910 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
911 | public static extern void UpdateDeactivation2(IntPtr obj, float timeStep); | ||
912 | |||
913 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
914 | public static extern bool WantsSleeping2(IntPtr obj); | ||
915 | |||
916 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
917 | public static extern void SetAngularFactor2(IntPtr obj, float factor); | ||
918 | |||
919 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
920 | public static extern void SetAngularFactorV2(IntPtr obj, Vector3 factor); | ||
921 | |||
922 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
923 | public static extern Vector3 GetAngularFactor2(IntPtr obj); | ||
924 | |||
925 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
926 | public static extern bool IsInWorld2(IntPtr obj); | ||
927 | |||
928 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
929 | public static extern void AddConstraintRef2(IntPtr obj, IntPtr constrain); | ||
930 | |||
931 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
932 | public static extern void RemoveConstraintRef2(IntPtr obj, IntPtr constrain); | ||
933 | |||
934 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
935 | public static extern IntPtr GetConstraintRef2(IntPtr obj, int index); | ||
936 | |||
937 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
938 | public static extern int GetNumConstraintRefs2(IntPtr obj); | ||
939 | |||
940 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
941 | public static extern void SetCollisionFilterMask2(IntPtr body, uint filter, uint mask); | ||
942 | |||
943 | // ===================================================================================== | ||
944 | // btCollisionShape entries | ||
945 | |||
946 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
947 | public static extern float GetAngularMotionDisc2(IntPtr shape); | ||
948 | |||
949 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
950 | public static extern float GetContactBreakingThreshold2(IntPtr shape, float defaultFactor); | ||
951 | |||
952 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
953 | public static extern bool IsPolyhedral2(IntPtr shape); | ||
954 | |||
955 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
956 | public static extern bool IsConvex2d2(IntPtr shape); | ||
957 | |||
958 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
959 | public static extern bool IsConvex2(IntPtr shape); | ||
960 | |||
961 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
962 | public static extern bool IsNonMoving2(IntPtr shape); | ||
963 | |||
964 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
965 | public static extern bool IsConcave2(IntPtr shape); | ||
966 | |||
967 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
968 | public static extern bool IsCompound2(IntPtr shape); | ||
969 | |||
970 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
971 | public static extern bool IsSoftBody2(IntPtr shape); | ||
972 | |||
973 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
974 | public static extern bool IsInfinite2(IntPtr shape); | ||
975 | |||
976 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
977 | public static extern void SetLocalScaling2(IntPtr shape, Vector3 scale); | ||
978 | |||
979 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
980 | public static extern Vector3 GetLocalScaling2(IntPtr shape); | ||
981 | |||
982 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
983 | public static extern Vector3 CalculateLocalInertia2(IntPtr shape, float mass); | ||
984 | |||
985 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
986 | public static extern int GetShapeType2(IntPtr shape); | ||
987 | |||
988 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
989 | public static extern void SetMargin2(IntPtr shape, float val); | ||
990 | |||
991 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
992 | public static extern float GetMargin2(IntPtr shape); | ||
993 | |||
994 | // ===================================================================================== | ||
995 | // Debugging | ||
996 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
997 | public static extern void DumpRigidBody2(IntPtr sim, IntPtr collisionObject); | ||
998 | |||
999 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1000 | public static extern void DumpCollisionShape2(IntPtr sim, IntPtr collisionShape); | ||
1001 | |||
1002 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1003 | public static extern void DumpConstraint2(IntPtr sim, IntPtr constrain); | ||
1004 | |||
1005 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1006 | public static extern void DumpAllInfo2(IntPtr sim); | ||
1007 | |||
1008 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1009 | public static extern void DumpMapInfo2(IntPtr sim, IntPtr manInfo); | ||
1010 | |||
1011 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1012 | public static extern void DumpPhysicsStatistics2(IntPtr sim); | ||
1013 | |||
1014 | } | ||
1015 | } | ||