aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs688
1 files changed, 688 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
new file mode 100644
index 0000000..f25b447
--- /dev/null
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
@@ -0,0 +1,688 @@
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 copyright
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 public float penetration;
134}
135[StructLayout(LayoutKind.Sequential)]
136public struct EntityProperties
137{
138 public uint ID;
139 public Vector3 Position;
140 public Quaternion Rotation;
141 public Vector3 Velocity;
142 public Vector3 Acceleration;
143 public Vector3 RotationalVelocity;
144
145 public override string ToString()
146 {
147 StringBuilder buff = new StringBuilder();
148 buff.Append("<i=");
149 buff.Append(ID.ToString());
150 buff.Append(",p=");
151 buff.Append(Position.ToString());
152 buff.Append(",r=");
153 buff.Append(Rotation.ToString());
154 buff.Append(",v=");
155 buff.Append(Velocity.ToString());
156 buff.Append(",a=");
157 buff.Append(Acceleration.ToString());
158 buff.Append(",rv=");
159 buff.Append(RotationalVelocity.ToString());
160 buff.Append(">");
161 return buff.ToString();
162 }
163}
164
165// Format of this structure must match the definition in the C++ code
166// NOTE: adding the X causes compile breaks if used. These are unused symbols
167// that can be removed from both here and the unmanaged definition of this structure.
168[StructLayout(LayoutKind.Sequential)]
169public struct ConfigurationParameters
170{
171 public float defaultFriction;
172 public float defaultDensity;
173 public float defaultRestitution;
174 public float collisionMargin;
175 public float gravity;
176
177 public float XlinearDamping;
178 public float XangularDamping;
179 public float XdeactivationTime;
180 public float XlinearSleepingThreshold;
181 public float XangularSleepingThreshold;
182 public float XccdMotionThreshold;
183 public float XccdSweptSphereRadius;
184 public float XcontactProcessingThreshold;
185
186 public float XterrainImplementation;
187 public float XterrainFriction;
188 public float XterrainHitFraction;
189 public float XterrainRestitution;
190 public float XterrainCollisionMargin;
191
192 public float XavatarFriction;
193 public float XavatarStandingFriction;
194 public float XavatarDensity;
195 public float XavatarRestitution;
196 public float XavatarCapsuleWidth;
197 public float XavatarCapsuleDepth;
198 public float XavatarCapsuleHeight;
199 public float XavatarContactProcessingThreshold;
200
201 public float XvehicleAngularDamping;
202
203 public float maxPersistantManifoldPoolSize;
204 public float maxCollisionAlgorithmPoolSize;
205 public float shouldDisableContactPoolDynamicAllocation;
206 public float shouldForceUpdateAllAabbs;
207 public float shouldRandomizeSolverOrder;
208 public float shouldSplitSimulationIslands;
209 public float shouldEnableFrictionCaching;
210 public float numberOfSolverIterations;
211
212 public float XlinksetImplementation;
213 public float XlinkConstraintUseFrameOffset;
214 public float XlinkConstraintEnableTransMotor;
215 public float XlinkConstraintTransMotorMaxVel;
216 public float XlinkConstraintTransMotorMaxForce;
217 public float XlinkConstraintERP;
218 public float XlinkConstraintCFM;
219 public float XlinkConstraintSolverIterations;
220
221 public float XphysicsLoggingFrames;
222
223 public const float numericTrue = 1f;
224 public const float numericFalse = 0f;
225}
226
227
228// The states a bullet collision object can have
229public enum ActivationState : uint
230{
231 ACTIVE_TAG = 1,
232 ISLAND_SLEEPING,
233 WANTS_DEACTIVATION,
234 DISABLE_DEACTIVATION,
235 DISABLE_SIMULATION,
236}
237
238public enum CollisionObjectTypes : int
239{
240 CO_COLLISION_OBJECT = 1 << 0,
241 CO_RIGID_BODY = 1 << 1,
242 CO_GHOST_OBJECT = 1 << 2,
243 CO_SOFT_BODY = 1 << 3,
244 CO_HF_FLUID = 1 << 4,
245 CO_USER_TYPE = 1 << 5,
246}
247
248// Values used by Bullet and BulletSim to control object properties.
249// Bullet's "CollisionFlags" has more to do with operations on the
250// object (if collisions happen, if gravity effects it, ...).
251public enum CollisionFlags : uint
252{
253 CF_STATIC_OBJECT = 1 << 0,
254 CF_KINEMATIC_OBJECT = 1 << 1,
255 CF_NO_CONTACT_RESPONSE = 1 << 2,
256 CF_CUSTOM_MATERIAL_CALLBACK = 1 << 3,
257 CF_CHARACTER_OBJECT = 1 << 4,
258 CF_DISABLE_VISUALIZE_OBJECT = 1 << 5,
259 CF_DISABLE_SPU_COLLISION_PROCESS = 1 << 6,
260 // Following used by BulletSim to control collisions and updates
261 BS_SUBSCRIBE_COLLISION_EVENTS = 1 << 10,
262 BS_FLOATS_ON_WATER = 1 << 11,
263 BS_VEHICLE_COLLISIONS = 1 << 12,
264 BS_NONE = 0,
265 BS_ALL = 0xFFFFFFFF
266};
267
268// Values f collisions groups and masks
269public enum CollisionFilterGroups : uint
270{
271 // Don't use the bit definitions!! Define the use in a
272 // filter/mask definition below. This way collision interactions
273 // are more easily found and debugged.
274 BNoneGroup = 0,
275 BDefaultGroup = 1 << 0, // 0001
276 BStaticGroup = 1 << 1, // 0002
277 BKinematicGroup = 1 << 2, // 0004
278 BDebrisGroup = 1 << 3, // 0008
279 BSensorTrigger = 1 << 4, // 0010
280 BCharacterGroup = 1 << 5, // 0020
281 BAllGroup = 0x000FFFFF,
282 // Filter groups defined by BulletSim
283 BGroundPlaneGroup = 1 << 10, // 0400
284 BTerrainGroup = 1 << 11, // 0800
285 BRaycastGroup = 1 << 12, // 1000
286 BSolidGroup = 1 << 13, // 2000
287 // BLinksetGroup = xx // a linkset proper is either static or dynamic
288 BLinksetChildGroup = 1 << 14, // 4000
289};
290
291// CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0
292// ERP controls amount of correction per tick. Usable range=0.1..0.8. Default=0.2.
293public enum ConstraintParams : int
294{
295 BT_CONSTRAINT_ERP = 1, // this one is not used in Bullet as of 20120730
296 BT_CONSTRAINT_STOP_ERP,
297 BT_CONSTRAINT_CFM,
298 BT_CONSTRAINT_STOP_CFM,
299};
300public enum ConstraintParamAxis : int
301{
302 AXIS_LINEAR_X = 0,
303 AXIS_LINEAR_Y,
304 AXIS_LINEAR_Z,
305 AXIS_ANGULAR_X,
306 AXIS_ANGULAR_Y,
307 AXIS_ANGULAR_Z,
308 AXIS_LINEAR_ALL = 20, // these last three added by BulletSim so we don't have to do zillions of calls
309 AXIS_ANGULAR_ALL,
310 AXIS_ALL
311};
312
313public abstract class BSAPITemplate
314{
315// Returns the name of the underlying Bullet engine
316public abstract string BulletEngineName { get; }
317public abstract string BulletEngineVersion { get; protected set;}
318
319// Initialization and simulation
320public abstract BulletWorld Initialize(Vector3 maxPosition, ConfigurationParameters parms,
321 int maxCollisions, ref CollisionDesc[] collisionArray,
322 int maxUpdates, ref EntityProperties[] updateArray
323 );
324
325public abstract int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep,
326 out int updatedEntityCount, out int collidersCount);
327
328public abstract bool UpdateParameter(BulletWorld world, uint localID, String parm, float value);
329
330public abstract void Shutdown(BulletWorld sim);
331
332public abstract bool PushUpdate(BulletBody obj);
333
334// =====================================================================================
335// Mesh, hull, shape and body creation helper routines
336public abstract BulletShape CreateMeshShape(BulletWorld world,
337 int indicesCount, int[] indices,
338 int verticesCount, float[] vertices );
339
340public abstract BulletShape CreateHullShape(BulletWorld world,
341 int hullCount, float[] hulls);
342
343public abstract BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape);
344
345public abstract BulletShape BuildNativeShape(BulletWorld world, ShapeData shapeData);
346
347public abstract bool IsNativeShape(BulletShape shape);
348
349public abstract void SetShapeCollisionMargin(BulletShape shape, float margin);
350
351public abstract BulletShape BuildCapsuleShape(BulletWorld world, float radius, float height, Vector3 scale);
352
353public abstract BulletShape CreateCompoundShape(BulletWorld sim, bool enableDynamicAabbTree);
354
355public abstract int GetNumberOfCompoundChildren(BulletShape cShape);
356
357public abstract void AddChildShapeToCompoundShape(BulletShape cShape, BulletShape addShape, Vector3 pos, Quaternion rot);
358
359public abstract BulletShape GetChildShapeFromCompoundShapeIndex(BulletShape cShape, int indx);
360
361public abstract BulletShape RemoveChildShapeFromCompoundShapeIndex(BulletShape cShape, int indx);
362
363public abstract void RemoveChildShapeFromCompoundShape(BulletShape cShape, BulletShape removeShape);
364
365public abstract void UpdateChildTransform(BulletShape pShape, int childIndex, Vector3 pos, Quaternion rot, bool shouldRecalculateLocalAabb);
366
367public abstract void RecalculateCompoundShapeLocalAabb(BulletShape cShape);
368
369public abstract BulletShape DuplicateCollisionShape(BulletWorld sim, BulletShape srcShape, uint id);
370
371public abstract bool DeleteCollisionShape(BulletWorld world, BulletShape shape);
372
373public abstract CollisionObjectTypes GetBodyType(BulletBody obj);
374
375public abstract BulletBody CreateBodyFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot);
376
377public abstract BulletBody CreateBodyWithDefaultMotionState(BulletShape shape, uint id, Vector3 pos, Quaternion rot);
378
379public abstract BulletBody CreateGhostFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot);
380
381public abstract void DestroyObject(BulletWorld sim, BulletBody obj);
382
383// =====================================================================================
384public abstract BulletShape CreateGroundPlaneShape(uint id, float height, float collisionMargin);
385
386public abstract BulletShape CreateTerrainShape(uint id, Vector3 size, float minHeight, float maxHeight, float[] heightMap,
387 float scaleFactor, float collisionMargin);
388
389// =====================================================================================
390// Constraint creation and helper routines
391public abstract BulletConstraint Create6DofConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2,
392 Vector3 frame1loc, Quaternion frame1rot,
393 Vector3 frame2loc, Quaternion frame2rot,
394 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
395
396public abstract BulletConstraint Create6DofConstraintToPoint(BulletWorld world, BulletBody obj1, BulletBody obj2,
397 Vector3 joinPoint,
398 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
399
400public abstract BulletConstraint CreateHingeConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2,
401 Vector3 pivotinA, Vector3 pivotinB,
402 Vector3 axisInA, Vector3 axisInB,
403 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
404
405public abstract void SetConstraintEnable(BulletConstraint constrain, float numericTrueFalse);
406
407public abstract void SetConstraintNumSolverIterations(BulletConstraint constrain, float iterations);
408
409public abstract bool SetFrames(BulletConstraint constrain,
410 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot);
411
412public abstract bool SetLinearLimits(BulletConstraint constrain, Vector3 low, Vector3 hi);
413
414public abstract bool SetAngularLimits(BulletConstraint constrain, Vector3 low, Vector3 hi);
415
416public abstract bool UseFrameOffset(BulletConstraint constrain, float enable);
417
418public abstract bool TranslationalLimitMotor(BulletConstraint constrain, float enable, float targetVel, float maxMotorForce);
419
420public abstract bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold);
421
422public abstract bool CalculateTransforms(BulletConstraint constrain);
423
424public abstract bool SetConstraintParam(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis);
425
426public abstract bool DestroyConstraint(BulletWorld world, BulletConstraint constrain);
427
428// =====================================================================================
429// btCollisionWorld entries
430public abstract void UpdateSingleAabb(BulletWorld world, BulletBody obj);
431
432public abstract void UpdateAabbs(BulletWorld world);
433
434public abstract bool GetForceUpdateAllAabbs(BulletWorld world);
435
436public abstract void SetForceUpdateAllAabbs(BulletWorld world, bool force);
437
438// =====================================================================================
439// btDynamicsWorld entries
440// public abstract bool AddObjectToWorld(BulletWorld world, BulletBody obj, Vector3 pos, Quaternion rot);
441public abstract bool AddObjectToWorld(BulletWorld world, BulletBody obj);
442
443public abstract bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj);
444
445public abstract bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects);
446
447public abstract bool RemoveConstraintFromWorld(BulletWorld world, BulletConstraint constrain);
448// =====================================================================================
449// btCollisionObject entries
450public abstract Vector3 GetAnisotripicFriction(BulletConstraint constrain);
451
452public abstract Vector3 SetAnisotripicFriction(BulletConstraint constrain, Vector3 frict);
453
454public abstract bool HasAnisotripicFriction(BulletConstraint constrain);
455
456public abstract void SetContactProcessingThreshold(BulletBody obj, float val);
457
458public abstract float GetContactProcessingThreshold(BulletBody obj);
459
460public abstract bool IsStaticObject(BulletBody obj);
461
462public abstract bool IsKinematicObject(BulletBody obj);
463
464public abstract bool IsStaticOrKinematicObject(BulletBody obj);
465
466public abstract bool HasContactResponse(BulletBody obj);
467
468public abstract void SetCollisionShape(BulletWorld sim, BulletBody obj, BulletShape shape);
469
470public abstract BulletShape GetCollisionShape(BulletBody obj);
471
472public abstract int GetActivationState(BulletBody obj);
473
474public abstract void SetActivationState(BulletBody obj, int state);
475
476public abstract void SetDeactivationTime(BulletBody obj, float dtime);
477
478public abstract float GetDeactivationTime(BulletBody obj);
479
480public abstract void ForceActivationState(BulletBody obj, ActivationState state);
481
482public abstract void Activate(BulletBody obj, bool forceActivation);
483
484public abstract bool IsActive(BulletBody obj);
485
486public abstract void SetRestitution(BulletBody obj, float val);
487
488public abstract float GetRestitution(BulletBody obj);
489
490public abstract void SetFriction(BulletBody obj, float val);
491
492public abstract float GetFriction(BulletBody obj);
493
494public abstract Vector3 GetPosition(BulletBody obj);
495
496public abstract Quaternion GetOrientation(BulletBody obj);
497
498public abstract void SetTranslation(BulletBody obj, Vector3 position, Quaternion rotation);
499
500// public abstract IntPtr GetBroadphaseHandle(BulletBody obj);
501
502// public abstract void SetBroadphaseHandle(BulletBody obj, IntPtr handle);
503
504public abstract void SetInterpolationLinearVelocity(BulletBody obj, Vector3 vel);
505
506public abstract void SetInterpolationAngularVelocity(BulletBody obj, Vector3 vel);
507
508public abstract void SetInterpolationVelocity(BulletBody obj, Vector3 linearVel, Vector3 angularVel);
509
510public abstract float GetHitFraction(BulletBody obj);
511
512public abstract void SetHitFraction(BulletBody obj, float val);
513
514public abstract CollisionFlags GetCollisionFlags(BulletBody obj);
515
516public abstract CollisionFlags SetCollisionFlags(BulletBody obj, CollisionFlags flags);
517
518public abstract CollisionFlags AddToCollisionFlags(BulletBody obj, CollisionFlags flags);
519
520public abstract CollisionFlags RemoveFromCollisionFlags(BulletBody obj, CollisionFlags flags);
521
522public abstract float GetCcdMotionThreshold(BulletBody obj);
523
524public abstract void SetCcdMotionThreshold(BulletBody obj, float val);
525
526public abstract float GetCcdSweptSphereRadius(BulletBody obj);
527
528public abstract void SetCcdSweptSphereRadius(BulletBody obj, float val);
529
530public abstract IntPtr GetUserPointer(BulletBody obj);
531
532public abstract void SetUserPointer(BulletBody obj, IntPtr val);
533
534// =====================================================================================
535// btRigidBody entries
536public abstract void ApplyGravity(BulletBody obj);
537
538public abstract void SetGravity(BulletBody obj, Vector3 val);
539
540public abstract Vector3 GetGravity(BulletBody obj);
541
542public abstract void SetDamping(BulletBody obj, float lin_damping, float ang_damping);
543
544public abstract void SetLinearDamping(BulletBody obj, float lin_damping);
545
546public abstract void SetAngularDamping(BulletBody obj, float ang_damping);
547
548public abstract float GetLinearDamping(BulletBody obj);
549
550public abstract float GetAngularDamping(BulletBody obj);
551
552public abstract float GetLinearSleepingThreshold(BulletBody obj);
553
554public abstract void ApplyDamping(BulletBody obj, float timeStep);
555
556public abstract void SetMassProps(BulletBody obj, float mass, Vector3 inertia);
557
558public abstract Vector3 GetLinearFactor(BulletBody obj);
559
560public abstract void SetLinearFactor(BulletBody obj, Vector3 factor);
561
562public abstract void SetCenterOfMassByPosRot(BulletBody obj, Vector3 pos, Quaternion rot);
563
564// Add a force to the object as if its mass is one.
565public abstract void ApplyCentralForce(BulletBody obj, Vector3 force);
566
567// Set the force being applied to the object as if its mass is one.
568public abstract void SetObjectForce(BulletBody obj, Vector3 force);
569
570public abstract Vector3 GetTotalForce(BulletBody obj);
571
572public abstract Vector3 GetTotalTorque(BulletBody obj);
573
574public abstract Vector3 GetInvInertiaDiagLocal(BulletBody obj);
575
576public abstract void SetInvInertiaDiagLocal(BulletBody obj, Vector3 inert);
577
578public abstract void SetSleepingThresholds(BulletBody obj, float lin_threshold, float ang_threshold);
579
580public abstract void ApplyTorque(BulletBody obj, Vector3 torque);
581
582// Apply force at the given point. Will add torque to the object.
583public abstract void ApplyForce(BulletBody obj, Vector3 force, Vector3 pos);
584
585// Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass.
586public abstract void ApplyCentralImpulse(BulletBody obj, Vector3 imp);
587
588// Apply impulse to the object's torque. Force is scaled by object's mass.
589public abstract void ApplyTorqueImpulse(BulletBody obj, Vector3 imp);
590
591// Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces.
592public abstract void ApplyImpulse(BulletBody obj, Vector3 imp, Vector3 pos);
593
594public abstract void ClearForces(BulletBody obj);
595
596public abstract void ClearAllForces(BulletBody obj);
597
598public abstract void UpdateInertiaTensor(BulletBody obj);
599
600public abstract Vector3 GetLinearVelocity(BulletBody obj);
601
602public abstract Vector3 GetAngularVelocity(BulletBody obj);
603
604public abstract void SetLinearVelocity(BulletBody obj, Vector3 val);
605
606public abstract void SetAngularVelocity(BulletBody obj, Vector3 angularVelocity);
607
608public abstract Vector3 GetVelocityInLocalPoint(BulletBody obj, Vector3 pos);
609
610public abstract void Translate(BulletBody obj, Vector3 trans);
611
612public abstract void UpdateDeactivation(BulletBody obj, float timeStep);
613
614public abstract bool WantsSleeping(BulletBody obj);
615
616public abstract void SetAngularFactor(BulletBody obj, float factor);
617
618public abstract void SetAngularFactorV(BulletBody obj, Vector3 factor);
619
620public abstract Vector3 GetAngularFactor(BulletBody obj);
621
622public abstract bool IsInWorld(BulletWorld world, BulletBody obj);
623
624public abstract void AddConstraintRef(BulletBody obj, BulletConstraint constrain);
625
626public abstract void RemoveConstraintRef(BulletBody obj, BulletConstraint constrain);
627
628public abstract BulletConstraint GetConstraintRef(BulletBody obj, int index);
629
630public abstract int GetNumConstraintRefs(BulletBody obj);
631
632public abstract bool SetCollisionGroupMask(BulletBody body, uint filter, uint mask);
633
634// =====================================================================================
635// btCollisionShape entries
636
637public abstract float GetAngularMotionDisc(BulletShape shape);
638
639public abstract float GetContactBreakingThreshold(BulletShape shape, float defaultFactor);
640
641public abstract bool IsPolyhedral(BulletShape shape);
642
643public abstract bool IsConvex2d(BulletShape shape);
644
645public abstract bool IsConvex(BulletShape shape);
646
647public abstract bool IsNonMoving(BulletShape shape);
648
649public abstract bool IsConcave(BulletShape shape);
650
651public abstract bool IsCompound(BulletShape shape);
652
653public abstract bool IsSoftBody(BulletShape shape);
654
655public abstract bool IsInfinite(BulletShape shape);
656
657public abstract void SetLocalScaling(BulletShape shape, Vector3 scale);
658
659public abstract Vector3 GetLocalScaling(BulletShape shape);
660
661public abstract Vector3 CalculateLocalInertia(BulletShape shape, float mass);
662
663public abstract int GetShapeType(BulletShape shape);
664
665public abstract void SetMargin(BulletShape shape, float val);
666
667public abstract float GetMargin(BulletShape shape);
668
669// =====================================================================================
670// Debugging
671public virtual void DumpRigidBody(BulletWorld sim, BulletBody collisionObject) { }
672
673public virtual void DumpCollisionShape(BulletWorld sim, BulletShape collisionShape) { }
674
675public virtual void DumpConstraint(BulletWorld sim, BulletConstraint constrain) { }
676
677public virtual void DumpActivationInfo(BulletWorld sim) { }
678
679public virtual void DumpAllInfo(BulletWorld sim) { }
680
681public virtual void DumpPhysicsStatistics(BulletWorld sim) { }
682
683public virtual void ResetBroadphasePool(BulletWorld sim) { }
684
685public virtual void ResetConstraintSolver(BulletWorld sim) { }
686
687};
688}