aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs440
1 files changed, 410 insertions, 30 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
index d28c14b..e579cf2 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
@@ -218,7 +218,20 @@ public struct ConfigurationParameters
218 public const float numericFalse = 0f; 218 public const float numericFalse = 0f;
219} 219}
220 220
221// Values used by Bullet and BulletSim to control collisions 221
222// The states a bullet collision object can have
223public enum ActivationState : uint
224{
225 ACTIVE_TAG = 1,
226 ISLAND_SLEEPING,
227 WANTS_DEACTIVATION,
228 DISABLE_DEACTIVATION,
229 DISABLE_SIMULATION
230}
231
232// Values used by Bullet and BulletSim to control object properties.
233// Bullet's "CollisionFlags" has more to do with operations on the
234// object (if collisions happen, if gravity effects it, ...).
222public enum CollisionFlags : uint 235public enum CollisionFlags : uint
223{ 236{
224 CF_STATIC_OBJECT = 1 << 0, 237 CF_STATIC_OBJECT = 1 << 0,
@@ -233,8 +246,75 @@ public enum CollisionFlags : uint
233 BS_VOLUME_DETECT_OBJECT = 1 << 11, 246 BS_VOLUME_DETECT_OBJECT = 1 << 11,
234 BS_PHANTOM_OBJECT = 1 << 12, 247 BS_PHANTOM_OBJECT = 1 << 12,
235 BS_PHYSICAL_OBJECT = 1 << 13, 248 BS_PHYSICAL_OBJECT = 1 << 13,
249 BS_TERRAIN_OBJECT = 1 << 14,
250 BS_NONE = 0,
251 BS_ALL = 0xFFFFFFFF
252};
253
254// Values for collisions groups and masks
255public enum CollisionFilterGroups : uint
256{
257 NoneFilter = 0,
258 DefaultFilter = 1 << 0,
259 StaticFilter = 1 << 1,
260 KinematicFilter = 1 << 2,
261 DebrisFilter = 1 << 3,
262 SensorTrigger = 1 << 4,
263 CharacterFilter = 1 << 5,
264 AllFilter = 0xFFFFFFFF,
265 // Filter groups defined by BulletSim
266 GroundPlaneFilter = 1 << 10,
267 TerrainFilter = 1 << 11,
268 RaycastFilter = 1 << 12,
269 SolidFilter = 1 << 13,
236}; 270};
237 271
272 // For each type, we first clear and then set the collision flags
273public enum ClearCollisionFlag : uint
274{
275 Terrain = CollisionFlags.BS_ALL,
276 Phantom = CollisionFlags.BS_ALL,
277 VolumeDetect = CollisionFlags.BS_ALL,
278 PhysicalObject = CollisionFlags.BS_ALL,
279 StaticObject = CollisionFlags.BS_ALL
280}
281
282public enum SetCollisionFlag : uint
283{
284 Terrain = CollisionFlags.CF_STATIC_OBJECT
285 | CollisionFlags.BS_TERRAIN_OBJECT,
286 Phantom = CollisionFlags.CF_STATIC_OBJECT
287 | CollisionFlags.BS_PHANTOM_OBJECT
288 | CollisionFlags.CF_NO_CONTACT_RESPONSE,
289 VolumeDetect = CollisionFlags.CF_STATIC_OBJECT
290 | CollisionFlags.BS_VOLUME_DETECT_OBJECT
291 | CollisionFlags.CF_NO_CONTACT_RESPONSE,
292 PhysicalObject = CollisionFlags.BS_PHYSICAL_OBJECT,
293 StaticObject = CollisionFlags.CF_STATIC_OBJECT,
294}
295
296// Collision filters used for different types of objects
297public enum SetCollisionFilter : uint
298{
299 Terrain = CollisionFilterGroups.AllFilter,
300 Phantom = CollisionFilterGroups.GroundPlaneFilter
301 | CollisionFilterGroups.TerrainFilter,
302 VolumeDetect = CollisionFilterGroups.AllFilter,
303 PhysicalObject = CollisionFilterGroups.AllFilter,
304 StaticObject = CollisionFilterGroups.AllFilter,
305}
306
307// Collision masks used for different types of objects
308public enum SetCollisionMask : uint
309{
310 Terrain = CollisionFilterGroups.AllFilter,
311 Phantom = CollisionFilterGroups.GroundPlaneFilter
312 | CollisionFilterGroups.TerrainFilter,
313 VolumeDetect = CollisionFilterGroups.AllFilter,
314 PhysicalObject = CollisionFilterGroups.AllFilter,
315 StaticObject = CollisionFilterGroups.AllFilter
316}
317
238// CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0 318// CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0
239// ERP controls amount of correction per tick. Usable range=0.1..0.8. Default=0.2. 319// ERP controls amount of correction per tick. Usable range=0.1..0.8. Default=0.2.
240public enum ConstraintParams : int 320public enum ConstraintParams : int
@@ -347,6 +427,7 @@ public static extern bool SetObjectVelocity(uint worldID, uint id, Vector3 veloc
347[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 427[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
348public static extern bool SetObjectAngularVelocity(uint worldID, uint id, Vector3 angularVelocity); 428public static extern bool SetObjectAngularVelocity(uint worldID, uint id, Vector3 angularVelocity);
349 429
430// Set the current force acting on the object
350[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 431[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
351public static extern bool SetObjectForce(uint worldID, uint id, Vector3 force); 432public static extern bool SetObjectForce(uint worldID, uint id, Vector3 force);
352 433
@@ -403,6 +484,7 @@ public static extern void SetDebugLogCallback(DebugLogCallback callback);
403// The names have a "2" tacked on. This will be removed as the C# code gets rebuilt 484// The names have a "2" tacked on. This will be removed as the C# code gets rebuilt
404// and the old code is removed. 485// and the old code is removed.
405 486
487// Functions use while converting from API1 to API2. Can be removed when totally converted.
406[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 488[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
407public static extern IntPtr GetSimHandle2(uint worldID); 489public static extern IntPtr GetSimHandle2(uint worldID);
408 490
@@ -413,6 +495,7 @@ public static extern IntPtr GetBodyHandleWorldID2(uint worldID, uint id);
413public static extern IntPtr GetBodyHandle2(IntPtr world, uint id); 495public static extern IntPtr GetBodyHandle2(IntPtr world, uint id);
414 496
415// =============================================================================== 497// ===============================================================================
498// Initialization and simulation
416[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 499[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
417public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms, 500public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms,
418 int maxCollisions, IntPtr collisionArray, 501 int maxCollisions, IntPtr collisionArray,
@@ -438,6 +521,7 @@ public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSt
438public static extern bool PushUpdate2(IntPtr obj); 521public static extern bool PushUpdate2(IntPtr obj);
439 522
440// ===================================================================================== 523// =====================================================================================
524// Mesh, hull, shape and body creation helper routines
441[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 525[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
442public static extern IntPtr CreateMeshShape2(IntPtr world, 526public static extern IntPtr CreateMeshShape2(IntPtr world,
443 int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices, 527 int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices,
@@ -467,15 +551,19 @@ public static extern IntPtr CreateBodyFromShapeAndInfo2(IntPtr sim, IntPtr shape
467public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, Vector3 pos, Quaternion rot); 551public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, Vector3 pos, Quaternion rot);
468 552
469[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 553[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
470public static extern bool SetBodyShape2(IntPtr sim, IntPtr obj, IntPtr shape);
471
472[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
473public static extern IntPtr AllocateBodyInfo2(IntPtr obj); 554public static extern IntPtr AllocateBodyInfo2(IntPtr obj);
474 555
475[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 556[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
476public static extern void ReleaseBodyInfo2(IntPtr obj); 557public static extern void ReleaseBodyInfo2(IntPtr obj);
477 558
559[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
560public static extern void DestroyObject2(IntPtr sim, IntPtr obj);
561
478// ===================================================================================== 562// =====================================================================================
563// Terrain creation and helper routines
564[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
565public static extern void DumpMapInfo(IntPtr sim, IntPtr manInfo);
566
479[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 567[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
480public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords, 568public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords,
481 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin); 569 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
@@ -494,6 +582,7 @@ public static extern IntPtr CreateGroundPlaneShape2(uint id, float height, float
494public static extern IntPtr CreateTerrainShape2(IntPtr mapInfo); 582public static extern IntPtr CreateTerrainShape2(IntPtr mapInfo);
495 583
496// ===================================================================================== 584// =====================================================================================
585// Constraint creation and helper routines
497[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 586[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
498public static extern IntPtr Create6DofConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, 587public static extern IntPtr Create6DofConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2,
499 Vector3 frame1loc, Quaternion frame1rot, 588 Vector3 frame1loc, Quaternion frame1rot,
@@ -546,69 +635,145 @@ public static extern bool SetConstraintParam2(IntPtr constrain, ConstraintParams
546public static extern bool DestroyConstraint2(IntPtr world, IntPtr constrain); 635public static extern bool DestroyConstraint2(IntPtr world, IntPtr constrain);
547 636
548// ===================================================================================== 637// =====================================================================================
638// btCollisionWorld entries
639[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
640public static extern void UpdateSingleAabb2(IntPtr world, IntPtr obj);
641
642[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
643public static extern void UpdateAabbs2(IntPtr world);
644
645[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
646public static extern bool GetForceUpdateAllAabbs2(IntPtr world);
647
648[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
649public static extern void SetForceUpdateAllAabbs2(IntPtr world, bool force);
650
651// =====================================================================================
652// btDynamicsWorld entries
549[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 653[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
550public static extern bool AddObjectToWorld2(IntPtr world, IntPtr obj); 654public static extern bool AddObjectToWorld2(IntPtr world, IntPtr obj);
551 655
552[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 656[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
553public static extern bool RemoveObjectFromWorld2(IntPtr world, IntPtr obj); 657public static extern bool RemoveObjectFromWorld2(IntPtr world, IntPtr obj);
554 658
659[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
660public static extern bool AddConstraintToWorld2(IntPtr world, IntPtr constrain, bool disableCollisionsBetweenLinkedObjects);
661
662[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
663public static extern bool RemoveConstraintFromWorld2(IntPtr world, IntPtr constrain);
555// ===================================================================================== 664// =====================================================================================
665// btCollisionObject entries
666[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
667public static extern Vector3 GetAnisotripicFriction2(IntPtr constrain);
668
669[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
670public static extern Vector3 SetAnisotripicFriction2(IntPtr constrain, Vector3 frict);
671
672[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
673public static extern bool HasAnisotripicFriction2(IntPtr constrain);
674
675[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
676public static extern void SetContactProcessingThreshold2(IntPtr obj, float val);
677
678[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
679public static extern float GetContactProcessingThreshold2(IntPtr obj);
680
681[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
682public static extern bool IsStaticObject2(IntPtr obj);
683
684[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
685public static extern bool IsKinematicObject2(IntPtr obj);
686
687[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
688public static extern bool IsStaticOrKinematicObject2(IntPtr obj);
689
690[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
691public static extern bool HasContactResponse2(IntPtr obj);
692
693[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
694public static extern void SetCollisionShape2(IntPtr sim, IntPtr obj, IntPtr shape);
695
696[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
697public static extern IntPtr GetCollisionShape2(IntPtr obj);
698
699[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
700public static extern int GetActivationState2(IntPtr obj);
701
702[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
703public static extern void SetActivationState2(IntPtr obj, int state);
704
705[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
706public static extern void SetDeactivationTime2(IntPtr obj, float dtime);
707
708[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
709public static extern float GetDeactivationTime2(IntPtr obj);
710
711[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
712public static extern void ForceActivationState2(IntPtr obj, ActivationState state);
713
556[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 714[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
557public static extern void Activate2(IntPtr obj, bool forceActivation); 715public static extern void Activate2(IntPtr obj, bool forceActivation);
558 716
559[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 717[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
560public static extern Vector3 GetPosition2(IntPtr obj); 718public static extern bool IsActive2(IntPtr obj);
561 719
562[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 720[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
563public static extern Quaternion GetOrientation2(IntPtr obj); 721public static extern void SetRestitution2(IntPtr obj, float val);
564 722
565[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 723[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
566public static extern bool SetTranslation2(IntPtr obj, Vector3 position, Quaternion rotation); 724public static extern float GetRestitution2(IntPtr obj);
567 725
568[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 726[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
569public static extern bool SetVelocity2(IntPtr obj, Vector3 velocity); 727public static extern void SetFriction2(IntPtr obj, float val);
570 728
571[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 729[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
572public static extern bool SetAngularVelocity2(IntPtr obj, Vector3 angularVelocity); 730public static extern float GetFriction2(IntPtr obj);
573 731
732 /* Haven't defined the type 'Transform'
574[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 733[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
575public static extern bool SetObjectForce2(IntPtr obj, Vector3 force); 734public static extern Transform GetWorldTransform2(IntPtr obj);
576 735
577[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 736[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
578public static extern bool AddObjectForce2(IntPtr obj, Vector3 force); 737public static extern void setWorldTransform2(IntPtr obj, Transform trans);
738 */
579 739
580[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 740[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
581public static extern bool SetCcdMotionThreshold2(IntPtr obj, float val); 741public static extern Vector3 GetPosition2(IntPtr obj);
582 742
583[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 743[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
584public static extern bool SetCcdSweepSphereRadius2(IntPtr obj, float val); 744public static extern Quaternion GetOrientation2(IntPtr obj);
585 745
586[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 746[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
587public static extern bool SetDamping2(IntPtr obj, float lin_damping, float ang_damping); 747public static extern void SetTranslation2(IntPtr obj, Vector3 position, Quaternion rotation);
588 748
589[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 749[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
590public static extern bool SetDeactivationTime2(IntPtr obj, float val); 750public static extern IntPtr GetBroadphaseHandle2(IntPtr obj);
591 751
592[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 752[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
593public static extern bool SetSleepingThresholds2(IntPtr obj, float lin_threshold, float ang_threshold); 753public static extern void SetBroadphaseHandle2(IntPtr obj, IntPtr handle);
594 754
755 /*
595[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 756[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
596public static extern bool SetContactProcessingThreshold2(IntPtr obj, float val); 757public static extern Transform GetInterpolationWorldTransform2(IntPtr obj);
597 758
598[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 759[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
599public static extern bool SetFriction2(IntPtr obj, float val); 760public static extern void SetInterpolationWorldTransform2(IntPtr obj, Transform trans);
761 */
600 762
601[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 763[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
602public static extern bool SetHitFraction2(IntPtr obj, float val); 764public static extern void SetInterpolationLinearVelocity2(IntPtr obj, Vector3 vel);
603 765
604[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 766[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
605public static extern bool SetRestitution2(IntPtr obj, float val); 767public static extern void SetInterpolationAngularVelocity2(IntPtr obj, Vector3 vel);
606 768
607[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 769[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
608public static extern bool SetLinearVelocity2(IntPtr obj, Vector3 val); 770public static extern void SetInterpolationVelocity2(IntPtr obj, Vector3 linearVel, Vector3 angularVel);
609 771
610[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 772[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
611public static extern bool SetInterpolation2(IntPtr obj, Vector3 lin, Vector3 ang); 773public static extern float GetHitFraction2(IntPtr obj);
774
775[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
776public static extern void SetHitFraction2(IntPtr obj, float val);
612 777
613[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 778[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
614public static extern CollisionFlags GetCollisionFlags2(IntPtr obj); 779public static extern CollisionFlags GetCollisionFlags2(IntPtr obj);
@@ -623,30 +788,245 @@ public static extern CollisionFlags AddToCollisionFlags2(IntPtr obj, CollisionFl
623public static extern CollisionFlags RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags); 788public static extern CollisionFlags RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags);
624 789
625[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 790[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
626public static extern bool SetMassProps2(IntPtr obj, float mass, Vector3 inertia); 791public static extern float GetCcdMotionThreshold2(IntPtr obj);
792
793[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
794public static extern void SetCcdMotionThreshold2(IntPtr obj, float val);
795
796[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
797public static extern float GetCcdSweepSphereRadius2(IntPtr obj);
798
799[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
800public static extern void SetCcdSweepSphereRadius2(IntPtr obj, float val);
801
802[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
803public static extern IntPtr GetUserPointer2(IntPtr obj);
804
805[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
806public static extern void SetUserPointer2(IntPtr obj, IntPtr val);
807
808// =====================================================================================
809// btRigidBody entries
810[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
811public static extern void ApplyGravity2(IntPtr obj);
812
813[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
814public static extern void SetGravity2(IntPtr obj, Vector3 val);
815
816[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
817public static extern Vector3 GetGravity2(IntPtr obj);
818
819[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
820public static extern void SetDamping2(IntPtr obj, float lin_damping, float ang_damping);
821
822[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
823public static extern float GetLinearDamping2(IntPtr obj);
824
825[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
826public static extern float GetAngularDamping2(IntPtr obj);
827
828[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
829public static extern float GetLinearSleepingThreshold2(IntPtr obj);
830
831[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
832public static extern float GetAngularSleepingThreshold2(IntPtr obj);
833
834[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
835public static extern void ApplyDamping2(IntPtr obj, float timeStep);
836
837[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
838public static extern void SetMassProps2(IntPtr obj, float mass, Vector3 inertia);
627 839
628[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 840[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
629public static extern bool UpdateInertiaTensor2(IntPtr obj); 841public static extern Vector3 GetLinearFactor2(IntPtr obj);
630 842
631[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 843[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
632public static extern bool SetGravity2(IntPtr obj, Vector3 val); 844public static extern void SetLinearFactor2(IntPtr obj, Vector3 factor);
633 845
846 /*
634[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 847[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
635public static extern IntPtr ClearForces2(IntPtr obj); 848public static extern void SetCenterOfMassTransform2(IntPtr obj, Transform trans);
849 */
636 850
637[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 851[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
638public static extern IntPtr ClearAllForces2(IntPtr obj); 852public static extern void SetCenterOfMassByPosRot2(IntPtr obj, Vector3 pos, Quaternion rot);
639 853
854// Add a force to the object as if its mass is one.
640[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 855[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
641public static extern bool SetMargin2(IntPtr obj, float val); 856public static extern void ApplyCentralForce2(IntPtr obj, Vector3 force);
642 857
858// Set the force being applied to the object as if its mass is one.
643[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 859[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
644public static extern bool UpdateSingleAabb2(IntPtr world, IntPtr obj); 860public static extern void SetObjectForce2(IntPtr obj, Vector3 force);
645 861
646[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 862[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
647public static extern bool DestroyObject2(IntPtr world, IntPtr obj); 863public static extern Vector3 GetTotalForce2(IntPtr obj);
648 864
649[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 865[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
866public static extern Vector3 GetTotalTorque2(IntPtr obj);
867
868[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
869public static extern Vector3 GetInvInertiaDiagLocal2(IntPtr obj);
870
871[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
872public static extern void SetInvInertiaDiagLocal2(IntPtr obj, Vector3 inert);
873
874[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
875public static extern void SetSleepingThresholds2(IntPtr obj, float lin_threshold, float ang_threshold);
876
877[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
878public static extern void ApplyTorque2(IntPtr obj, Vector3 torque);
879
880// Apply force at the given point. Will add torque to the object.
881[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
882public static extern void ApplyForce2(IntPtr obj, Vector3 force, Vector3 pos);
883
884// Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass.
885[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
886public static extern void ApplyCentralImpulse2(IntPtr obj, Vector3 imp);
887
888// Apply impulse to the object's torque. Force is scaled by object's mass.
889[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
890public static extern void ApplyTorqueImpulse2(IntPtr obj, Vector3 imp);
891
892// Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces.
893[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
894public static extern void ApplyImpulse2(IntPtr obj, Vector3 imp, Vector3 pos);
895
896[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
897public static extern void ClearForces2(IntPtr obj);
898
899[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
900public static extern void ClearAllForces2(IntPtr obj);
901
902[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
903public static extern void UpdateInertiaTensor2(IntPtr obj);
904
905[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
906public static extern Vector3 GetCenterOfMassPosition2(IntPtr obj);
907
908 /*
909[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
910public static extern Transform GetCenterOfMassTransform2(IntPtr obj);
911 */
912
913[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
914public static extern Vector3 GetLinearVelocity2(IntPtr obj);
915
916[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
917public static extern Vector3 GetAngularVelocity2(IntPtr obj);
918
919[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
920public static extern void SetLinearVelocity2(IntPtr obj, Vector3 val);
921
922[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
923public static extern void SetAngularVelocity2(IntPtr obj, Vector3 angularVelocity);
924
925[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
926public static extern Vector3 GetVelocityInLocalPoint2(IntPtr obj, Vector3 pos);
927
928[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
929public static extern void Translate2(IntPtr obj, Vector3 trans);
930
931[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
932public static extern void UpdateDeactivation2(IntPtr obj, float timeStep);
933
934[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
935public static extern bool WantsSleeping2(IntPtr obj);
936
937[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
938public static extern void SetAngularFactor2(IntPtr obj, float factor);
939
940[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
941public static extern void SetAngularFactorV2(IntPtr obj, Vector3 factor);
942
943[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
944public static extern Vector3 GetAngularFactor2(IntPtr obj);
945
946[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
947public static extern bool IsInWorld2(IntPtr obj);
948
949[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
950public static extern void AddConstraintRef2(IntPtr obj, IntPtr constrain);
951
952[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
953public static extern void RemoveConstraintRef2(IntPtr obj, IntPtr constrain);
954
955[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
956public static extern IntPtr GetConstraintRef2(IntPtr obj, int index);
957
958[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
959public static extern int GetNumConstraintRefs2(IntPtr obj);
960
961[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
962public static extern Vector3 GetDeltaLinearVelocity2(IntPtr obj);
963
964[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
965public static extern Vector3 GetDeltaAngularVelocity2(IntPtr obj);
966
967[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
968public static extern Vector3 GetPushVelocity2(IntPtr obj);
969
970[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
971public static extern Vector3 GetTurnVelocity2(IntPtr obj);
972
973// =====================================================================================
974// btCollisionShape entries
975
976[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
977public static extern float GetAngularMotionDisc2(IntPtr shape);
978
979[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
980public static extern float GetContactBreakingThreshold2(IntPtr shape, float defaultFactor);
981
982[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
983public static extern bool IsPolyhedral2(IntPtr shape);
984
985[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
986public static extern bool IsConvex2d2(IntPtr shape);
987
988[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
989public static extern bool IsConvex2(IntPtr shape);
990
991[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
992public static extern bool IsNonMoving2(IntPtr shape);
993
994[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
995public static extern bool IsConcave2(IntPtr shape);
996
997[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
998public static extern bool IsCompound2(IntPtr shape);
999
1000[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1001public static extern bool IsSoftBody2(IntPtr shape);
1002
1003[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1004public static extern bool IsInfinite2(IntPtr shape);
1005
1006[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1007public static extern void SetLocalScaling2(IntPtr shape, Vector3 scale);
1008
1009[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1010public static extern Vector3 GetLocalScaling2(IntPtr shape);
1011
1012[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1013public static extern void CalculateLocalInertia2(IntPtr shape, float mass, Vector3 inertia);
1014
1015[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1016public static extern int GetShapeType2(IntPtr shape);
1017
1018[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1019public static extern void SetMargin2(IntPtr shape, float val);
1020
1021[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1022public static extern float GetMargin2(IntPtr shape);
1023
1024[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1025public static extern void SetCollisionFilterMask(IntPtr shape, uint filter, uint mask);
1026
1027// =====================================================================================
1028// Debugging
1029[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
650public static extern void DumpPhysicsStatistics2(IntPtr sim); 1030public static extern void DumpPhysicsStatistics2(IntPtr sim);
651 1031
652} 1032}