aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs1276
1 files changed, 0 insertions, 1276 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
deleted file mode 100644
index b361498..0000000
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
+++ /dev/null
@@ -1,1276 +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 */
27using System;
28using System.Collections.Generic;
29using System.Runtime.InteropServices;
30using System.Security;
31using System.Text;
32using OpenMetaverse;
33
34namespace OpenSim.Region.Physics.BulletSPlugin {
35
36 // Constraint type values as defined by Bullet
37public enum ConstraintType : int
38{
39 POINT2POINT_CONSTRAINT_TYPE = 3,
40 HINGE_CONSTRAINT_TYPE,
41 CONETWIST_CONSTRAINT_TYPE,
42 D6_CONSTRAINT_TYPE,
43 SLIDER_CONSTRAINT_TYPE,
44 CONTACT_CONSTRAINT_TYPE,
45 D6_SPRING_CONSTRAINT_TYPE,
46 MAX_CONSTRAINT_TYPE
47}
48
49// ===============================================================================
50[StructLayout(LayoutKind.Sequential)]
51public struct ConvexHull
52{
53 Vector3 Offset;
54 int VertexCount;
55 Vector3[] Vertices;
56}
57public enum BSPhysicsShapeType
58{
59 SHAPE_UNKNOWN = 0,
60 SHAPE_CAPSULE = 1,
61 SHAPE_BOX = 2,
62 SHAPE_CONE = 3,
63 SHAPE_CYLINDER = 4,
64 SHAPE_SPHERE = 5,
65 SHAPE_MESH = 6,
66 SHAPE_HULL = 7,
67 // following defined by BulletSim
68 SHAPE_GROUNDPLANE = 20,
69 SHAPE_TERRAIN = 21,
70 SHAPE_COMPOUND = 22,
71 SHAPE_HEIGHTMAP = 23,
72 SHAPE_AVATAR = 24,
73};
74
75// The native shapes have predefined shape hash keys
76public enum FixedShapeKey : ulong
77{
78 KEY_NONE = 0,
79 KEY_BOX = 1,
80 KEY_SPHERE = 2,
81 KEY_CONE = 3,
82 KEY_CYLINDER = 4,
83 KEY_CAPSULE = 5,
84 KEY_AVATAR = 6,
85}
86
87[StructLayout(LayoutKind.Sequential)]
88public struct ShapeData
89{
90 public uint ID;
91 public BSPhysicsShapeType Type;
92 public Vector3 Position;
93 public Quaternion Rotation;
94 public Vector3 Velocity;
95 public Vector3 Scale;
96 public float Mass;
97 public float Buoyancy;
98 public System.UInt64 HullKey;
99 public System.UInt64 MeshKey;
100 public float Friction;
101 public float Restitution;
102 public float Collidable; // true of things bump into this
103 public float Static; // true if a static object. Otherwise gravity, etc.
104 public float Solid; // true if object cannot be passed through
105 public Vector3 Size;
106
107 // note that bools are passed as floats since bool size changes by language and architecture
108 public const float numericTrue = 1f;
109 public const float numericFalse = 0f;
110}
111[StructLayout(LayoutKind.Sequential)]
112public struct SweepHit
113{
114 public uint ID;
115 public float Fraction;
116 public Vector3 Normal;
117 public Vector3 Point;
118}
119[StructLayout(LayoutKind.Sequential)]
120public struct RaycastHit
121{
122 public uint ID;
123 public float Fraction;
124 public Vector3 Normal;
125}
126[StructLayout(LayoutKind.Sequential)]
127public struct CollisionDesc
128{
129 public uint aID;
130 public uint bID;
131 public Vector3 point;
132 public Vector3 normal;
133}
134[StructLayout(LayoutKind.Sequential)]
135public struct EntityProperties
136{
137 public uint ID;
138 public Vector3 Position;
139 public Quaternion Rotation;
140 public Vector3 Velocity;
141 public Vector3 Acceleration;
142 public Vector3 RotationalVelocity;
143}
144
145// Format of this structure must match the definition in the C++ code
146// NOTE: adding the X causes compile breaks if used. These are unused symbols
147// that can be removed from both here and the unmanaged definition of this structure.
148[StructLayout(LayoutKind.Sequential)]
149public struct ConfigurationParameters
150{
151 public float defaultFriction;
152 public float defaultDensity;
153 public float defaultRestitution;
154 public float collisionMargin;
155 public float gravity;
156
157 public float XlinearDamping;
158 public float XangularDamping;
159 public float XdeactivationTime;
160 public float XlinearSleepingThreshold;
161 public float XangularSleepingThreshold;
162 public float XccdMotionThreshold;
163 public float XccdSweptSphereRadius;
164 public float XcontactProcessingThreshold;
165
166 public float XterrainImplementation;
167 public float XterrainFriction;
168 public float XterrainHitFraction;
169 public float XterrainRestitution;
170 public float XterrainCollisionMargin;
171
172 public float XavatarFriction;
173 public float XavatarStandingFriction;
174 public float XavatarDensity;
175 public float XavatarRestitution;
176 public float XavatarCapsuleWidth;
177 public float XavatarCapsuleDepth;
178 public float XavatarCapsuleHeight;
179 public float XavatarContactProcessingThreshold;
180
181 public float XvehicleAngularDamping;
182
183 public float maxPersistantManifoldPoolSize;
184 public float maxCollisionAlgorithmPoolSize;
185 public float shouldDisableContactPoolDynamicAllocation;
186 public float shouldForceUpdateAllAabbs;
187 public float shouldRandomizeSolverOrder;
188 public float shouldSplitSimulationIslands;
189 public float shouldEnableFrictionCaching;
190 public float numberOfSolverIterations;
191
192 public float XlinksetImplementation;
193 public float XlinkConstraintUseFrameOffset;
194 public float XlinkConstraintEnableTransMotor;
195 public float XlinkConstraintTransMotorMaxVel;
196 public float XlinkConstraintTransMotorMaxForce;
197 public float XlinkConstraintERP;
198 public float XlinkConstraintCFM;
199 public float XlinkConstraintSolverIterations;
200
201 public float physicsLoggingFrames;
202
203 public const float numericTrue = 1f;
204 public const float numericFalse = 0f;
205}
206
207
208// The states a bullet collision object can have
209public enum ActivationState : uint
210{
211 ACTIVE_TAG = 1,
212 ISLAND_SLEEPING,
213 WANTS_DEACTIVATION,
214 DISABLE_DEACTIVATION,
215 DISABLE_SIMULATION,
216}
217
218public enum CollisionObjectTypes : int
219{
220 CO_COLLISION_OBJECT = 1 << 0,
221 CO_RIGID_BODY = 1 << 1,
222 CO_GHOST_OBJECT = 1 << 2,
223 CO_SOFT_BODY = 1 << 3,
224 CO_HF_FLUID = 1 << 4,
225 CO_USER_TYPE = 1 << 5,
226}
227
228// Values used by Bullet and BulletSim to control object properties.
229// Bullet's "CollisionFlags" has more to do with operations on the
230// object (if collisions happen, if gravity effects it, ...).
231public enum CollisionFlags : uint
232{
233 CF_STATIC_OBJECT = 1 << 0,
234 CF_KINEMATIC_OBJECT = 1 << 1,
235 CF_NO_CONTACT_RESPONSE = 1 << 2,
236 CF_CUSTOM_MATERIAL_CALLBACK = 1 << 3,
237 CF_CHARACTER_OBJECT = 1 << 4,
238 CF_DISABLE_VISUALIZE_OBJECT = 1 << 5,
239 CF_DISABLE_SPU_COLLISION_PROCESS = 1 << 6,
240 // Following used by BulletSim to control collisions and updates
241 BS_SUBSCRIBE_COLLISION_EVENTS = 1 << 10,
242 BS_FLOATS_ON_WATER = 1 << 11,
243 BS_VEHICLE_COLLISIONS = 1 << 12,
244 BS_NONE = 0,
245 BS_ALL = 0xFFFFFFFF
246};
247
248// Values f collisions groups and masks
249public enum CollisionFilterGroups : uint
250{
251 // Don't use the bit definitions!! Define the use in a
252 // filter/mask definition below. This way collision interactions
253 // are more easily found and debugged.
254 BNoneGroup = 0,
255 BDefaultGroup = 1 << 0, // 0001
256 BStaticGroup = 1 << 1, // 0002
257 BKinematicGroup = 1 << 2, // 0004
258 BDebrisGroup = 1 << 3, // 0008
259 BSensorTrigger = 1 << 4, // 0010
260 BCharacterGroup = 1 << 5, // 0020
261 BAllGroup = 0x000FFFFF,
262 // Filter groups defined by BulletSim
263 BGroundPlaneGroup = 1 << 10, // 0400
264 BTerrainGroup = 1 << 11, // 0800
265 BRaycastGroup = 1 << 12, // 1000
266 BSolidGroup = 1 << 13, // 2000
267 // BLinksetGroup = xx // a linkset proper is either static or dynamic
268 BLinksetChildGroup = 1 << 14, // 4000
269};
270
271// CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0
272// ERP controls amount of correction per tick. Usable range=0.1..0.8. Default=0.2.
273public enum ConstraintParams : int
274{
275 BT_CONSTRAINT_ERP = 1, // this one is not used in Bullet as of 20120730
276 BT_CONSTRAINT_STOP_ERP,
277 BT_CONSTRAINT_CFM,
278 BT_CONSTRAINT_STOP_CFM,
279};
280public enum ConstraintParamAxis : int
281{
282 AXIS_LINEAR_X = 0,
283 AXIS_LINEAR_Y,
284 AXIS_LINEAR_Z,
285 AXIS_ANGULAR_X,
286 AXIS_ANGULAR_Y,
287 AXIS_ANGULAR_Z,
288 AXIS_LINEAR_ALL = 20, // these last three added by BulletSim so we don't have to do zillions of calls
289 AXIS_ANGULAR_ALL,
290 AXIS_ALL
291};
292
293public abstract class BulletSimAPITemplate
294{
295// Initialization and simulation
296public abstract BulletWorld Initialize2(Vector3 maxPosition, IntPtr parms,
297 int maxCollisions, IntPtr collisionArray,
298 int maxUpdates, IntPtr updateArray
299 );
300
301public abstract bool UpdateParameter2(BulletWorld world, uint localID, String parm, float value);
302
303public abstract void SetHeightMap2(BulletWorld world, float[] heightmap);
304
305public abstract void Shutdown2(BulletWorld sim);
306
307public abstract int PhysicsStep2(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep,
308 out int updatedEntityCount,
309 out IntPtr updatedEntitiesPtr,
310 out int collidersCount,
311 out IntPtr collidersPtr);
312
313public abstract bool PushUpdate2(BulletBody obj);
314
315// =====================================================================================
316// Mesh, hull, shape and body creation helper routines
317public abstract BulletShape CreateMeshShape2(BulletWorld world,
318 int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices,
319 int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices );
320
321public abstract BulletShape CreateHullShape2(BulletWorld world,
322 int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls);
323
324public abstract BulletShape BuildHullShapeFromMesh2(BulletWorld world, BulletShape meshShape);
325
326public abstract BulletShape BuildNativeShape2(BulletWorld world, ShapeData shapeData);
327
328public abstract bool IsNativeShape2(BulletShape shape);
329
330public abstract void SetShapeCollisionMargin(BulletShape shape, float margin);
331
332public abstract BulletShape BuildCapsuleShape2(BulletWorld world, float radius, float height, Vector3 scale);
333
334public abstract BulletShape CreateCompoundShape2(BulletWorld sim, bool enableDynamicAabbTree);
335
336public abstract int GetNumberOfCompoundChildren2(BulletShape cShape);
337
338public abstract void AddChildShapeToCompoundShape2(BulletShape cShape, BulletShape addShape, Vector3 pos, Quaternion rot);
339
340public abstract BulletShape GetChildShapeFromCompoundShapeIndex2(BulletShape cShape, int indx);
341
342public abstract BulletShape RemoveChildShapeFromCompoundShapeIndex2(BulletShape cShape, int indx);
343
344public abstract void RemoveChildShapeFromCompoundShape2(BulletShape cShape, BulletShape removeShape);
345
346public abstract void RecalculateCompoundShapeLocalAabb2(BulletShape cShape);
347
348public abstract BulletShape DuplicateCollisionShape2(BulletWorld sim, BulletShape srcShape, uint id);
349
350public abstract BulletBody CreateBodyFromShapeAndInfo2(BulletWorld sim, BulletShape shape, uint id, IntPtr constructionInfo);
351
352public abstract bool DeleteCollisionShape2(BulletWorld world, BulletShape shape);
353
354public abstract int GetBodyType2(BulletBody obj);
355
356public abstract BulletBody CreateBodyFromShape2(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot);
357
358public abstract BulletBody CreateBodyWithDefaultMotionState2(BulletShape shape, uint id, Vector3 pos, Quaternion rot);
359
360public abstract BulletBody CreateGhostFromShape2(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot);
361
362public abstract IntPtr AllocateBodyInfo2(BulletBody obj);
363
364public abstract void ReleaseBodyInfo2(IntPtr obj);
365
366public abstract void DestroyObject2(BulletWorld sim, BulletBody obj);
367
368// =====================================================================================
369// Terrain creation and helper routines
370public abstract IntPtr CreateHeightMapInfo2(BulletWorld sim, uint id, Vector3 minCoords, Vector3 maxCoords,
371 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
372
373public abstract IntPtr FillHeightMapInfo2(BulletWorld sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords,
374 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
375
376public abstract bool ReleaseHeightMapInfo2(IntPtr heightMapInfo);
377
378public abstract BulletBody CreateGroundPlaneShape2(uint id, float height, float collisionMargin);
379
380public abstract BulletBody CreateTerrainShape2(IntPtr mapInfo);
381
382// =====================================================================================
383// Constraint creation and helper routines
384public abstract BulletConstraint Create6DofConstraint2(BulletWorld world, BulletBody obj1, BulletBody obj2,
385 Vector3 frame1loc, Quaternion frame1rot,
386 Vector3 frame2loc, Quaternion frame2rot,
387 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
388
389public abstract BulletConstraint Create6DofConstraintToPoint2(BulletWorld world, BulletBody obj1, BulletBody obj2,
390 Vector3 joinPoint,
391 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
392
393public abstract BulletConstraint CreateHingeConstraint2(BulletWorld world, BulletBody obj1, BulletBody obj2,
394 Vector3 pivotinA, Vector3 pivotinB,
395 Vector3 axisInA, Vector3 axisInB,
396 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
397
398public abstract void SetConstraintEnable2(BulletConstraint constrain, float numericTrueFalse);
399
400public abstract void SetConstraintNumSolverIterations2(BulletConstraint constrain, float iterations);
401
402public abstract bool SetFrames2(BulletConstraint constrain,
403 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot);
404
405public abstract bool SetLinearLimits2(BulletConstraint constrain, Vector3 low, Vector3 hi);
406
407public abstract bool SetAngularLimits2(BulletConstraint constrain, Vector3 low, Vector3 hi);
408
409public abstract bool UseFrameOffset2(BulletConstraint constrain, float enable);
410
411public abstract bool TranslationalLimitMotor2(BulletConstraint constrain, float enable, float targetVel, float maxMotorForce);
412
413public abstract bool SetBreakingImpulseThreshold2(BulletConstraint constrain, float threshold);
414
415public abstract bool CalculateTransforms2(BulletConstraint constrain);
416
417public abstract bool SetConstraintParam2(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis);
418
419public abstract bool DestroyConstraint2(BulletWorld world, BulletConstraint constrain);
420
421// =====================================================================================
422// btCollisionWorld entries
423public abstract void UpdateSingleAabb2(BulletWorld world, BulletBody obj);
424
425public abstract void UpdateAabbs2(BulletWorld world);
426
427public abstract bool GetForceUpdateAllAabbs2(BulletWorld world);
428
429public abstract void SetForceUpdateAllAabbs2(BulletWorld world, bool force);
430
431// =====================================================================================
432// btDynamicsWorld entries
433public abstract bool AddObjectToWorld2(BulletWorld world, BulletBody obj);
434
435public abstract bool RemoveObjectFromWorld2(BulletWorld world, BulletBody obj);
436
437public abstract bool AddConstraintToWorld2(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects);
438
439public abstract bool RemoveConstraintFromWorld2(BulletWorld world, BulletConstraint constrain);
440// =====================================================================================
441// btCollisionObject entries
442public abstract Vector3 GetAnisotripicFriction2(BulletConstraint constrain);
443
444public abstract Vector3 SetAnisotripicFriction2(BulletConstraint constrain, Vector3 frict);
445
446public abstract bool HasAnisotripicFriction2(BulletConstraint constrain);
447
448public abstract void SetContactProcessingThreshold2(BulletBody obj, float val);
449
450public abstract float GetContactProcessingThreshold2(BulletBody obj);
451
452public abstract bool IsStaticObject2(BulletBody obj);
453
454public abstract bool IsKinematicObject2(BulletBody obj);
455
456public abstract bool IsStaticOrKinematicObject2(BulletBody obj);
457
458public abstract bool HasContactResponse2(BulletBody obj);
459
460public abstract void SetCollisionShape2(BulletWorld sim, BulletBody obj, BulletBody shape);
461
462public abstract BulletShape GetCollisionShape2(BulletBody obj);
463
464public abstract int GetActivationState2(BulletBody obj);
465
466public abstract void SetActivationState2(BulletBody obj, int state);
467
468public abstract void SetDeactivationTime2(BulletBody obj, float dtime);
469
470public abstract float GetDeactivationTime2(BulletBody obj);
471
472public abstract void ForceActivationState2(BulletBody obj, ActivationState state);
473
474public abstract void Activate2(BulletBody obj, bool forceActivation);
475
476public abstract bool IsActive2(BulletBody obj);
477
478public abstract void SetRestitution2(BulletBody obj, float val);
479
480public abstract float GetRestitution2(BulletBody obj);
481
482public abstract void SetFriction2(BulletBody obj, float val);
483
484public abstract float GetFriction2(BulletBody obj);
485
486 /* Haven't defined the type 'Transform'
487public abstract Transform GetWorldTransform2(BulletBody obj);
488
489public abstract void setWorldTransform2(BulletBody obj, Transform trans);
490 */
491
492public abstract Vector3 GetPosition2(BulletBody obj);
493
494public abstract Quaternion GetOrientation2(BulletBody obj);
495
496public abstract void SetTranslation2(BulletBody obj, Vector3 position, Quaternion rotation);
497
498public abstract IntPtr GetBroadphaseHandle2(BulletBody obj);
499
500public abstract void SetBroadphaseHandle2(BulletBody obj, IntPtr handle);
501
502 /*
503public abstract Transform GetInterpolationWorldTransform2(IntPtr obj);
504
505public abstract void SetInterpolationWorldTransform2(IntPtr obj, Transform trans);
506 */
507
508public abstract void SetInterpolationLinearVelocity2(BulletBody obj, Vector3 vel);
509
510public abstract void SetInterpolationAngularVelocity2(BulletBody obj, Vector3 vel);
511
512public abstract void SetInterpolationVelocity2(BulletBody obj, Vector3 linearVel, Vector3 angularVel);
513
514public abstract float GetHitFraction2(BulletBody obj);
515
516public abstract void SetHitFraction2(BulletBody obj, float val);
517
518public abstract CollisionFlags GetCollisionFlags2(BulletBody obj);
519
520public abstract CollisionFlags SetCollisionFlags2(BulletBody obj, CollisionFlags flags);
521
522public abstract CollisionFlags AddToCollisionFlags2(BulletBody obj, CollisionFlags flags);
523
524public abstract CollisionFlags RemoveFromCollisionFlags2(BulletBody obj, CollisionFlags flags);
525
526public abstract float GetCcdMotionThreshold2(BulletBody obj);
527
528public abstract void SetCcdMotionThreshold2(BulletBody obj, float val);
529
530public abstract float GetCcdSweptSphereRadius2(BulletBody obj);
531
532public abstract void SetCcdSweptSphereRadius2(BulletBody obj, float val);
533
534public abstract IntPtr GetUserPointer2(BulletBody obj);
535
536public abstract void SetUserPointer2(BulletBody obj, IntPtr val);
537
538// =====================================================================================
539// btRigidBody entries
540public abstract void ApplyGravity2(BulletBody obj);
541
542public abstract void SetGravity2(BulletBody obj, Vector3 val);
543
544public abstract Vector3 GetGravity2(BulletBody obj);
545
546public abstract void SetDamping2(BulletBody obj, float lin_damping, float ang_damping);
547
548public abstract void SetLinearDamping2(BulletBody obj, float lin_damping);
549
550public abstract void SetAngularDamping2(BulletBody obj, float ang_damping);
551
552public abstract float GetLinearDamping2(BulletBody obj);
553
554public abstract float GetAngularDamping2(BulletBody obj);
555
556public abstract float GetLinearSleepingThreshold2(BulletBody obj);
557
558
559public abstract void ApplyDamping2(BulletBody obj, float timeStep);
560
561public abstract void SetMassProps2(BulletBody obj, float mass, Vector3 inertia);
562
563public abstract Vector3 GetLinearFactor2(BulletBody obj);
564
565public abstract void SetLinearFactor2(BulletBody obj, Vector3 factor);
566
567 /*
568public abstract void SetCenterOfMassTransform2(BulletBody obj, Transform trans);
569 */
570
571public abstract void SetCenterOfMassByPosRot2(BulletBody obj, Vector3 pos, Quaternion rot);
572
573// Add a force to the object as if its mass is one.
574public abstract void ApplyCentralForce2(BulletBody obj, Vector3 force);
575
576// Set the force being applied to the object as if its mass is one.
577public abstract void SetObjectForce2(BulletBody obj, Vector3 force);
578
579public abstract Vector3 GetTotalForce2(BulletBody obj);
580
581public abstract Vector3 GetTotalTorque2(BulletBody obj);
582
583public abstract Vector3 GetInvInertiaDiagLocal2(BulletBody obj);
584
585public abstract void SetInvInertiaDiagLocal2(BulletBody obj, Vector3 inert);
586
587public abstract void SetSleepingThresholds2(BulletBody obj, float lin_threshold, float ang_threshold);
588
589public abstract void ApplyTorque2(BulletBody obj, Vector3 torque);
590
591// Apply force at the given point. Will add torque to the object.
592public abstract void ApplyForce2(BulletBody obj, Vector3 force, Vector3 pos);
593
594// Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass.
595public abstract void ApplyCentralImpulse2(BulletBody obj, Vector3 imp);
596
597// Apply impulse to the object's torque. Force is scaled by object's mass.
598public abstract void ApplyTorqueImpulse2(BulletBody obj, Vector3 imp);
599
600// Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces.
601public abstract void ApplyImpulse2(BulletBody obj, Vector3 imp, Vector3 pos);
602
603public abstract void ClearForces2(BulletBody obj);
604
605public abstract void ClearAllForces2(BulletBody obj);
606
607public abstract void UpdateInertiaTensor2(BulletBody obj);
608
609
610 /*
611public abstract Transform GetCenterOfMassTransform2(BulletBody obj);
612 */
613
614public abstract Vector3 GetLinearVelocity2(BulletBody obj);
615
616public abstract Vector3 GetAngularVelocity2(BulletBody obj);
617
618public abstract void SetLinearVelocity2(BulletBody obj, Vector3 val);
619
620public abstract void SetAngularVelocity2(BulletBody obj, Vector3 angularVelocity);
621
622public abstract Vector3 GetVelocityInLocalPoint2(BulletBody obj, Vector3 pos);
623
624public abstract void Translate2(BulletBody obj, Vector3 trans);
625
626public abstract void UpdateDeactivation2(BulletBody obj, float timeStep);
627
628public abstract bool WantsSleeping2(BulletBody obj);
629
630public abstract void SetAngularFactor2(BulletBody obj, float factor);
631
632public abstract void SetAngularFactorV2(BulletBody obj, Vector3 factor);
633
634public abstract Vector3 GetAngularFactor2(BulletBody obj);
635
636public abstract bool IsInWorld2(BulletBody obj);
637
638public abstract void AddConstraintRef2(BulletBody obj, BulletConstraint constrain);
639
640public abstract void RemoveConstraintRef2(BulletBody obj, BulletConstraint constrain);
641
642public abstract BulletConstraint GetConstraintRef2(BulletBody obj, int index);
643
644public abstract int GetNumConstraintRefs2(BulletBody obj);
645
646public abstract bool SetCollisionGroupMask2(BulletBody body, uint filter, uint mask);
647
648// =====================================================================================
649// btCollisionShape entries
650
651public abstract float GetAngularMotionDisc2(BulletShape shape);
652
653public abstract float GetContactBreakingThreshold2(BulletShape shape, float defaultFactor);
654
655public abstract bool IsPolyhedral2(BulletShape shape);
656
657public abstract bool IsConvex2d2(BulletShape shape);
658
659public abstract bool IsConvex2(BulletShape shape);
660
661public abstract bool IsNonMoving2(BulletShape shape);
662
663public abstract bool IsConcave2(BulletShape shape);
664
665public abstract bool IsCompound2(BulletShape shape);
666
667public abstract bool IsSoftBody2(BulletShape shape);
668
669public abstract bool IsInfinite2(BulletShape shape);
670
671public abstract void SetLocalScaling2(BulletShape shape, Vector3 scale);
672
673public abstract Vector3 GetLocalScaling2(BulletShape shape);
674
675public abstract Vector3 CalculateLocalInertia2(BulletShape shape, float mass);
676
677public abstract int GetShapeType2(BulletShape shape);
678
679public abstract void SetMargin2(BulletShape shape, float val);
680
681public abstract float GetMargin2(BulletShape shape);
682
683};
684
685// ===============================================================================
686static class BulletSimAPI {
687// ===============================================================================
688// Link back to the managed code for outputting log messages
689[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
690public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg);
691
692// ===============================================================================
693// Initialization and simulation
694[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
695public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms,
696 int maxCollisions, IntPtr collisionArray,
697 int maxUpdates, IntPtr updateArray,
698 DebugLogCallback logRoutine);
699
700[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
701public static extern bool UpdateParameter2(IntPtr world, uint localID, String parm, float value);
702
703[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
704public static extern void SetHeightMap2(IntPtr world, float[] heightmap);
705
706[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
707public static extern void Shutdown2(IntPtr sim);
708
709[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
710public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep,
711 out int updatedEntityCount,
712 out IntPtr updatedEntitiesPtr,
713 out int collidersCount,
714 out IntPtr collidersPtr);
715
716[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
717public static extern bool PushUpdate2(IntPtr obj);
718
719// =====================================================================================
720// Mesh, hull, shape and body creation helper routines
721[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
722public static extern IntPtr CreateMeshShape2(IntPtr world,
723 int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices,
724 int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices );
725
726[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
727public static extern IntPtr CreateHullShape2(IntPtr world,
728 int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls);
729
730[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
731public static extern IntPtr BuildHullShapeFromMesh2(IntPtr world, IntPtr meshShape);
732
733[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
734public static extern IntPtr BuildNativeShape2(IntPtr world, ShapeData shapeData);
735
736[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
737public static extern bool IsNativeShape2(IntPtr shape);
738
739[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
740public static extern void SetShapeCollisionMargin(IntPtr shape, float margin);
741
742[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
743public static extern IntPtr BuildCapsuleShape2(IntPtr world, float radius, float height, Vector3 scale);
744
745[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
746public static extern IntPtr CreateCompoundShape2(IntPtr sim, bool enableDynamicAabbTree);
747
748[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
749public static extern int GetNumberOfCompoundChildren2(IntPtr cShape);
750
751[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
752public static extern void AddChildShapeToCompoundShape2(IntPtr cShape, IntPtr addShape, Vector3 pos, Quaternion rot);
753
754[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
755public static extern IntPtr GetChildShapeFromCompoundShapeIndex2(IntPtr cShape, int indx);
756
757[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
758public static extern IntPtr RemoveChildShapeFromCompoundShapeIndex2(IntPtr cShape, int indx);
759
760[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
761public static extern void RemoveChildShapeFromCompoundShape2(IntPtr cShape, IntPtr removeShape);
762
763[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
764public static extern void RecalculateCompoundShapeLocalAabb2(IntPtr cShape);
765
766[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
767public static extern IntPtr DuplicateCollisionShape2(IntPtr sim, IntPtr srcShape, uint id);
768
769[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
770public static extern IntPtr CreateBodyFromShapeAndInfo2(IntPtr sim, IntPtr shape, uint id, IntPtr constructionInfo);
771
772[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
773public static extern bool DeleteCollisionShape2(IntPtr world, IntPtr shape);
774
775[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
776public static extern int GetBodyType2(IntPtr obj);
777
778[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
779public static extern IntPtr CreateBodyFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot);
780
781[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
782public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, uint id, Vector3 pos, Quaternion rot);
783
784[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
785public static extern IntPtr CreateGhostFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot);
786
787[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
788public static extern IntPtr AllocateBodyInfo2(IntPtr obj);
789
790[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
791public static extern void ReleaseBodyInfo2(IntPtr obj);
792
793[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
794public static extern void DestroyObject2(IntPtr sim, IntPtr obj);
795
796// =====================================================================================
797// Terrain creation and helper routines
798[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
799public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords,
800 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
801
802[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
803public static extern IntPtr FillHeightMapInfo2(IntPtr sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords,
804 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
805
806[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
807public static extern bool ReleaseHeightMapInfo2(IntPtr heightMapInfo);
808
809[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
810public static extern IntPtr CreateGroundPlaneShape2(uint id, float height, float collisionMargin);
811
812[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
813public static extern IntPtr CreateTerrainShape2(IntPtr mapInfo);
814
815// =====================================================================================
816// Constraint creation and helper routines
817[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
818public static extern IntPtr Create6DofConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2,
819 Vector3 frame1loc, Quaternion frame1rot,
820 Vector3 frame2loc, Quaternion frame2rot,
821 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
822
823[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
824public static extern IntPtr Create6DofConstraintToPoint2(IntPtr world, IntPtr obj1, IntPtr obj2,
825 Vector3 joinPoint,
826 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
827
828[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
829public static extern IntPtr CreateHingeConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2,
830 Vector3 pivotinA, Vector3 pivotinB,
831 Vector3 axisInA, Vector3 axisInB,
832 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
833
834[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
835public static extern void SetConstraintEnable2(IntPtr constrain, float numericTrueFalse);
836
837[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
838public static extern void SetConstraintNumSolverIterations2(IntPtr constrain, float iterations);
839
840[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
841public static extern bool SetFrames2(IntPtr constrain,
842 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot);
843
844[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
845public static extern bool SetLinearLimits2(IntPtr constrain, Vector3 low, Vector3 hi);
846
847[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
848public static extern bool SetAngularLimits2(IntPtr constrain, Vector3 low, Vector3 hi);
849
850[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
851public static extern bool UseFrameOffset2(IntPtr constrain, float enable);
852
853[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
854public static extern bool TranslationalLimitMotor2(IntPtr constrain, float enable, float targetVel, float maxMotorForce);
855
856[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
857public static extern bool SetBreakingImpulseThreshold2(IntPtr constrain, float threshold);
858
859[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
860public static extern bool CalculateTransforms2(IntPtr constrain);
861
862[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
863public static extern bool SetConstraintParam2(IntPtr constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis);
864
865[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
866public static extern bool DestroyConstraint2(IntPtr world, IntPtr constrain);
867
868// =====================================================================================
869// btCollisionWorld entries
870[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
871public static extern void UpdateSingleAabb2(IntPtr world, IntPtr obj);
872
873[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
874public static extern void UpdateAabbs2(IntPtr world);
875
876[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
877public static extern bool GetForceUpdateAllAabbs2(IntPtr world);
878
879[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
880public static extern void SetForceUpdateAllAabbs2(IntPtr world, bool force);
881
882// =====================================================================================
883// btDynamicsWorld entries
884[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
885public static extern bool AddObjectToWorld2(IntPtr world, IntPtr obj);
886
887[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
888public static extern bool RemoveObjectFromWorld2(IntPtr world, IntPtr obj);
889
890[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
891public static extern bool AddConstraintToWorld2(IntPtr world, IntPtr constrain, bool disableCollisionsBetweenLinkedObjects);
892
893[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
894public static extern bool RemoveConstraintFromWorld2(IntPtr world, IntPtr constrain);
895// =====================================================================================
896// btCollisionObject entries
897[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
898public static extern Vector3 GetAnisotripicFriction2(IntPtr constrain);
899
900[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
901public static extern Vector3 SetAnisotripicFriction2(IntPtr constrain, Vector3 frict);
902
903[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
904public static extern bool HasAnisotripicFriction2(IntPtr constrain);
905
906[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
907public static extern void SetContactProcessingThreshold2(IntPtr obj, float val);
908
909[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
910public static extern float GetContactProcessingThreshold2(IntPtr obj);
911
912[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
913public static extern bool IsStaticObject2(IntPtr obj);
914
915[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
916public static extern bool IsKinematicObject2(IntPtr obj);
917
918[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
919public static extern bool IsStaticOrKinematicObject2(IntPtr obj);
920
921[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
922public static extern bool HasContactResponse2(IntPtr obj);
923
924[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
925public static extern void SetCollisionShape2(IntPtr sim, IntPtr obj, IntPtr shape);
926
927[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
928public static extern IntPtr GetCollisionShape2(IntPtr obj);
929
930[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
931public static extern int GetActivationState2(IntPtr obj);
932
933[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
934public static extern void SetActivationState2(IntPtr obj, int state);
935
936[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
937public static extern void SetDeactivationTime2(IntPtr obj, float dtime);
938
939[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
940public static extern float GetDeactivationTime2(IntPtr obj);
941
942[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
943public static extern void ForceActivationState2(IntPtr obj, ActivationState state);
944
945[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
946public static extern void Activate2(IntPtr obj, bool forceActivation);
947
948[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
949public static extern bool IsActive2(IntPtr obj);
950
951[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
952public static extern void SetRestitution2(IntPtr obj, float val);
953
954[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
955public static extern float GetRestitution2(IntPtr obj);
956
957[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
958public static extern void SetFriction2(IntPtr obj, float val);
959
960[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
961public static extern float GetFriction2(IntPtr obj);
962
963 /* Haven't defined the type 'Transform'
964[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
965public static extern Transform GetWorldTransform2(IntPtr obj);
966
967[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
968public static extern void setWorldTransform2(IntPtr obj, Transform trans);
969 */
970
971[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
972public static extern Vector3 GetPosition2(IntPtr obj);
973
974[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
975public static extern Quaternion GetOrientation2(IntPtr obj);
976
977[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
978public static extern void SetTranslation2(IntPtr obj, Vector3 position, Quaternion rotation);
979
980[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
981public static extern IntPtr GetBroadphaseHandle2(IntPtr obj);
982
983[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
984public static extern void SetBroadphaseHandle2(IntPtr obj, IntPtr handle);
985
986 /*
987[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
988public static extern Transform GetInterpolationWorldTransform2(IntPtr obj);
989
990[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
991public static extern void SetInterpolationWorldTransform2(IntPtr obj, Transform trans);
992 */
993
994[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
995public static extern void SetInterpolationLinearVelocity2(IntPtr obj, Vector3 vel);
996
997[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
998public static extern void SetInterpolationAngularVelocity2(IntPtr obj, Vector3 vel);
999
1000[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1001public static extern void SetInterpolationVelocity2(IntPtr obj, Vector3 linearVel, Vector3 angularVel);
1002
1003[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1004public static extern float GetHitFraction2(IntPtr obj);
1005
1006[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1007public static extern void SetHitFraction2(IntPtr obj, float val);
1008
1009[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1010public static extern CollisionFlags GetCollisionFlags2(IntPtr obj);
1011
1012[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1013public static extern CollisionFlags SetCollisionFlags2(IntPtr obj, CollisionFlags flags);
1014
1015[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1016public static extern CollisionFlags AddToCollisionFlags2(IntPtr obj, CollisionFlags flags);
1017
1018[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1019public static extern CollisionFlags RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags);
1020
1021[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1022public static extern float GetCcdMotionThreshold2(IntPtr obj);
1023
1024[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1025public static extern void SetCcdMotionThreshold2(IntPtr obj, float val);
1026
1027[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1028public static extern float GetCcdSweptSphereRadius2(IntPtr obj);
1029
1030[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1031public static extern void SetCcdSweptSphereRadius2(IntPtr obj, float val);
1032
1033[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1034public static extern IntPtr GetUserPointer2(IntPtr obj);
1035
1036[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1037public static extern void SetUserPointer2(IntPtr obj, IntPtr val);
1038
1039// =====================================================================================
1040// btRigidBody entries
1041[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1042public static extern void ApplyGravity2(IntPtr obj);
1043
1044[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1045public static extern void SetGravity2(IntPtr obj, Vector3 val);
1046
1047[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1048public static extern Vector3 GetGravity2(IntPtr obj);
1049
1050[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1051public static extern void SetDamping2(IntPtr obj, float lin_damping, float ang_damping);
1052
1053[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1054public static extern void SetLinearDamping2(IntPtr obj, float lin_damping);
1055
1056[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1057public static extern void SetAngularDamping2(IntPtr obj, float ang_damping);
1058
1059[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1060public static extern float GetLinearDamping2(IntPtr obj);
1061
1062[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1063public static extern float GetAngularDamping2(IntPtr obj);
1064
1065[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1066public static extern float GetLinearSleepingThreshold2(IntPtr obj);
1067
1068[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1069public static extern float GetAngularSleepingThreshold2(IntPtr obj);
1070
1071[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1072public static extern void ApplyDamping2(IntPtr obj, float timeStep);
1073
1074[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1075public static extern void SetMassProps2(IntPtr obj, float mass, Vector3 inertia);
1076
1077[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1078public static extern Vector3 GetLinearFactor2(IntPtr obj);
1079
1080[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1081public static extern void SetLinearFactor2(IntPtr obj, Vector3 factor);
1082
1083 /*
1084[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1085public static extern void SetCenterOfMassTransform2(IntPtr obj, Transform trans);
1086 */
1087
1088[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1089public static extern void SetCenterOfMassByPosRot2(IntPtr obj, Vector3 pos, Quaternion rot);
1090
1091// Add a force to the object as if its mass is one.
1092[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1093public static extern void ApplyCentralForce2(IntPtr obj, Vector3 force);
1094
1095// Set the force being applied to the object as if its mass is one.
1096[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1097public static extern void SetObjectForce2(IntPtr obj, Vector3 force);
1098
1099[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1100public static extern Vector3 GetTotalForce2(IntPtr obj);
1101
1102[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1103public static extern Vector3 GetTotalTorque2(IntPtr obj);
1104
1105[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1106public static extern Vector3 GetInvInertiaDiagLocal2(IntPtr obj);
1107
1108[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1109public static extern void SetInvInertiaDiagLocal2(IntPtr obj, Vector3 inert);
1110
1111[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1112public static extern void SetSleepingThresholds2(IntPtr obj, float lin_threshold, float ang_threshold);
1113
1114[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1115public static extern void ApplyTorque2(IntPtr obj, Vector3 torque);
1116
1117// Apply force at the given point. Will add torque to the object.
1118[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1119public static extern void ApplyForce2(IntPtr obj, Vector3 force, Vector3 pos);
1120
1121// Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass.
1122[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1123public static extern void ApplyCentralImpulse2(IntPtr obj, Vector3 imp);
1124
1125// Apply impulse to the object's torque. Force is scaled by object's mass.
1126[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1127public static extern void ApplyTorqueImpulse2(IntPtr obj, Vector3 imp);
1128
1129// Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces.
1130[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1131public static extern void ApplyImpulse2(IntPtr obj, Vector3 imp, Vector3 pos);
1132
1133[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1134public static extern void ClearForces2(IntPtr obj);
1135
1136[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1137public static extern void ClearAllForces2(IntPtr obj);
1138
1139[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1140public static extern void UpdateInertiaTensor2(IntPtr obj);
1141
1142[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1143public static extern Vector3 GetCenterOfMassPosition2(IntPtr obj);
1144
1145 /*
1146[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1147public static extern Transform GetCenterOfMassTransform2(IntPtr obj);
1148 */
1149
1150[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1151public static extern Vector3 GetLinearVelocity2(IntPtr obj);
1152
1153[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1154public static extern Vector3 GetAngularVelocity2(IntPtr obj);
1155
1156[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1157public static extern void SetLinearVelocity2(IntPtr obj, Vector3 val);
1158
1159[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1160public static extern void SetAngularVelocity2(IntPtr obj, Vector3 angularVelocity);
1161
1162[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1163public static extern Vector3 GetVelocityInLocalPoint2(IntPtr obj, Vector3 pos);
1164
1165[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1166public static extern void Translate2(IntPtr obj, Vector3 trans);
1167
1168[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1169public static extern void UpdateDeactivation2(IntPtr obj, float timeStep);
1170
1171[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1172public static extern bool WantsSleeping2(IntPtr obj);
1173
1174[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1175public static extern void SetAngularFactor2(IntPtr obj, float factor);
1176
1177[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1178public static extern void SetAngularFactorV2(IntPtr obj, Vector3 factor);
1179
1180[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1181public static extern Vector3 GetAngularFactor2(IntPtr obj);
1182
1183[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1184public static extern bool IsInWorld2(IntPtr obj);
1185
1186[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1187public static extern void AddConstraintRef2(IntPtr obj, IntPtr constrain);
1188
1189[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1190public static extern void RemoveConstraintRef2(IntPtr obj, IntPtr constrain);
1191
1192[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1193public static extern IntPtr GetConstraintRef2(IntPtr obj, int index);
1194
1195[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1196public static extern int GetNumConstraintRefs2(IntPtr obj);
1197
1198[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1199public static extern bool SetCollisionGroupMask2(IntPtr body, uint filter, uint mask);
1200
1201// =====================================================================================
1202// btCollisionShape entries
1203
1204[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1205public static extern float GetAngularMotionDisc2(IntPtr shape);
1206
1207[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1208public static extern float GetContactBreakingThreshold2(IntPtr shape, float defaultFactor);
1209
1210[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1211public static extern bool IsPolyhedral2(IntPtr shape);
1212
1213[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1214public static extern bool IsConvex2d2(IntPtr shape);
1215
1216[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1217public static extern bool IsConvex2(IntPtr shape);
1218
1219[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1220public static extern bool IsNonMoving2(IntPtr shape);
1221
1222[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1223public static extern bool IsConcave2(IntPtr shape);
1224
1225[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1226public static extern bool IsCompound2(IntPtr shape);
1227
1228[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1229public static extern bool IsSoftBody2(IntPtr shape);
1230
1231[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1232public static extern bool IsInfinite2(IntPtr shape);
1233
1234[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1235public static extern void SetLocalScaling2(IntPtr shape, Vector3 scale);
1236
1237[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1238public static extern Vector3 GetLocalScaling2(IntPtr shape);
1239
1240[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1241public static extern Vector3 CalculateLocalInertia2(IntPtr shape, float mass);
1242
1243[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1244public static extern int GetShapeType2(IntPtr shape);
1245
1246[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1247public static extern void SetMargin2(IntPtr shape, float val);
1248
1249[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1250public static extern float GetMargin2(IntPtr shape);
1251
1252// =====================================================================================
1253// Debugging
1254[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1255public static extern void DumpRigidBody2(IntPtr sim, IntPtr collisionObject);
1256
1257[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1258public static extern void DumpCollisionShape2(IntPtr sim, IntPtr collisionShape);
1259
1260[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1261public static extern void DumpMapInfo2(IntPtr sim, IntPtr manInfo);
1262
1263[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1264public static extern void DumpConstraint2(IntPtr sim, IntPtr constrain);
1265
1266[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1267public static extern void DumpActivationInfo2(IntPtr sim);
1268
1269[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1270public static extern void DumpAllInfo2(IntPtr sim);
1271
1272[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1273public static extern void DumpPhysicsStatistics2(IntPtr sim);
1274
1275}
1276}