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.cs45
1 files changed, 37 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
index 65e3145..fe705cc 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
@@ -66,13 +66,14 @@ public struct ShapeData
66{ 66{
67 public enum PhysicsShapeType 67 public enum PhysicsShapeType
68 { 68 {
69 SHAPE_AVATAR = 0, 69 SHAPE_UNKNOWN = 0,
70 SHAPE_BOX = 1, 70 SHAPE_AVATAR = 1,
71 SHAPE_CONE = 2, 71 SHAPE_BOX = 2,
72 SHAPE_CYLINDER = 3, 72 SHAPE_CONE = 3,
73 SHAPE_SPHERE = 4, 73 SHAPE_CYLINDER = 4,
74 SHAPE_MESH = 5, 74 SHAPE_SPHERE = 5,
75 SHAPE_HULL = 6 75 SHAPE_MESH = 6,
76 SHAPE_HULL = 7
76 }; 77 };
77 public uint ID; 78 public uint ID;
78 public PhysicsShapeType Type; 79 public PhysicsShapeType Type;
@@ -168,6 +169,8 @@ public struct ConfigurationParameters
168 public float linkConstraintEnableTransMotor; 169 public float linkConstraintEnableTransMotor;
169 public float linkConstraintTransMotorMaxVel; 170 public float linkConstraintTransMotorMaxVel;
170 public float linkConstraintTransMotorMaxForce; 171 public float linkConstraintTransMotorMaxForce;
172 public float linkConstraintERP;
173 public float linkConstraintCFM;
171 174
172 public const float numericTrue = 1f; 175 public const float numericTrue = 1f;
173 public const float numericFalse = 0f; 176 public const float numericFalse = 0f;
@@ -189,6 +192,28 @@ public enum CollisionFlags : uint
189 PHYSICAL_OBJECT = 1 << 12, 192 PHYSICAL_OBJECT = 1 << 12,
190}; 193};
191 194
195// CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0
196// ERP controls amount of correction per tick. Usable range=0.1..0.8. Default=0.2.
197public enum ConstraintParams : int
198{
199 BT_CONSTRAINT_ERP = 1, // this one is not used in Bullet as of 20120730
200 BT_CONSTRAINT_STOP_ERP,
201 BT_CONSTRAINT_CFM,
202 BT_CONSTRAINT_STOP_CFM,
203};
204public enum ConstraintParamAxis : int
205{
206 AXIS_LINEAR_X = 0,
207 AXIS_LINEAR_Y,
208 AXIS_LINEAR_Z,
209 AXIS_ANGULAR_X,
210 AXIS_ANGULAR_Y,
211 AXIS_ANGULAR_Z,
212 AXIS_LINEAR_ALL = 20, // these last three added by BulletSim so we don't have to do zillions of calls
213 AXIS_ANGULAR_ALL,
214 AXIS_ALL
215};
216
192// =============================================================================== 217// ===============================================================================
193static class BulletSimAPI { 218static class BulletSimAPI {
194 219
@@ -380,7 +405,8 @@ public static extern IntPtr CreateObject2(IntPtr sim, ShapeData shapeData);
380[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 405[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
381public static extern IntPtr CreateConstraint2(IntPtr sim, IntPtr obj1, IntPtr obj2, 406public static extern IntPtr CreateConstraint2(IntPtr sim, IntPtr obj1, IntPtr obj2,
382 Vector3 frame1loc, Quaternion frame1rot, 407 Vector3 frame1loc, Quaternion frame1rot,
383 Vector3 frame2loc, Quaternion frame2rot); 408 Vector3 frame2loc, Quaternion frame2rot,
409 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
384 410
385[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 411[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
386public static extern bool SetLinearLimits2(IntPtr constrain, Vector3 low, Vector3 hi); 412public static extern bool SetLinearLimits2(IntPtr constrain, Vector3 low, Vector3 hi);
@@ -398,6 +424,9 @@ public static extern bool TranslationalLimitMotor2(IntPtr constrain, float enabl
398public static extern bool CalculateTransforms2(IntPtr constrain); 424public static extern bool CalculateTransforms2(IntPtr constrain);
399 425
400[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 426[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
427public static extern bool SetConstraintParam2(IntPtr constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis);
428
429[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
401public static extern bool DestroyConstraint2(IntPtr sim, IntPtr constrain); 430public static extern bool DestroyConstraint2(IntPtr sim, IntPtr constrain);
402 431
403[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 432[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]