diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs | 762 |
1 files changed, 606 insertions, 156 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs index 504bd3c..28fae13 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs | |||
@@ -33,38 +33,153 @@ using OpenMetaverse; | |||
33 | namespace OpenSim.Region.Physics.BulletSPlugin { | 33 | namespace OpenSim.Region.Physics.BulletSPlugin { |
34 | 34 | ||
35 | // Classes to allow some type checking for the API | 35 | // Classes to allow some type checking for the API |
36 | // These hold pointers to allocated objects in the unmanaged space. | ||
37 | |||
38 | // The physics engine controller class created at initialization | ||
36 | public struct BulletSim | 39 | public struct BulletSim |
37 | { | 40 | { |
38 | public BulletSim(uint id, BSScene bss, IntPtr xx) { ID = id; scene = bss; Ptr = xx; } | 41 | public BulletSim(uint worldId, BSScene bss, IntPtr xx) |
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 | ||
45 | public struct BulletBody | 54 | public 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 | ||
86 | public 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 | ||
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 | ||
52 | public struct BulletConstraint | 136 | public 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. | ||
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 = 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)] |
60 | public struct ConvexHull | 175 | public 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)] |
67 | public struct ShapeData | 182 | public 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)] |
100 | public struct SweepHit | 231 | public 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 | ||
320 | public enum ActivationState : uint | ||
321 | { | ||
322 | ACTIVE_TAG = 1, | ||
323 | ISLAND_SLEEPING, | ||
324 | WANTS_DEACTIVATION, | ||
325 | DISABLE_DEACTIVATION, | ||
326 | DISABLE_SIMULATION, | ||
327 | } | ||
328 | |||
329 | public 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, ...). | ||
183 | public enum CollisionFlags : uint | 342 | public 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 | ||
365 | public 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,250 +425,285 @@ public enum ConstraintParamAxis : int | |||
221 | // =============================================================================== | 425 | // =============================================================================== |
222 | static class BulletSimAPI { | 426 | static class BulletSimAPI { |
223 | 427 | ||
224 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 428 | // Link back to the managed code for outputting log messages |
225 | [return: MarshalAs(UnmanagedType.LPStr)] | 429 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
226 | public static extern string GetVersion(); | 430 | public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg); |
227 | 431 | ||
432 | // =============================================================================== | ||
433 | // Initialization and simulation | ||
228 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 434 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
229 | public static extern uint Initialize(Vector3 maxPosition, IntPtr parms, | 435 | public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms, |
230 | int maxCollisions, IntPtr collisionArray, | 436 | int maxCollisions, IntPtr collisionArray, |
231 | int maxUpdates, IntPtr updateArray); | 437 | int maxUpdates, IntPtr updateArray, |
438 | DebugLogCallback logRoutine); | ||
232 | 439 | ||
233 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 440 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
234 | public static extern void SetHeightmap(uint worldID, [MarshalAs(UnmanagedType.LPArray)] float[] heightMap); | 441 | public static extern bool UpdateParameter2(IntPtr world, uint localID, String parm, float value); |
235 | 442 | ||
236 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 443 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
237 | public static extern void Shutdown(uint worldID); | 444 | public static extern void SetHeightMap2(IntPtr world, float[] heightmap); |
238 | 445 | ||
239 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 446 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
240 | public static extern bool UpdateParameter(uint worldID, uint localID, | 447 | public static extern void Shutdown2(IntPtr sim); |
241 | [MarshalAs(UnmanagedType.LPStr)]string paramCode, float value); | ||
242 | 448 | ||
243 | // =============================================================================== | ||
244 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 449 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
245 | public static extern int PhysicsStep(uint worldID, float timeStep, int maxSubSteps, float fixedTimeStep, | 450 | public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep, |
246 | out int updatedEntityCount, | 451 | out int updatedEntityCount, |
247 | out IntPtr updatedEntitiesPtr, | 452 | out IntPtr updatedEntitiesPtr, |
248 | out int collidersCount, | 453 | out int collidersCount, |
249 | out IntPtr collidersPtr); | 454 | out IntPtr collidersPtr); |
250 | 455 | ||
251 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 456 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
252 | public static extern bool CreateHull(uint worldID, System.UInt64 meshKey, | 457 | public static extern bool PushUpdate2(IntPtr obj); |
253 | int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls | ||
254 | ); | ||
255 | 458 | ||
459 | // ===================================================================================== | ||
460 | // Mesh, hull, shape and body creation helper routines | ||
256 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 461 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
257 | public static extern bool CreateMesh(uint worldID, System.UInt64 meshKey, | 462 | public static extern IntPtr CreateMeshShape2(IntPtr world, |
258 | int indexCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices, | 463 | int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices, |
259 | int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices | 464 | int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices ); |
260 | ); | ||
261 | 465 | ||
262 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 466 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
263 | public static extern bool DestroyHull(uint worldID, System.UInt64 meshKey); | 467 | public static extern IntPtr CreateHullShape2(IntPtr world, |
468 | int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls); | ||
264 | 469 | ||
265 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 470 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
266 | public static extern bool DestroyMesh(uint worldID, System.UInt64 meshKey); | 471 | public static extern IntPtr BuildHullShapeFromMesh2(IntPtr world, IntPtr meshShape); |
267 | 472 | ||
268 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 473 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
269 | public static extern bool CreateObject(uint worldID, ShapeData shapeData); | 474 | public static extern IntPtr BuildNativeShape2(IntPtr world, ShapeData shapeData); |
270 | 475 | ||
271 | /* Remove old functionality | ||
272 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 476 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
273 | public static extern void CreateLinkset(uint worldID, int objectCount, ShapeData[] shapeDatas); | 477 | public static extern bool IsNativeShape2(IntPtr shape); |
274 | 478 | ||
275 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 479 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
276 | public static extern void AddConstraint(uint worldID, uint id1, uint id2, | 480 | public static extern IntPtr BuildCapsuleShape2(IntPtr world, float radius, float height, Vector3 scale); |
277 | Vector3 frame1, Quaternion frame1rot, | ||
278 | Vector3 frame2, Quaternion frame2rot, | ||
279 | Vector3 lowLinear, Vector3 hiLinear, Vector3 lowAngular, Vector3 hiAngular); | ||
280 | 481 | ||
281 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 482 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
282 | public static extern bool RemoveConstraintByID(uint worldID, uint id1); | 483 | public static extern IntPtr CreateCompoundShape2(IntPtr sim, bool enableDynamicAabbTree); |
283 | 484 | ||
284 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 485 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
285 | public static extern bool RemoveConstraint(uint worldID, uint id1, uint id2); | 486 | public static extern int GetNumberOfCompoundChildren2(IntPtr cShape); |
286 | */ | ||
287 | 487 | ||
288 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 488 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
289 | public static extern Vector3 GetObjectPosition(uint WorldID, uint id); | 489 | public static extern void AddChildShapeToCompoundShape2(IntPtr cShape, IntPtr addShape, Vector3 pos, Quaternion rot); |
290 | 490 | ||
291 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 491 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
292 | public static extern Quaternion GetObjectOrientation(uint WorldID, uint id); | 492 | public static extern IntPtr GetChildShapeFromCompoundShapeIndex2(IntPtr cShape, int indx); |
293 | 493 | ||
294 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 494 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
295 | public static extern bool SetObjectTranslation(uint worldID, uint id, Vector3 position, Quaternion rotation); | 495 | public static extern IntPtr RemoveChildShapeFromCompoundShapeIndex2(IntPtr cShape, int indx); |
296 | 496 | ||
297 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 497 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
298 | public static extern bool SetObjectVelocity(uint worldID, uint id, Vector3 velocity); | 498 | public static extern void RemoveChildShapeFromCompoundShape2(IntPtr cShape, IntPtr removeShape); |
299 | 499 | ||
300 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 500 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
301 | public static extern bool SetObjectAngularVelocity(uint worldID, uint id, Vector3 angularVelocity); | 501 | public static extern void RecalculateCompoundShapeLocalAabb2(IntPtr cShape); |
302 | 502 | ||
303 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 503 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
304 | public static extern bool SetObjectForce(uint worldID, uint id, Vector3 force); | 504 | public static extern IntPtr DuplicateCollisionShape2(IntPtr sim, IntPtr srcShape, uint id); |
305 | 505 | ||
306 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 506 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
307 | public static extern bool SetObjectScaleMass(uint worldID, uint id, Vector3 scale, float mass, bool isDynamic); | 507 | public static extern IntPtr CreateBodyFromShapeAndInfo2(IntPtr sim, IntPtr shape, uint id, IntPtr constructionInfo); |
308 | 508 | ||
309 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 509 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
310 | public static extern bool SetObjectCollidable(uint worldID, uint id, bool phantom); | 510 | public static extern bool DeleteCollisionShape2(IntPtr world, IntPtr shape); |
311 | 511 | ||
312 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 512 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
313 | public static extern bool SetObjectDynamic(uint worldID, uint id, bool isDynamic, float mass); | 513 | public static extern int GetBodyType2(IntPtr obj); |
314 | 514 | ||
315 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 515 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
316 | public static extern bool SetObjectGhost(uint worldID, uint id, bool ghostly); | 516 | public static extern IntPtr CreateBodyFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot); |
317 | 517 | ||
318 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 518 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
319 | public static extern bool SetObjectProperties(uint worldID, uint id, bool isStatic, bool isSolid, bool genCollisions, float mass); | 519 | public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, uint id, Vector3 pos, Quaternion rot); |
320 | 520 | ||
321 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 521 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
322 | public static extern bool SetObjectBuoyancy(uint worldID, uint id, float buoyancy); | 522 | public static extern IntPtr CreateGhostFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot); |
323 | 523 | ||
324 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 524 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
325 | public static extern bool HasObject(uint worldID, uint id); | 525 | public static extern IntPtr AllocateBodyInfo2(IntPtr obj); |
326 | 526 | ||
327 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 527 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
328 | public static extern bool DestroyObject(uint worldID, uint id); | 528 | public static extern void ReleaseBodyInfo2(IntPtr obj); |
329 | 529 | ||
330 | // =============================================================================== | ||
331 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 530 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
332 | public static extern SweepHit ConvexSweepTest(uint worldID, uint id, Vector3 to, float extraMargin); | 531 | public static extern void DestroyObject2(IntPtr sim, IntPtr obj); |
333 | 532 | ||
533 | // ===================================================================================== | ||
534 | // Terrain creation and helper routines | ||
334 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 535 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
335 | public static extern RaycastHit RayTest(uint worldID, uint id, Vector3 from, Vector3 to); | 536 | public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords, |
537 | [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin); | ||
336 | 538 | ||
337 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 539 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
338 | public static extern Vector3 RecoverFromPenetration(uint worldID, uint id); | 540 | public static extern IntPtr FillHeightMapInfo2(IntPtr sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords, |
541 | [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin); | ||
339 | 542 | ||
340 | // =============================================================================== | ||
341 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 543 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
342 | public static extern void DumpBulletStatistics(); | 544 | public static extern bool ReleaseHeightMapInfo2(IntPtr heightMapInfo); |
343 | 545 | ||
344 | // Log a debug message | ||
345 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
346 | public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg); | ||
347 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 546 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
348 | public static extern void SetDebugLogCallback(DebugLogCallback callback); | 547 | public static extern IntPtr CreateGroundPlaneShape2(uint id, float height, float collisionMargin); |
349 | 548 | ||
350 | // =============================================================================== | 549 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
351 | // =============================================================================== | 550 | public static extern IntPtr CreateTerrainShape2(IntPtr mapInfo); |
352 | // =============================================================================== | ||
353 | // A new version of the API that enables moving all the logic out of the C++ code and into | ||
354 | // the C# code. This will make modifications easier for the next person. | ||
355 | // This interface passes the actual pointers to the objects in the unmanaged | ||
356 | // address space. All the management (calls for creation/destruction/lookup) | ||
357 | // is done in the C# code. | ||
358 | // The names have a "2" tacked on. This will be removed as the C# code gets rebuilt | ||
359 | // and the old code is removed. | ||
360 | 551 | ||
552 | // ===================================================================================== | ||
553 | // Constraint creation and helper routines | ||
361 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 554 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
362 | public static extern IntPtr GetSimHandle2(uint worldID); | 555 | public static extern IntPtr Create6DofConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, |
556 | Vector3 frame1loc, Quaternion frame1rot, | ||
557 | Vector3 frame2loc, Quaternion frame2rot, | ||
558 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
363 | 559 | ||
364 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 560 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
365 | public static extern IntPtr GetBodyHandleWorldID2(uint worldID, uint id); | 561 | public static extern IntPtr Create6DofConstraintToPoint2(IntPtr world, IntPtr obj1, IntPtr obj2, |
562 | Vector3 joinPoint, | ||
563 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
366 | 564 | ||
367 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 565 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
368 | public static extern IntPtr GetBodyHandle2(IntPtr world, uint id); | 566 | public static extern IntPtr CreateHingeConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, |
567 | Vector3 pivotinA, Vector3 pivotinB, | ||
568 | Vector3 axisInA, Vector3 axisInB, | ||
569 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
369 | 570 | ||
370 | // =============================================================================== | ||
371 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 571 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
372 | public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms, | 572 | public static extern void SetConstraintEnable2(IntPtr constrain, float numericTrueFalse); |
373 | int maxCollisions, IntPtr collisionArray, | ||
374 | int maxUpdates, IntPtr updateArray); | ||
375 | 573 | ||
376 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 574 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
377 | public static extern bool UpdateParameter2(IntPtr world, uint localID, String parm, float value); | 575 | public static extern void SetConstraintNumSolverIterations2(IntPtr constrain, float iterations); |
378 | 576 | ||
379 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 577 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
380 | public static extern void SetHeightmap2(IntPtr world, float[] heightmap); | 578 | public static extern bool SetFrames2(IntPtr constrain, |
579 | Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot); | ||
381 | 580 | ||
382 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 581 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
383 | public static extern void Shutdown2(IntPtr sim); | 582 | public static extern bool SetLinearLimits2(IntPtr constrain, Vector3 low, Vector3 hi); |
384 | 583 | ||
385 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 584 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
386 | public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep, | 585 | public static extern bool SetAngularLimits2(IntPtr constrain, Vector3 low, Vector3 hi); |
387 | out int updatedEntityCount, | ||
388 | out IntPtr updatedEntitiesPtr, | ||
389 | out int collidersCount, | ||
390 | out IntPtr collidersPtr); | ||
391 | 586 | ||
392 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 587 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
393 | public static extern bool PushUpdate2(IntPtr obj); | 588 | public static extern bool UseFrameOffset2(IntPtr constrain, float enable); |
394 | 589 | ||
395 | /* | ||
396 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 590 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
397 | public static extern IntPtr CreateMesh2(IntPtr world, int indicesCount, int* indices, int verticesCount, float* vertices ); | 591 | public static extern bool TranslationalLimitMotor2(IntPtr constrain, float enable, float targetVel, float maxMotorForce); |
398 | 592 | ||
399 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 593 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
400 | public static extern bool BuildHull2(IntPtr world, IntPtr mesh); | 594 | public static extern bool SetBreakingImpulseThreshold2(IntPtr constrain, float threshold); |
401 | 595 | ||
402 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 596 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
403 | public static extern bool ReleaseHull2(IntPtr world, IntPtr mesh); | 597 | public static extern bool CalculateTransforms2(IntPtr constrain); |
404 | 598 | ||
405 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 599 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
406 | public static extern bool DestroyMesh2(IntPtr world, IntPtr mesh); | 600 | public static extern bool SetConstraintParam2(IntPtr constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis); |
407 | 601 | ||
408 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 602 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
409 | public static extern IntPtr CreateObject2(IntPtr world, ShapeData shapeData); | 603 | public static extern bool DestroyConstraint2(IntPtr world, IntPtr constrain); |
410 | */ | ||
411 | 604 | ||
605 | // ===================================================================================== | ||
606 | // btCollisionWorld entries | ||
412 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 607 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
413 | public static extern IntPtr Create6DofConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, | 608 | public static extern void UpdateSingleAabb2(IntPtr world, IntPtr obj); |
414 | Vector3 frame1loc, Quaternion frame1rot, | ||
415 | Vector3 frame2loc, Quaternion frame2rot, | ||
416 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
417 | 609 | ||
418 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 610 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
419 | public static extern IntPtr Create6DofConstraintToPoint2(IntPtr world, IntPtr obj1, IntPtr obj2, | 611 | public static extern void UpdateAabbs2(IntPtr world); |
420 | Vector3 joinPoint, | ||
421 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
422 | 612 | ||
423 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 613 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
424 | public static extern IntPtr CreateHingeConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, | 614 | public static extern bool GetForceUpdateAllAabbs2(IntPtr world); |
425 | Vector3 pivotinA, Vector3 pivotinB, | ||
426 | Vector3 axisInA, Vector3 axisInB, | ||
427 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
428 | 615 | ||
429 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 616 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
430 | public static extern void SetConstraintEnable2(IntPtr constrain, float numericTrueFalse); | 617 | public static extern void SetForceUpdateAllAabbs2(IntPtr world, bool force); |
431 | 618 | ||
619 | // ===================================================================================== | ||
620 | // btDynamicsWorld entries | ||
432 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 621 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
433 | public static extern void SetConstraintNumSolverIterations2(IntPtr constrain, float iterations); | 622 | public static extern bool AddObjectToWorld2(IntPtr world, IntPtr obj); |
434 | 623 | ||
435 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 624 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
436 | public static extern bool SetFrames2(IntPtr constrain, | 625 | public static extern bool RemoveObjectFromWorld2(IntPtr world, IntPtr obj); |
437 | Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot); | ||
438 | 626 | ||
439 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 627 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
440 | public static extern bool SetLinearLimits2(IntPtr constrain, Vector3 low, Vector3 hi); | 628 | public static extern bool AddConstraintToWorld2(IntPtr world, IntPtr constrain, bool disableCollisionsBetweenLinkedObjects); |
441 | 629 | ||
442 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 630 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
443 | public static extern bool SetAngularLimits2(IntPtr constrain, Vector3 low, Vector3 hi); | 631 | public static extern bool RemoveConstraintFromWorld2(IntPtr world, IntPtr constrain); |
632 | // ===================================================================================== | ||
633 | // btCollisionObject entries | ||
634 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
635 | public static extern Vector3 GetAnisotripicFriction2(IntPtr constrain); | ||
444 | 636 | ||
445 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 637 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
446 | public static extern bool UseFrameOffset2(IntPtr constrain, float enable); | 638 | public static extern Vector3 SetAnisotripicFriction2(IntPtr constrain, Vector3 frict); |
447 | 639 | ||
448 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 640 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
449 | public static extern bool TranslationalLimitMotor2(IntPtr constrain, float enable, float targetVel, float maxMotorForce); | 641 | public static extern bool HasAnisotripicFriction2(IntPtr constrain); |
450 | 642 | ||
451 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 643 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
452 | public static extern bool SetBreakingImpulseThreshold2(IntPtr constrain, float threshold); | 644 | public static extern void SetContactProcessingThreshold2(IntPtr obj, float val); |
453 | 645 | ||
454 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 646 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
455 | public static extern bool CalculateTransforms2(IntPtr constrain); | 647 | public static extern float GetContactProcessingThreshold2(IntPtr obj); |
456 | 648 | ||
457 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 649 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
458 | public static extern bool SetConstraintParam2(IntPtr constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis); | 650 | public static extern bool IsStaticObject2(IntPtr obj); |
459 | 651 | ||
460 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 652 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
461 | public static extern bool DestroyConstraint2(IntPtr world, IntPtr constrain); | 653 | public static extern bool IsKinematicObject2(IntPtr obj); |
654 | |||
655 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
656 | public static extern bool IsStaticOrKinematicObject2(IntPtr obj); | ||
657 | |||
658 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
659 | public static extern bool HasContactResponse2(IntPtr obj); | ||
660 | |||
661 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
662 | public static extern void SetCollisionShape2(IntPtr sim, IntPtr obj, IntPtr shape); | ||
663 | |||
664 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
665 | public static extern IntPtr GetCollisionShape2(IntPtr obj); | ||
666 | |||
667 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
668 | public static extern int GetActivationState2(IntPtr obj); | ||
669 | |||
670 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
671 | public static extern void SetActivationState2(IntPtr obj, int state); | ||
672 | |||
673 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
674 | public static extern void SetDeactivationTime2(IntPtr obj, float dtime); | ||
675 | |||
676 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
677 | public static extern float GetDeactivationTime2(IntPtr obj); | ||
678 | |||
679 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
680 | public static extern void ForceActivationState2(IntPtr obj, ActivationState state); | ||
681 | |||
682 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
683 | public static extern void Activate2(IntPtr obj, bool forceActivation); | ||
684 | |||
685 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
686 | public static extern bool IsActive2(IntPtr obj); | ||
687 | |||
688 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
689 | public static extern void SetRestitution2(IntPtr obj, float val); | ||
690 | |||
691 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
692 | public static extern float GetRestitution2(IntPtr obj); | ||
693 | |||
694 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
695 | public static extern void SetFriction2(IntPtr obj, float val); | ||
696 | |||
697 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
698 | public static extern float GetFriction2(IntPtr obj); | ||
462 | 699 | ||
700 | /* Haven't defined the type 'Transform' | ||
463 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 701 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
464 | public static extern Vector3 AddObjectToWorld2(IntPtr world, IntPtr obj); | 702 | public static extern Transform GetWorldTransform2(IntPtr obj); |
465 | 703 | ||
466 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 704 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
467 | public static extern Vector3 RemoveObjectFromWorld2(IntPtr world, IntPtr obj); | 705 | public static extern void setWorldTransform2(IntPtr obj, Transform trans); |
706 | */ | ||
468 | 707 | ||
469 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 708 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
470 | public static extern Vector3 GetPosition2(IntPtr obj); | 709 | public static extern Vector3 GetPosition2(IntPtr obj); |
@@ -473,85 +712,296 @@ public static extern Vector3 GetPosition2(IntPtr obj); | |||
473 | public static extern Quaternion GetOrientation2(IntPtr obj); | 712 | public static extern Quaternion GetOrientation2(IntPtr obj); |
474 | 713 | ||
475 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 714 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
476 | public static extern bool SetTranslation2(IntPtr obj, Vector3 position, Quaternion rotation); | 715 | public static extern void SetTranslation2(IntPtr obj, Vector3 position, Quaternion rotation); |
477 | 716 | ||
478 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 717 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
479 | public static extern bool SetVelocity2(IntPtr obj, Vector3 velocity); | 718 | public static extern IntPtr GetBroadphaseHandle2(IntPtr obj); |
480 | 719 | ||
481 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 720 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
482 | public static extern bool SetAngularVelocity2(IntPtr obj, Vector3 angularVelocity); | 721 | public static extern void SetBroadphaseHandle2(IntPtr obj, IntPtr handle); |
483 | 722 | ||
723 | /* | ||
484 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 724 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
485 | public static extern bool SetObjectForce2(IntPtr obj, Vector3 force); | 725 | public static extern Transform GetInterpolationWorldTransform2(IntPtr obj); |
486 | 726 | ||
487 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 727 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
488 | public static extern bool AddObjectForce2(IntPtr obj, Vector3 force); | 728 | public static extern void SetInterpolationWorldTransform2(IntPtr obj, Transform trans); |
729 | */ | ||
489 | 730 | ||
490 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 731 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
491 | public static extern bool SetCcdMotionThreshold2(IntPtr obj, float val); | 732 | public static extern void SetInterpolationLinearVelocity2(IntPtr obj, Vector3 vel); |
492 | 733 | ||
493 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 734 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
494 | public static extern bool SetCcdSweepSphereRadius2(IntPtr obj, float val); | 735 | public static extern void SetInterpolationAngularVelocity2(IntPtr obj, Vector3 vel); |
495 | 736 | ||
496 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 737 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
497 | public static extern bool SetDamping2(IntPtr obj, float lin_damping, float ang_damping); | 738 | public static extern void SetInterpolationVelocity2(IntPtr obj, Vector3 linearVel, Vector3 angularVel); |
498 | 739 | ||
499 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 740 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
500 | public static extern bool SetDeactivationTime2(IntPtr obj, float val); | 741 | public static extern float GetHitFraction2(IntPtr obj); |
501 | 742 | ||
502 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 743 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
503 | public static extern bool SetSleepingThresholds2(IntPtr obj, float lin_threshold, float ang_threshold); | 744 | public static extern void SetHitFraction2(IntPtr obj, float val); |
504 | 745 | ||
505 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 746 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
506 | public static extern bool SetContactProcessingThreshold2(IntPtr obj, float val); | 747 | public static extern CollisionFlags GetCollisionFlags2(IntPtr obj); |
507 | 748 | ||
508 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 749 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
509 | public static extern bool SetFriction2(IntPtr obj, float val); | 750 | public static extern CollisionFlags SetCollisionFlags2(IntPtr obj, CollisionFlags flags); |
510 | 751 | ||
511 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 752 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
512 | public static extern bool SetRestitution2(IntPtr obj, float val); | 753 | public static extern CollisionFlags AddToCollisionFlags2(IntPtr obj, CollisionFlags flags); |
513 | 754 | ||
514 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 755 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
515 | public static extern bool SetLinearVelocity2(IntPtr obj, Vector3 val); | 756 | public static extern CollisionFlags RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags); |
516 | 757 | ||
517 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 758 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
518 | public static extern bool SetInterpolation2(IntPtr obj, Vector3 lin, Vector3 ang); | 759 | public static extern float GetCcdMotionThreshold2(IntPtr obj); |
519 | 760 | ||
520 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 761 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
521 | public static extern CollisionFlags GetCollisionFlags2(IntPtr obj); | 762 | public static extern void SetCcdMotionThreshold2(IntPtr obj, float val); |
763 | |||
764 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
765 | public static extern float GetCcdSweptSphereRadius2(IntPtr obj); | ||
766 | |||
767 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
768 | public static extern void SetCcdSweptSphereRadius2(IntPtr obj, float val); | ||
769 | |||
770 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
771 | public static extern IntPtr GetUserPointer2(IntPtr obj); | ||
772 | |||
773 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
774 | public static extern void SetUserPointer2(IntPtr obj, IntPtr val); | ||
775 | |||
776 | // ===================================================================================== | ||
777 | // btRigidBody entries | ||
778 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
779 | public static extern void ApplyGravity2(IntPtr obj); | ||
780 | |||
781 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
782 | public static extern void SetGravity2(IntPtr obj, Vector3 val); | ||
783 | |||
784 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
785 | public static extern Vector3 GetGravity2(IntPtr obj); | ||
786 | |||
787 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
788 | public static extern void SetDamping2(IntPtr obj, float lin_damping, float ang_damping); | ||
789 | |||
790 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
791 | public static extern void SetLinearDamping2(IntPtr obj, float lin_damping); | ||
792 | |||
793 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
794 | public static extern void SetAngularDamping2(IntPtr obj, float ang_damping); | ||
795 | |||
796 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
797 | public static extern float GetLinearDamping2(IntPtr obj); | ||
798 | |||
799 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
800 | public static extern float GetAngularDamping2(IntPtr obj); | ||
801 | |||
802 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
803 | public static extern float GetLinearSleepingThreshold2(IntPtr obj); | ||
804 | |||
805 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
806 | public static extern float GetAngularSleepingThreshold2(IntPtr obj); | ||
807 | |||
808 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
809 | public static extern void ApplyDamping2(IntPtr obj, float timeStep); | ||
810 | |||
811 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
812 | public static extern void SetMassProps2(IntPtr obj, float mass, Vector3 inertia); | ||
813 | |||
814 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
815 | public static extern Vector3 GetLinearFactor2(IntPtr obj); | ||
816 | |||
817 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
818 | public static extern void SetLinearFactor2(IntPtr obj, Vector3 factor); | ||
819 | |||
820 | /* | ||
821 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
822 | public static extern void SetCenterOfMassTransform2(IntPtr obj, Transform trans); | ||
823 | */ | ||
824 | |||
825 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
826 | public static extern void SetCenterOfMassByPosRot2(IntPtr obj, Vector3 pos, Quaternion rot); | ||
827 | |||
828 | // Add a force to the object as if its mass is one. | ||
829 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
830 | public static extern void ApplyCentralForce2(IntPtr obj, Vector3 force); | ||
831 | |||
832 | // Set the force being applied to the object as if its mass is one. | ||
833 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
834 | public static extern void SetObjectForce2(IntPtr obj, Vector3 force); | ||
835 | |||
836 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
837 | public static extern Vector3 GetTotalForce2(IntPtr obj); | ||
838 | |||
839 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
840 | public static extern Vector3 GetTotalTorque2(IntPtr obj); | ||
841 | |||
842 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
843 | public static extern Vector3 GetInvInertiaDiagLocal2(IntPtr obj); | ||
844 | |||
845 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
846 | public static extern void SetInvInertiaDiagLocal2(IntPtr obj, Vector3 inert); | ||
847 | |||
848 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
849 | public static extern void SetSleepingThresholds2(IntPtr obj, float lin_threshold, float ang_threshold); | ||
850 | |||
851 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
852 | public static extern void ApplyTorque2(IntPtr obj, Vector3 torque); | ||
853 | |||
854 | // Apply force at the given point. Will add torque to the object. | ||
855 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
856 | public static extern void ApplyForce2(IntPtr obj, Vector3 force, Vector3 pos); | ||
857 | |||
858 | // Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass. | ||
859 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
860 | public static extern void ApplyCentralImpulse2(IntPtr obj, Vector3 imp); | ||
861 | |||
862 | // Apply impulse to the object's torque. Force is scaled by object's mass. | ||
863 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
864 | public static extern void ApplyTorqueImpulse2(IntPtr obj, Vector3 imp); | ||
865 | |||
866 | // Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces. | ||
867 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
868 | public static extern void ApplyImpulse2(IntPtr obj, Vector3 imp, Vector3 pos); | ||
869 | |||
870 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
871 | public static extern void ClearForces2(IntPtr obj); | ||
872 | |||
873 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
874 | public static extern void ClearAllForces2(IntPtr obj); | ||
875 | |||
876 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
877 | public static extern void UpdateInertiaTensor2(IntPtr obj); | ||
878 | |||
879 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
880 | public static extern Vector3 GetCenterOfMassPosition2(IntPtr obj); | ||
881 | |||
882 | /* | ||
883 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
884 | public static extern Transform GetCenterOfMassTransform2(IntPtr obj); | ||
885 | */ | ||
886 | |||
887 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
888 | public static extern Vector3 GetLinearVelocity2(IntPtr obj); | ||
889 | |||
890 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
891 | public static extern Vector3 GetAngularVelocity2(IntPtr obj); | ||
892 | |||
893 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
894 | public static extern void SetLinearVelocity2(IntPtr obj, Vector3 val); | ||
895 | |||
896 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
897 | public static extern void SetAngularVelocity2(IntPtr obj, Vector3 angularVelocity); | ||
898 | |||
899 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
900 | public static extern Vector3 GetVelocityInLocalPoint2(IntPtr obj, Vector3 pos); | ||
901 | |||
902 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
903 | public static extern void Translate2(IntPtr obj, Vector3 trans); | ||
904 | |||
905 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
906 | public static extern void UpdateDeactivation2(IntPtr obj, float timeStep); | ||
907 | |||
908 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
909 | public static extern bool WantsSleeping2(IntPtr obj); | ||
910 | |||
911 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
912 | public static extern void SetAngularFactor2(IntPtr obj, float factor); | ||
913 | |||
914 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
915 | public static extern void SetAngularFactorV2(IntPtr obj, Vector3 factor); | ||
916 | |||
917 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
918 | public static extern Vector3 GetAngularFactor2(IntPtr obj); | ||
919 | |||
920 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
921 | public static extern bool IsInWorld2(IntPtr obj); | ||
922 | |||
923 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
924 | public static extern void AddConstraintRef2(IntPtr obj, IntPtr constrain); | ||
925 | |||
926 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
927 | public static extern void RemoveConstraintRef2(IntPtr obj, IntPtr constrain); | ||
928 | |||
929 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
930 | public static extern IntPtr GetConstraintRef2(IntPtr obj, int index); | ||
931 | |||
932 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
933 | public static extern int GetNumConstraintRefs2(IntPtr obj); | ||
934 | |||
935 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
936 | public static extern void SetCollisionFilterMask2(IntPtr body, uint filter, uint mask); | ||
937 | |||
938 | // ===================================================================================== | ||
939 | // btCollisionShape entries | ||
940 | |||
941 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
942 | public static extern float GetAngularMotionDisc2(IntPtr shape); | ||
943 | |||
944 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
945 | public static extern float GetContactBreakingThreshold2(IntPtr shape, float defaultFactor); | ||
946 | |||
947 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
948 | public static extern bool IsPolyhedral2(IntPtr shape); | ||
949 | |||
950 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
951 | public static extern bool IsConvex2d2(IntPtr shape); | ||
952 | |||
953 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
954 | public static extern bool IsConvex2(IntPtr shape); | ||
955 | |||
956 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
957 | public static extern bool IsNonMoving2(IntPtr shape); | ||
958 | |||
959 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
960 | public static extern bool IsConcave2(IntPtr shape); | ||
961 | |||
962 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
963 | public static extern bool IsCompound2(IntPtr shape); | ||
964 | |||
965 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
966 | public static extern bool IsSoftBody2(IntPtr shape); | ||
967 | |||
968 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
969 | public static extern bool IsInfinite2(IntPtr shape); | ||
522 | 970 | ||
523 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 971 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
524 | public static extern IntPtr SetCollisionFlags2(IntPtr obj, CollisionFlags flags); | 972 | public static extern void SetLocalScaling2(IntPtr shape, Vector3 scale); |
525 | 973 | ||
526 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 974 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
527 | public static extern IntPtr AddToCollisionFlags2(IntPtr obj, CollisionFlags flags); | 975 | public static extern Vector3 GetLocalScaling2(IntPtr shape); |
528 | 976 | ||
529 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 977 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
530 | public static extern IntPtr RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags); | 978 | public static extern Vector3 CalculateLocalInertia2(IntPtr shape, float mass); |
531 | 979 | ||
532 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 980 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
533 | public static extern bool SetMassProps2(IntPtr obj, float mass, Vector3 inertia); | 981 | public static extern int GetShapeType2(IntPtr shape); |
534 | 982 | ||
535 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 983 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
536 | public static extern bool UpdateInertiaTensor2(IntPtr obj); | 984 | public static extern void SetMargin2(IntPtr shape, float val); |
537 | 985 | ||
538 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 986 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
539 | public static extern bool SetGravity2(IntPtr obj, Vector3 val); | 987 | public static extern float GetMargin2(IntPtr shape); |
540 | 988 | ||
989 | // ===================================================================================== | ||
990 | // Debugging | ||
541 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 991 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
542 | public static extern IntPtr ClearForces2(IntPtr obj); | 992 | public static extern void DumpRigidBody2(IntPtr sim, IntPtr collisionObject); |
543 | 993 | ||
544 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 994 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
545 | public static extern IntPtr ClearAllForces2(IntPtr obj); | 995 | public static extern void DumpCollisionShape2(IntPtr sim, IntPtr collisionShape); |
546 | 996 | ||
547 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 997 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
548 | public static extern bool SetMargin2(IntPtr obj, float val); | 998 | public static extern void DumpConstraint2(IntPtr sim, IntPtr constrain); |
549 | 999 | ||
550 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1000 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
551 | public static extern bool UpdateSingleAabb2(IntPtr world, IntPtr obj); | 1001 | public static extern void DumpAllInfo2(IntPtr sim); |
552 | 1002 | ||
553 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1003 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
554 | public static extern bool DestroyObject2(IntPtr world, uint id); | 1004 | public static extern void DumpMapInfo2(IntPtr sim, IntPtr manInfo); |
555 | 1005 | ||
556 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1006 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
557 | public static extern void DumpPhysicsStatistics2(IntPtr sim); | 1007 | public static extern void DumpPhysicsStatistics2(IntPtr sim); |