diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/PhysicsModules/BulletS/BSApiTemplate.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs) | 245 |
1 files changed, 173 insertions, 72 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs b/OpenSim/Region/PhysicsModules/BulletS/BSApiTemplate.cs index 8ad78ca..7756b10 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSApiTemplate.cs | |||
@@ -6,7 +6,7 @@ | |||
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyrightD | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator Project nor the |
@@ -31,7 +31,7 @@ using System.Security; | |||
31 | using System.Text; | 31 | using System.Text; |
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | 33 | ||
34 | namespace OpenSim.Region.Physics.BulletSPlugin { | 34 | namespace OpenSim.Region.PhysicsModule.BulletS { |
35 | 35 | ||
36 | // Constraint type values as defined by Bullet | 36 | // Constraint type values as defined by Bullet |
37 | public enum ConstraintType : int | 37 | public enum ConstraintType : int |
@@ -43,7 +43,11 @@ public enum ConstraintType : int | |||
43 | SLIDER_CONSTRAINT_TYPE, | 43 | SLIDER_CONSTRAINT_TYPE, |
44 | CONTACT_CONSTRAINT_TYPE, | 44 | CONTACT_CONSTRAINT_TYPE, |
45 | D6_SPRING_CONSTRAINT_TYPE, | 45 | D6_SPRING_CONSTRAINT_TYPE, |
46 | MAX_CONSTRAINT_TYPE | 46 | GEAR_CONSTRAINT_TYPE, // added in Bullet 2.82 |
47 | FIXED_CONSTRAINT_TYPE, // added in Bullet 2.82 | ||
48 | MAX_CONSTRAINT_TYPE, // last type defined by Bullet | ||
49 | // | ||
50 | BS_FIXED_CONSTRAINT_TYPE = 1234 // BulletSim constraint that is fixed and unmoving | ||
47 | } | 51 | } |
48 | 52 | ||
49 | // =============================================================================== | 53 | // =============================================================================== |
@@ -70,6 +74,8 @@ public enum BSPhysicsShapeType | |||
70 | SHAPE_COMPOUND = 22, | 74 | SHAPE_COMPOUND = 22, |
71 | SHAPE_HEIGHTMAP = 23, | 75 | SHAPE_HEIGHTMAP = 23, |
72 | SHAPE_AVATAR = 24, | 76 | SHAPE_AVATAR = 24, |
77 | SHAPE_CONVEXHULL= 25, | ||
78 | SHAPE_GIMPACT = 26, | ||
73 | }; | 79 | }; |
74 | 80 | ||
75 | // The native shapes have predefined shape hash keys | 81 | // The native shapes have predefined shape hash keys |
@@ -87,7 +93,7 @@ public enum FixedShapeKey : ulong | |||
87 | [StructLayout(LayoutKind.Sequential)] | 93 | [StructLayout(LayoutKind.Sequential)] |
88 | public struct ShapeData | 94 | public struct ShapeData |
89 | { | 95 | { |
90 | public uint ID; | 96 | public UInt32 ID; |
91 | public BSPhysicsShapeType Type; | 97 | public BSPhysicsShapeType Type; |
92 | public Vector3 Position; | 98 | public Vector3 Position; |
93 | public Quaternion Rotation; | 99 | public Quaternion Rotation; |
@@ -111,7 +117,7 @@ public struct ShapeData | |||
111 | [StructLayout(LayoutKind.Sequential)] | 117 | [StructLayout(LayoutKind.Sequential)] |
112 | public struct SweepHit | 118 | public struct SweepHit |
113 | { | 119 | { |
114 | public uint ID; | 120 | public UInt32 ID; |
115 | public float Fraction; | 121 | public float Fraction; |
116 | public Vector3 Normal; | 122 | public Vector3 Normal; |
117 | public Vector3 Point; | 123 | public Vector3 Point; |
@@ -119,27 +125,47 @@ public struct SweepHit | |||
119 | [StructLayout(LayoutKind.Sequential)] | 125 | [StructLayout(LayoutKind.Sequential)] |
120 | public struct RaycastHit | 126 | public struct RaycastHit |
121 | { | 127 | { |
122 | public uint ID; | 128 | public UInt32 ID; |
123 | public float Fraction; | 129 | public float Fraction; |
124 | public Vector3 Normal; | 130 | public Vector3 Normal; |
125 | } | 131 | } |
126 | [StructLayout(LayoutKind.Sequential)] | 132 | [StructLayout(LayoutKind.Sequential)] |
127 | public struct CollisionDesc | 133 | public struct CollisionDesc |
128 | { | 134 | { |
129 | public uint aID; | 135 | public UInt32 aID; |
130 | public uint bID; | 136 | public UInt32 bID; |
131 | public Vector3 point; | 137 | public Vector3 point; |
132 | public Vector3 normal; | 138 | public Vector3 normal; |
139 | public float penetration; | ||
133 | } | 140 | } |
134 | [StructLayout(LayoutKind.Sequential)] | 141 | [StructLayout(LayoutKind.Sequential)] |
135 | public struct EntityProperties | 142 | public struct EntityProperties |
136 | { | 143 | { |
137 | public uint ID; | 144 | public UInt32 ID; |
138 | public Vector3 Position; | 145 | public Vector3 Position; |
139 | public Quaternion Rotation; | 146 | public Quaternion Rotation; |
140 | public Vector3 Velocity; | 147 | public Vector3 Velocity; |
141 | public Vector3 Acceleration; | 148 | public Vector3 Acceleration; |
142 | public Vector3 RotationalVelocity; | 149 | public Vector3 RotationalVelocity; |
150 | |||
151 | public override string ToString() | ||
152 | { | ||
153 | StringBuilder buff = new StringBuilder(); | ||
154 | buff.Append("<i="); | ||
155 | buff.Append(ID.ToString()); | ||
156 | buff.Append(",p="); | ||
157 | buff.Append(Position.ToString()); | ||
158 | buff.Append(",r="); | ||
159 | buff.Append(Rotation.ToString()); | ||
160 | buff.Append(",v="); | ||
161 | buff.Append(Velocity.ToString()); | ||
162 | buff.Append(",a="); | ||
163 | buff.Append(Acceleration.ToString()); | ||
164 | buff.Append(",rv="); | ||
165 | buff.Append(RotationalVelocity.ToString()); | ||
166 | buff.Append(">"); | ||
167 | return buff.ToString(); | ||
168 | } | ||
143 | } | 169 | } |
144 | 170 | ||
145 | // Format of this structure must match the definition in the C++ code | 171 | // Format of this structure must match the definition in the C++ code |
@@ -154,32 +180,6 @@ public struct ConfigurationParameters | |||
154 | public float collisionMargin; | 180 | public float collisionMargin; |
155 | public float gravity; | 181 | public float gravity; |
156 | 182 | ||
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; | 183 | public float maxPersistantManifoldPoolSize; |
184 | public float maxCollisionAlgorithmPoolSize; | 184 | public float maxCollisionAlgorithmPoolSize; |
185 | public float shouldDisableContactPoolDynamicAllocation; | 185 | public float shouldDisableContactPoolDynamicAllocation; |
@@ -188,22 +188,45 @@ public struct ConfigurationParameters | |||
188 | public float shouldSplitSimulationIslands; | 188 | public float shouldSplitSimulationIslands; |
189 | public float shouldEnableFrictionCaching; | 189 | public float shouldEnableFrictionCaching; |
190 | public float numberOfSolverIterations; | 190 | public float numberOfSolverIterations; |
191 | public float useSingleSidedMeshes; | ||
192 | public float globalContactBreakingThreshold; | ||
191 | 193 | ||
192 | public float XlinksetImplementation; | 194 | public float physicsLoggingFrames; |
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 XphysicsLoggingFrames; | ||
202 | 195 | ||
203 | public const float numericTrue = 1f; | 196 | public const float numericTrue = 1f; |
204 | public const float numericFalse = 0f; | 197 | public const float numericFalse = 0f; |
205 | } | 198 | } |
206 | 199 | ||
200 | // Parameters passed for the conversion of a mesh to a hull using Bullet's HACD library. | ||
201 | [StructLayout(LayoutKind.Sequential)] | ||
202 | public struct HACDParams | ||
203 | { | ||
204 | // usual default values | ||
205 | public float maxVerticesPerHull; // 100 | ||
206 | public float minClusters; // 2 | ||
207 | public float compacityWeight; // 0.1 | ||
208 | public float volumeWeight; // 0.0 | ||
209 | public float concavity; // 100 | ||
210 | public float addExtraDistPoints; // false | ||
211 | public float addNeighboursDistPoints; // false | ||
212 | public float addFacesPoints; // false | ||
213 | public float shouldAdjustCollisionMargin; // false | ||
214 | // VHACD | ||
215 | public float whichHACD; // zero if Bullet HACD, non-zero says VHACD | ||
216 | // http://kmamou.blogspot.ca/2014/12/v-hacd-20-parameters-description.html | ||
217 | public float vHACDresolution; // 100,000 max number of voxels generated during voxelization stage | ||
218 | public float vHACDdepth; // 20 max number of clipping stages | ||
219 | public float vHACDconcavity; // 0.0025 maximum concavity | ||
220 | public float vHACDplaneDownsampling; // 4 granularity of search for best clipping plane | ||
221 | public float vHACDconvexHullDownsampling; // 4 precision of hull gen process | ||
222 | public float vHACDalpha; // 0.05 bias toward clipping along symmetry planes | ||
223 | public float vHACDbeta; // 0.05 bias toward clipping along revolution axis | ||
224 | public float vHACDgamma; // 0.00125 max concavity when merging | ||
225 | public float vHACDpca; // 0 on/off normalizing mesh before decomp | ||
226 | public float vHACDmode; // 0 0:voxel based, 1: tetrahedron based | ||
227 | public float vHACDmaxNumVerticesPerCH; // 64 max triangles per convex hull | ||
228 | public float vHACDminVolumePerCH; // 0.0001 sampling of generated convex hulls | ||
229 | } | ||
207 | 230 | ||
208 | // The states a bullet collision object can have | 231 | // The states a bullet collision object can have |
209 | public enum ActivationState : uint | 232 | public enum ActivationState : uint |
@@ -238,11 +261,12 @@ public enum CollisionFlags : uint | |||
238 | CF_DISABLE_VISUALIZE_OBJECT = 1 << 5, | 261 | CF_DISABLE_VISUALIZE_OBJECT = 1 << 5, |
239 | CF_DISABLE_SPU_COLLISION_PROCESS = 1 << 6, | 262 | CF_DISABLE_SPU_COLLISION_PROCESS = 1 << 6, |
240 | // Following used by BulletSim to control collisions and updates | 263 | // Following used by BulletSim to control collisions and updates |
241 | BS_SUBSCRIBE_COLLISION_EVENTS = 1 << 10, | 264 | BS_SUBSCRIBE_COLLISION_EVENTS = 1 << 10, // return collision events from unmanaged to managed |
242 | BS_FLOATS_ON_WATER = 1 << 11, | 265 | BS_FLOATS_ON_WATER = 1 << 11, // the object should float at water level |
243 | BS_VEHICLE_COLLISIONS = 1 << 12, | 266 | BS_VEHICLE_COLLISIONS = 1 << 12, // return collisions for vehicle ground checking |
267 | BS_RETURN_ROOT_COMPOUND_SHAPE = 1 << 13, // return the pos/rot of the root shape in a compound shape | ||
244 | BS_NONE = 0, | 268 | BS_NONE = 0, |
245 | BS_ALL = 0xFFFFFFFF | 269 | BS_ALL = 0x7FFF // collision flags are a signed short |
246 | }; | 270 | }; |
247 | 271 | ||
248 | // Values f collisions groups and masks | 272 | // Values f collisions groups and masks |
@@ -258,14 +282,14 @@ public enum CollisionFilterGroups : uint | |||
258 | BDebrisGroup = 1 << 3, // 0008 | 282 | BDebrisGroup = 1 << 3, // 0008 |
259 | BSensorTrigger = 1 << 4, // 0010 | 283 | BSensorTrigger = 1 << 4, // 0010 |
260 | BCharacterGroup = 1 << 5, // 0020 | 284 | BCharacterGroup = 1 << 5, // 0020 |
261 | BAllGroup = 0x000FFFFF, | 285 | BAllGroup = 0x0007FFF, // collision flags are a signed short |
262 | // Filter groups defined by BulletSim | 286 | // Filter groups defined by BulletSim |
263 | BGroundPlaneGroup = 1 << 10, // 0400 | 287 | BGroundPlaneGroup = 1 << 8, // 0400 |
264 | BTerrainGroup = 1 << 11, // 0800 | 288 | BTerrainGroup = 1 << 9, // 0800 |
265 | BRaycastGroup = 1 << 12, // 1000 | 289 | BRaycastGroup = 1 << 10, // 1000 |
266 | BSolidGroup = 1 << 13, // 2000 | 290 | BSolidGroup = 1 << 11, // 2000 |
267 | // BLinksetGroup = xx // a linkset proper is either static or dynamic | 291 | // BLinksetGroup = xx // a linkset proper is either static or dynamic |
268 | BLinksetChildGroup = 1 << 14, // 4000 | 292 | BLinksetChildGroup = 1 << 12, // 4000 |
269 | }; | 293 | }; |
270 | 294 | ||
271 | // CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0 | 295 | // CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0 |
@@ -285,7 +309,7 @@ public enum ConstraintParamAxis : int | |||
285 | AXIS_ANGULAR_X, | 309 | AXIS_ANGULAR_X, |
286 | AXIS_ANGULAR_Y, | 310 | AXIS_ANGULAR_Y, |
287 | AXIS_ANGULAR_Z, | 311 | AXIS_ANGULAR_Z, |
288 | AXIS_LINEAR_ALL = 20, // these last three added by BulletSim so we don't have to do zillions of calls | 312 | AXIS_LINEAR_ALL = 20, // added by BulletSim so we don't have to do zillions of calls |
289 | AXIS_ANGULAR_ALL, | 313 | AXIS_ANGULAR_ALL, |
290 | AXIS_ALL | 314 | AXIS_ALL |
291 | }; | 315 | }; |
@@ -294,7 +318,7 @@ public abstract class BSAPITemplate | |||
294 | { | 318 | { |
295 | // Returns the name of the underlying Bullet engine | 319 | // Returns the name of the underlying Bullet engine |
296 | public abstract string BulletEngineName { get; } | 320 | public abstract string BulletEngineName { get; } |
297 | public abstract string BulletEngineVersion { get; protected set;} | 321 | public abstract string BulletEngineVersion { get; protected set;} |
298 | 322 | ||
299 | // Initialization and simulation | 323 | // Initialization and simulation |
300 | public abstract BulletWorld Initialize(Vector3 maxPosition, ConfigurationParameters parms, | 324 | public abstract BulletWorld Initialize(Vector3 maxPosition, ConfigurationParameters parms, |
@@ -305,7 +329,7 @@ public abstract BulletWorld Initialize(Vector3 maxPosition, ConfigurationParamet | |||
305 | public abstract int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep, | 329 | public abstract int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep, |
306 | out int updatedEntityCount, out int collidersCount); | 330 | out int updatedEntityCount, out int collidersCount); |
307 | 331 | ||
308 | public abstract bool UpdateParameter(BulletWorld world, uint localID, String parm, float value); | 332 | public abstract bool UpdateParameter(BulletWorld world, UInt32 localID, String parm, float value); |
309 | 333 | ||
310 | public abstract void Shutdown(BulletWorld sim); | 334 | public abstract void Shutdown(BulletWorld sim); |
311 | 335 | ||
@@ -317,10 +341,20 @@ public abstract BulletShape CreateMeshShape(BulletWorld world, | |||
317 | int indicesCount, int[] indices, | 341 | int indicesCount, int[] indices, |
318 | int verticesCount, float[] vertices ); | 342 | int verticesCount, float[] vertices ); |
319 | 343 | ||
344 | public abstract BulletShape CreateGImpactShape(BulletWorld world, | ||
345 | int indicesCount, int[] indices, | ||
346 | int verticesCount, float[] vertices ); | ||
347 | |||
320 | public abstract BulletShape CreateHullShape(BulletWorld world, | 348 | public abstract BulletShape CreateHullShape(BulletWorld world, |
321 | int hullCount, float[] hulls); | 349 | int hullCount, float[] hulls); |
322 | 350 | ||
323 | public abstract BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape); | 351 | public abstract BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape, HACDParams parms); |
352 | |||
353 | public abstract BulletShape BuildConvexHullShapeFromMesh(BulletWorld world, BulletShape meshShape); | ||
354 | |||
355 | public abstract BulletShape CreateConvexHullShape(BulletWorld world, | ||
356 | int indicesCount, int[] indices, | ||
357 | int verticesCount, float[] vertices ); | ||
324 | 358 | ||
325 | public abstract BulletShape BuildNativeShape(BulletWorld world, ShapeData shapeData); | 359 | public abstract BulletShape BuildNativeShape(BulletWorld world, ShapeData shapeData); |
326 | 360 | ||
@@ -342,26 +376,28 @@ public abstract BulletShape RemoveChildShapeFromCompoundShapeIndex(BulletShape c | |||
342 | 376 | ||
343 | public abstract void RemoveChildShapeFromCompoundShape(BulletShape cShape, BulletShape removeShape); | 377 | public abstract void RemoveChildShapeFromCompoundShape(BulletShape cShape, BulletShape removeShape); |
344 | 378 | ||
379 | public abstract void UpdateChildTransform(BulletShape pShape, int childIndex, Vector3 pos, Quaternion rot, bool shouldRecalculateLocalAabb); | ||
380 | |||
345 | public abstract void RecalculateCompoundShapeLocalAabb(BulletShape cShape); | 381 | public abstract void RecalculateCompoundShapeLocalAabb(BulletShape cShape); |
346 | 382 | ||
347 | public abstract BulletShape DuplicateCollisionShape(BulletWorld sim, BulletShape srcShape, uint id); | 383 | public abstract BulletShape DuplicateCollisionShape(BulletWorld sim, BulletShape srcShape, UInt32 id); |
348 | 384 | ||
349 | public abstract bool DeleteCollisionShape(BulletWorld world, BulletShape shape); | 385 | public abstract bool DeleteCollisionShape(BulletWorld world, BulletShape shape); |
350 | 386 | ||
351 | public abstract CollisionObjectTypes GetBodyType(BulletBody obj); | 387 | public abstract CollisionObjectTypes GetBodyType(BulletBody obj); |
352 | 388 | ||
353 | public abstract BulletBody CreateBodyFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot); | 389 | public abstract BulletBody CreateBodyFromShape(BulletWorld sim, BulletShape shape, UInt32 id, Vector3 pos, Quaternion rot); |
354 | 390 | ||
355 | public abstract BulletBody CreateBodyWithDefaultMotionState(BulletShape shape, uint id, Vector3 pos, Quaternion rot); | 391 | public abstract BulletBody CreateBodyWithDefaultMotionState(BulletShape shape, UInt32 id, Vector3 pos, Quaternion rot); |
356 | 392 | ||
357 | public abstract BulletBody CreateGhostFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot); | 393 | public abstract BulletBody CreateGhostFromShape(BulletWorld sim, BulletShape shape, UInt32 id, Vector3 pos, Quaternion rot); |
358 | 394 | ||
359 | public abstract void DestroyObject(BulletWorld sim, BulletBody obj); | 395 | public abstract void DestroyObject(BulletWorld sim, BulletBody obj); |
360 | 396 | ||
361 | // ===================================================================================== | 397 | // ===================================================================================== |
362 | public abstract BulletShape CreateGroundPlaneShape(uint id, float height, float collisionMargin); | 398 | public abstract BulletShape CreateGroundPlaneShape(UInt32 id, float height, float collisionMargin); |
363 | 399 | ||
364 | public abstract BulletShape CreateTerrainShape(uint id, Vector3 size, float minHeight, float maxHeight, float[] heightMap, | 400 | public abstract BulletShape CreateTerrainShape(UInt32 id, Vector3 size, float minHeight, float maxHeight, float[] heightMap, |
365 | float scaleFactor, float collisionMargin); | 401 | float scaleFactor, float collisionMargin); |
366 | 402 | ||
367 | // ===================================================================================== | 403 | // ===================================================================================== |
@@ -375,11 +411,38 @@ public abstract BulletConstraint Create6DofConstraintToPoint(BulletWorld world, | |||
375 | Vector3 joinPoint, | 411 | Vector3 joinPoint, |
376 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | 412 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); |
377 | 413 | ||
414 | public abstract BulletConstraint Create6DofConstraintFixed(BulletWorld world, BulletBody obj1, | ||
415 | Vector3 frameInBloc, Quaternion frameInBrot, | ||
416 | bool useLinearReferenceFrameB, bool disableCollisionsBetweenLinkedBodies); | ||
417 | |||
418 | public abstract BulletConstraint Create6DofSpringConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
419 | Vector3 frame1loc, Quaternion frame1rot, | ||
420 | Vector3 frame2loc, Quaternion frame2rot, | ||
421 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
422 | |||
378 | public abstract BulletConstraint CreateHingeConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | 423 | public abstract BulletConstraint CreateHingeConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, |
379 | Vector3 pivotinA, Vector3 pivotinB, | 424 | Vector3 pivotinA, Vector3 pivotinB, |
380 | Vector3 axisInA, Vector3 axisInB, | 425 | Vector3 axisInA, Vector3 axisInB, |
381 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | 426 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); |
382 | 427 | ||
428 | public abstract BulletConstraint CreateSliderConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
429 | Vector3 frameInAloc, Quaternion frameInArot, | ||
430 | Vector3 frameInBloc, Quaternion frameInBrot, | ||
431 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
432 | |||
433 | public abstract BulletConstraint CreateConeTwistConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
434 | Vector3 frameInAloc, Quaternion frameInArot, | ||
435 | Vector3 frameInBloc, Quaternion frameInBrot, | ||
436 | bool disableCollisionsBetweenLinkedBodies); | ||
437 | |||
438 | public abstract BulletConstraint CreateGearConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
439 | Vector3 axisInA, Vector3 axisInB, | ||
440 | float ratio, bool disableCollisionsBetweenLinkedBodies); | ||
441 | |||
442 | public abstract BulletConstraint CreatePoint2PointConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
443 | Vector3 pivotInA, Vector3 pivotInB, | ||
444 | bool disableCollisionsBetweenLinkedBodies); | ||
445 | |||
383 | public abstract void SetConstraintEnable(BulletConstraint constrain, float numericTrueFalse); | 446 | public abstract void SetConstraintEnable(BulletConstraint constrain, float numericTrueFalse); |
384 | 447 | ||
385 | public abstract void SetConstraintNumSolverIterations(BulletConstraint constrain, float iterations); | 448 | public abstract void SetConstraintNumSolverIterations(BulletConstraint constrain, float iterations); |
@@ -397,6 +460,38 @@ public abstract bool TranslationalLimitMotor(BulletConstraint constrain, float e | |||
397 | 460 | ||
398 | public abstract bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold); | 461 | public abstract bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold); |
399 | 462 | ||
463 | public const int HINGE_NOT_SPECIFIED = -1; | ||
464 | public abstract bool HingeSetLimits(BulletConstraint constrain, float low, float high, float softness, float bias, float relaxation); | ||
465 | |||
466 | public abstract bool SpringEnable(BulletConstraint constrain, int index, float numericTrueFalse); | ||
467 | |||
468 | public const int SPRING_NOT_SPECIFIED = -1; | ||
469 | public abstract bool SpringSetEquilibriumPoint(BulletConstraint constrain, int index, float equilibriumPoint); | ||
470 | |||
471 | public abstract bool SpringSetStiffness(BulletConstraint constrain, int index, float stiffnesss); | ||
472 | |||
473 | public abstract bool SpringSetDamping(BulletConstraint constrain, int index, float damping); | ||
474 | |||
475 | public const int SLIDER_LOWER_LIMIT = 0; | ||
476 | public const int SLIDER_UPPER_LIMIT = 1; | ||
477 | public const int SLIDER_LINEAR = 2; | ||
478 | public const int SLIDER_ANGULAR = 3; | ||
479 | public abstract bool SliderSetLimits(BulletConstraint constrain, int lowerUpper, int linAng, float val); | ||
480 | |||
481 | public const int SLIDER_SET_SOFTNESS = 4; | ||
482 | public const int SLIDER_SET_RESTITUTION = 5; | ||
483 | public const int SLIDER_SET_DAMPING = 6; | ||
484 | public const int SLIDER_SET_DIRECTION = 7; | ||
485 | public const int SLIDER_SET_LIMIT = 8; | ||
486 | public const int SLIDER_SET_ORTHO = 9; | ||
487 | public abstract bool SliderSet(BulletConstraint constrain, int softRestDamp, int dirLimOrtho, int linAng, float val); | ||
488 | |||
489 | public abstract bool SliderMotorEnable(BulletConstraint constrain, int linAng, float numericTrueFalse); | ||
490 | |||
491 | public const int SLIDER_MOTOR_VELOCITY = 10; | ||
492 | public const int SLIDER_MAX_MOTOR_FORCE = 11; | ||
493 | public abstract bool SliderMotor(BulletConstraint constrain, int forceVel, int linAng, float val); | ||
494 | |||
400 | public abstract bool CalculateTransforms(BulletConstraint constrain); | 495 | public abstract bool CalculateTransforms(BulletConstraint constrain); |
401 | 496 | ||
402 | public abstract bool SetConstraintParam(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis); | 497 | public abstract bool SetConstraintParam(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis); |
@@ -420,6 +515,8 @@ public abstract bool AddObjectToWorld(BulletWorld world, BulletBody obj); | |||
420 | 515 | ||
421 | public abstract bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj); | 516 | public abstract bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj); |
422 | 517 | ||
518 | public abstract bool ClearCollisionProxyCache(BulletWorld world, BulletBody obj); | ||
519 | |||
423 | public abstract bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects); | 520 | public abstract bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects); |
424 | 521 | ||
425 | public abstract bool RemoveConstraintFromWorld(BulletWorld world, BulletConstraint constrain); | 522 | public abstract bool RemoveConstraintFromWorld(BulletWorld world, BulletConstraint constrain); |
@@ -607,7 +704,7 @@ public abstract BulletConstraint GetConstraintRef(BulletBody obj, int index); | |||
607 | 704 | ||
608 | public abstract int GetNumConstraintRefs(BulletBody obj); | 705 | public abstract int GetNumConstraintRefs(BulletBody obj); |
609 | 706 | ||
610 | public abstract bool SetCollisionGroupMask(BulletBody body, uint filter, uint mask); | 707 | public abstract bool SetCollisionGroupMask(BulletBody body, UInt32 filter, UInt32 mask); |
611 | 708 | ||
612 | // ===================================================================================== | 709 | // ===================================================================================== |
613 | // btCollisionShape entries | 710 | // btCollisionShape entries |
@@ -646,17 +743,21 @@ public abstract float GetMargin(BulletShape shape); | |||
646 | 743 | ||
647 | // ===================================================================================== | 744 | // ===================================================================================== |
648 | // Debugging | 745 | // Debugging |
649 | public abstract void DumpRigidBody(BulletWorld sim, BulletBody collisionObject); | 746 | public virtual void DumpRigidBody(BulletWorld sim, BulletBody collisionObject) { } |
747 | |||
748 | public virtual void DumpCollisionShape(BulletWorld sim, BulletShape collisionShape) { } | ||
749 | |||
750 | public virtual void DumpConstraint(BulletWorld sim, BulletConstraint constrain) { } | ||
650 | 751 | ||
651 | public abstract void DumpCollisionShape(BulletWorld sim, BulletShape collisionShape); | 752 | public virtual void DumpActivationInfo(BulletWorld sim) { } |
652 | 753 | ||
653 | public abstract void DumpConstraint(BulletWorld sim, BulletConstraint constrain); | 754 | public virtual void DumpAllInfo(BulletWorld sim) { } |
654 | 755 | ||
655 | public abstract void DumpActivationInfo(BulletWorld sim); | 756 | public virtual void DumpPhysicsStatistics(BulletWorld sim) { } |
656 | 757 | ||
657 | public abstract void DumpAllInfo(BulletWorld sim); | 758 | public virtual void ResetBroadphasePool(BulletWorld sim) { } |
658 | 759 | ||
659 | public abstract void DumpPhysicsStatistics(BulletWorld sim); | 760 | public virtual void ResetConstraintSolver(BulletWorld sim) { } |
660 | 761 | ||
661 | }; | 762 | }; |
662 | } | 763 | } |