diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs | 1545 |
1 files changed, 1545 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs new file mode 100755 index 0000000..3975776 --- /dev/null +++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs | |||
@@ -0,0 +1,1545 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyrightD | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using System.Reflection; | ||
30 | using System.Runtime.InteropServices; | ||
31 | using System.Security; | ||
32 | using System.Text; | ||
33 | |||
34 | using OpenMetaverse; | ||
35 | |||
36 | namespace OpenSim.Region.Physics.BulletSPlugin | ||
37 | { | ||
38 | public sealed class BSAPIUnman : BSAPITemplate | ||
39 | { | ||
40 | |||
41 | // We pin the memory passed between the managed and unmanaged code. | ||
42 | GCHandle m_paramsHandle; | ||
43 | private GCHandle m_collisionArrayPinnedHandle; | ||
44 | private GCHandle m_updateArrayPinnedHandle; | ||
45 | |||
46 | // Handle to the callback used by the unmanaged code to call into the managed code. | ||
47 | // Used for debug logging. | ||
48 | // Need to store the handle in a persistant variable so it won't be freed. | ||
49 | private BSAPICPP.DebugLogCallback m_DebugLogCallbackHandle; | ||
50 | |||
51 | private BSScene PhysicsScene { get; set; } | ||
52 | |||
53 | public override string BulletEngineName { get { return "BulletUnmanaged"; } } | ||
54 | public override string BulletEngineVersion { get; protected set; } | ||
55 | |||
56 | public BSAPIUnman(string paramName, BSScene physScene) | ||
57 | { | ||
58 | PhysicsScene = physScene; | ||
59 | // Do something fancy with the paramName to get the right DLL implementation | ||
60 | // like "Bullet-2.80-OpenCL-Intel" loading the version for Intel based OpenCL implementation, etc. | ||
61 | } | ||
62 | |||
63 | // Initialization and simulation | ||
64 | public override BulletWorld Initialize(Vector3 maxPosition, ConfigurationParameters parms, | ||
65 | int maxCollisions, ref CollisionDesc[] collisionArray, | ||
66 | int maxUpdates, ref EntityProperties[] updateArray | ||
67 | ) | ||
68 | { | ||
69 | // Pin down the memory that will be used to pass object collisions and updates back from unmanaged code | ||
70 | m_paramsHandle = GCHandle.Alloc(parms, GCHandleType.Pinned); | ||
71 | m_collisionArrayPinnedHandle = GCHandle.Alloc(collisionArray, GCHandleType.Pinned); | ||
72 | m_updateArrayPinnedHandle = GCHandle.Alloc(updateArray, GCHandleType.Pinned); | ||
73 | |||
74 | // If Debug logging level, enable logging from the unmanaged code | ||
75 | m_DebugLogCallbackHandle = null; | ||
76 | if (BSScene.m_log.IsDebugEnabled || PhysicsScene.PhysicsLogging.Enabled) | ||
77 | { | ||
78 | BSScene.m_log.DebugFormat("{0}: Initialize: Setting debug callback for unmanaged code", BSScene.LogHeader); | ||
79 | if (PhysicsScene.PhysicsLogging.Enabled) | ||
80 | // The handle is saved in a variable to make sure it doesn't get freed after this call | ||
81 | m_DebugLogCallbackHandle = new BSAPICPP.DebugLogCallback(BulletLoggerPhysLog); | ||
82 | else | ||
83 | m_DebugLogCallbackHandle = new BSAPICPP.DebugLogCallback(BulletLogger); | ||
84 | } | ||
85 | |||
86 | // Get the version of the DLL | ||
87 | // TODO: this doesn't work yet. Something wrong with marshaling the returned string. | ||
88 | // BulletEngineVersion = BulletSimAPI.GetVersion2(); | ||
89 | BulletEngineVersion = ""; | ||
90 | |||
91 | // Call the unmanaged code with the buffers and other information | ||
92 | return new BulletWorld(0, PhysicsScene, BSAPICPP.Initialize2(maxPosition, m_paramsHandle.AddrOfPinnedObject(), | ||
93 | maxCollisions, m_collisionArrayPinnedHandle.AddrOfPinnedObject(), | ||
94 | maxUpdates, m_updateArrayPinnedHandle.AddrOfPinnedObject(), | ||
95 | m_DebugLogCallbackHandle)); | ||
96 | |||
97 | } | ||
98 | |||
99 | // Called directly from unmanaged code so don't do much | ||
100 | private void BulletLogger(string msg) | ||
101 | { | ||
102 | BSScene.m_log.Debug("[BULLETS UNMANAGED]:" + msg); | ||
103 | } | ||
104 | |||
105 | // Called directly from unmanaged code so don't do much | ||
106 | private void BulletLoggerPhysLog(string msg) | ||
107 | { | ||
108 | PhysicsScene.DetailLog("[BULLETS UNMANAGED]:" + msg); | ||
109 | } | ||
110 | |||
111 | public override int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep, | ||
112 | out int updatedEntityCount, out int collidersCount) | ||
113 | { | ||
114 | return BSAPICPP.PhysicsStep2(world.ptr, timeStep, maxSubSteps, fixedTimeStep, out updatedEntityCount, out collidersCount); | ||
115 | } | ||
116 | |||
117 | public override void Shutdown(BulletWorld sim) | ||
118 | { | ||
119 | BSAPICPP.Shutdown2(sim.ptr); | ||
120 | } | ||
121 | |||
122 | public override bool PushUpdate(BulletBody obj) | ||
123 | { | ||
124 | return BSAPICPP.PushUpdate2(obj.ptr); | ||
125 | } | ||
126 | |||
127 | public override bool UpdateParameter(BulletWorld world, uint localID, String parm, float value) | ||
128 | { | ||
129 | return BSAPICPP.UpdateParameter2(world.ptr, localID, parm, value); | ||
130 | } | ||
131 | |||
132 | // ===================================================================================== | ||
133 | // Mesh, hull, shape and body creation helper routines | ||
134 | public override BulletShape CreateMeshShape(BulletWorld world, | ||
135 | int indicesCount, int[] indices, | ||
136 | int verticesCount, float[] vertices) | ||
137 | { | ||
138 | return new BulletShape( | ||
139 | BSAPICPP.CreateMeshShape2(world.ptr, indicesCount, indices, verticesCount, vertices), | ||
140 | BSPhysicsShapeType.SHAPE_MESH); | ||
141 | } | ||
142 | |||
143 | public override BulletShape CreateHullShape(BulletWorld world, int hullCount, float[] hulls) | ||
144 | { | ||
145 | return new BulletShape( | ||
146 | BSAPICPP.CreateHullShape2(world.ptr, hullCount, hulls), | ||
147 | BSPhysicsShapeType.SHAPE_HULL); | ||
148 | } | ||
149 | |||
150 | public override BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape) | ||
151 | { | ||
152 | return new BulletShape( | ||
153 | BSAPICPP.BuildHullShapeFromMesh2(world.ptr, meshShape.ptr), | ||
154 | BSPhysicsShapeType.SHAPE_HULL); | ||
155 | } | ||
156 | |||
157 | public override BulletShape BuildNativeShape( BulletWorld world, ShapeData shapeData) | ||
158 | { | ||
159 | return new BulletShape( | ||
160 | BSAPICPP.BuildNativeShape2(world.ptr, shapeData), | ||
161 | shapeData.Type); | ||
162 | } | ||
163 | |||
164 | public override bool IsNativeShape(BulletShape shape) | ||
165 | { | ||
166 | if (shape.HasPhysicalShape) | ||
167 | return BSAPICPP.IsNativeShape2(shape.ptr); | ||
168 | return false; | ||
169 | } | ||
170 | |||
171 | public override void SetShapeCollisionMargin(BulletShape shape, float margin) | ||
172 | { | ||
173 | if (shape.HasPhysicalShape) | ||
174 | BSAPICPP.SetShapeCollisionMargin2(shape.ptr, margin); | ||
175 | } | ||
176 | |||
177 | public override BulletShape BuildCapsuleShape(BulletWorld world, float radius, float height, Vector3 scale) | ||
178 | { | ||
179 | return new BulletShape( | ||
180 | BSAPICPP.BuildCapsuleShape2(world.ptr, radius, height, scale), | ||
181 | BSPhysicsShapeType.SHAPE_CAPSULE); | ||
182 | } | ||
183 | |||
184 | public override BulletShape CreateCompoundShape(BulletWorld sim, bool enableDynamicAabbTree) | ||
185 | { | ||
186 | return new BulletShape( | ||
187 | BSAPICPP.CreateCompoundShape2(sim.ptr, enableDynamicAabbTree), | ||
188 | BSPhysicsShapeType.SHAPE_COMPOUND); | ||
189 | |||
190 | } | ||
191 | |||
192 | public override int GetNumberOfCompoundChildren(BulletShape shape) | ||
193 | { | ||
194 | if (shape.HasPhysicalShape) | ||
195 | return BSAPICPP.GetNumberOfCompoundChildren2(shape.ptr); | ||
196 | return 0; | ||
197 | } | ||
198 | |||
199 | public override void AddChildShapeToCompoundShape(BulletShape cShape, BulletShape addShape, Vector3 pos, Quaternion rot) | ||
200 | { | ||
201 | BSAPICPP.AddChildShapeToCompoundShape2(cShape.ptr, addShape.ptr, pos, rot); | ||
202 | } | ||
203 | |||
204 | public override BulletShape GetChildShapeFromCompoundShapeIndex(BulletShape cShape, int indx) | ||
205 | { | ||
206 | return new BulletShape(BSAPICPP.GetChildShapeFromCompoundShapeIndex2(cShape.ptr, indx)); | ||
207 | } | ||
208 | |||
209 | public override BulletShape RemoveChildShapeFromCompoundShapeIndex(BulletShape cShape, int indx) | ||
210 | { | ||
211 | return new BulletShape(BSAPICPP.RemoveChildShapeFromCompoundShapeIndex2(cShape.ptr, indx)); | ||
212 | } | ||
213 | |||
214 | public override void RemoveChildShapeFromCompoundShape(BulletShape cShape, BulletShape removeShape) | ||
215 | { | ||
216 | BSAPICPP.RemoveChildShapeFromCompoundShape2(cShape.ptr, removeShape.ptr); | ||
217 | } | ||
218 | |||
219 | public override void RecalculateCompoundShapeLocalAabb(BulletShape cShape) | ||
220 | { | ||
221 | BSAPICPP.RecalculateCompoundShapeLocalAabb2(cShape.ptr); | ||
222 | } | ||
223 | |||
224 | public override BulletShape DuplicateCollisionShape(BulletWorld sim, BulletShape srcShape, uint id) | ||
225 | { | ||
226 | return new BulletShape(BSAPICPP.DuplicateCollisionShape2(sim.ptr, srcShape.ptr, id), srcShape.type); | ||
227 | } | ||
228 | |||
229 | public override bool DeleteCollisionShape(BulletWorld world, BulletShape shape) | ||
230 | { | ||
231 | return BSAPICPP.DeleteCollisionShape2(world.ptr, shape.ptr); | ||
232 | } | ||
233 | |||
234 | public override int GetBodyType(BulletBody obj) | ||
235 | { | ||
236 | return BSAPICPP.GetBodyType2(obj.ptr); | ||
237 | } | ||
238 | |||
239 | public override BulletBody CreateBodyFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot) | ||
240 | { | ||
241 | return new BulletBody(id, BSAPICPP.CreateBodyFromShape2(sim.ptr, shape.ptr, id, pos, rot)); | ||
242 | } | ||
243 | |||
244 | public override BulletBody CreateBodyWithDefaultMotionState(BulletShape shape, uint id, Vector3 pos, Quaternion rot) | ||
245 | { | ||
246 | return new BulletBody(id, BSAPICPP.CreateBodyWithDefaultMotionState2(shape.ptr, id, pos, rot)); | ||
247 | } | ||
248 | |||
249 | public override BulletBody CreateGhostFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot) | ||
250 | { | ||
251 | return new BulletBody(id, BSAPICPP.CreateGhostFromShape2(sim.ptr, shape.ptr, id, pos, rot)); | ||
252 | } | ||
253 | |||
254 | public override void DestroyObject(BulletWorld sim, BulletBody obj) | ||
255 | { | ||
256 | BSAPICPP.DestroyObject2(sim.ptr, obj.ptr); | ||
257 | } | ||
258 | |||
259 | // ===================================================================================== | ||
260 | // Terrain creation and helper routines | ||
261 | public override BulletShape CreateGroundPlaneShape(uint id, float height, float collisionMargin) | ||
262 | { | ||
263 | return new BulletShape(BSAPICPP.CreateGroundPlaneShape2(id, height, collisionMargin), BSPhysicsShapeType.SHAPE_GROUNDPLANE); | ||
264 | } | ||
265 | |||
266 | public override BulletShape CreateTerrainShape(uint id, Vector3 size, float minHeight, float maxHeight, float[] heightMap, | ||
267 | float scaleFactor, float collisionMargin) | ||
268 | { | ||
269 | return new BulletShape(BSAPICPP.CreateTerrainShape2(id, size, minHeight, maxHeight, heightMap, scaleFactor, collisionMargin), | ||
270 | BSPhysicsShapeType.SHAPE_TERRAIN); | ||
271 | } | ||
272 | |||
273 | // ===================================================================================== | ||
274 | // Constraint creation and helper routines | ||
275 | public override BulletConstraint Create6DofConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
276 | Vector3 frame1loc, Quaternion frame1rot, | ||
277 | Vector3 frame2loc, Quaternion frame2rot, | ||
278 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) | ||
279 | { | ||
280 | return new BulletConstraint(BSAPICPP.Create6DofConstraint2(world.ptr, obj1.ptr, obj2.ptr, frame1loc, frame1rot, | ||
281 | frame2loc, frame2rot, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies)); | ||
282 | } | ||
283 | |||
284 | public override BulletConstraint Create6DofConstraintToPoint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
285 | Vector3 joinPoint, | ||
286 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) | ||
287 | { | ||
288 | return new BulletConstraint(BSAPICPP.Create6DofConstraintToPoint2(world.ptr, obj1.ptr, obj2.ptr, | ||
289 | joinPoint, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies)); | ||
290 | } | ||
291 | |||
292 | public override BulletConstraint CreateHingeConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
293 | Vector3 pivotinA, Vector3 pivotinB, | ||
294 | Vector3 axisInA, Vector3 axisInB, | ||
295 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) | ||
296 | { | ||
297 | return new BulletConstraint(BSAPICPP.CreateHingeConstraint2(world.ptr, obj1.ptr, obj2.ptr, | ||
298 | pivotinA, pivotinB, axisInA, axisInB, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies)); | ||
299 | } | ||
300 | |||
301 | public override void SetConstraintEnable(BulletConstraint constrain, float numericTrueFalse) | ||
302 | { | ||
303 | BSAPICPP.SetConstraintEnable2(constrain.ptr, numericTrueFalse); | ||
304 | } | ||
305 | |||
306 | public override void SetConstraintNumSolverIterations(BulletConstraint constrain, float iterations) | ||
307 | { | ||
308 | BSAPICPP.SetConstraintNumSolverIterations2(constrain.ptr, iterations); | ||
309 | } | ||
310 | |||
311 | public override bool SetFrames(BulletConstraint constrain, | ||
312 | Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot) | ||
313 | { | ||
314 | return BSAPICPP.SetFrames2(constrain.ptr, frameA, frameArot, frameB, frameBrot); | ||
315 | } | ||
316 | |||
317 | public override bool SetLinearLimits(BulletConstraint constrain, Vector3 low, Vector3 hi) | ||
318 | { | ||
319 | return BSAPICPP.SetLinearLimits2(constrain.ptr, low, hi); | ||
320 | } | ||
321 | |||
322 | public override bool SetAngularLimits(BulletConstraint constrain, Vector3 low, Vector3 hi) | ||
323 | { | ||
324 | return BSAPICPP.SetAngularLimits2(constrain.ptr, low, hi); | ||
325 | } | ||
326 | |||
327 | public override bool UseFrameOffset(BulletConstraint constrain, float enable) | ||
328 | { | ||
329 | return BSAPICPP.UseFrameOffset2(constrain.ptr, enable); | ||
330 | } | ||
331 | |||
332 | public override bool TranslationalLimitMotor(BulletConstraint constrain, float enable, float targetVel, float maxMotorForce) | ||
333 | { | ||
334 | return BSAPICPP.TranslationalLimitMotor2(constrain.ptr, enable, targetVel, maxMotorForce); | ||
335 | } | ||
336 | |||
337 | public override bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold) | ||
338 | { | ||
339 | return BSAPICPP.SetBreakingImpulseThreshold2(constrain.ptr, threshold); | ||
340 | } | ||
341 | |||
342 | public override bool CalculateTransforms(BulletConstraint constrain) | ||
343 | { | ||
344 | return BSAPICPP.CalculateTransforms2(constrain.ptr); | ||
345 | } | ||
346 | |||
347 | public override bool SetConstraintParam(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis) | ||
348 | { | ||
349 | return BSAPICPP.SetConstraintParam2(constrain.ptr, paramIndex, value, axis); | ||
350 | } | ||
351 | |||
352 | public override bool DestroyConstraint(BulletWorld world, BulletConstraint constrain) | ||
353 | { | ||
354 | return BSAPICPP.DestroyConstraint2(world.ptr, constrain.ptr); | ||
355 | } | ||
356 | |||
357 | // ===================================================================================== | ||
358 | // btCollisionWorld entries | ||
359 | public override void UpdateSingleAabb(BulletWorld world, BulletBody obj) | ||
360 | { | ||
361 | BSAPICPP.UpdateSingleAabb2(world.ptr, obj.ptr); | ||
362 | } | ||
363 | |||
364 | public override void UpdateAabbs(BulletWorld world) | ||
365 | { | ||
366 | BSAPICPP.UpdateAabbs2(world.ptr); | ||
367 | } | ||
368 | |||
369 | public override bool GetForceUpdateAllAabbs(BulletWorld world) | ||
370 | { | ||
371 | return BSAPICPP.GetForceUpdateAllAabbs2(world.ptr); | ||
372 | } | ||
373 | |||
374 | public override void SetForceUpdateAllAabbs(BulletWorld world, bool force) | ||
375 | { | ||
376 | BSAPICPP.SetForceUpdateAllAabbs2(world.ptr, force); | ||
377 | } | ||
378 | |||
379 | // ===================================================================================== | ||
380 | // btDynamicsWorld entries | ||
381 | public override bool AddObjectToWorld(BulletWorld world, BulletBody obj) | ||
382 | { | ||
383 | return BSAPICPP.AddObjectToWorld2(world.ptr, obj.ptr); | ||
384 | } | ||
385 | |||
386 | public override bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj) | ||
387 | { | ||
388 | return BSAPICPP.RemoveObjectFromWorld2(world.ptr, obj.ptr); | ||
389 | } | ||
390 | |||
391 | public override bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects) | ||
392 | { | ||
393 | return BSAPICPP.AddConstraintToWorld2(world.ptr, constrain.ptr, disableCollisionsBetweenLinkedObjects); | ||
394 | } | ||
395 | |||
396 | public override bool RemoveConstraintFromWorld(BulletWorld world, BulletConstraint constrain) | ||
397 | { | ||
398 | return BSAPICPP.RemoveConstraintFromWorld2(world.ptr, constrain.ptr); | ||
399 | } | ||
400 | // ===================================================================================== | ||
401 | // btCollisionObject entries | ||
402 | public override Vector3 GetAnisotripicFriction(BulletConstraint constrain) | ||
403 | { | ||
404 | return BSAPICPP.GetAnisotripicFriction2(constrain.ptr); | ||
405 | } | ||
406 | |||
407 | public override Vector3 SetAnisotripicFriction(BulletConstraint constrain, Vector3 frict) | ||
408 | { | ||
409 | return BSAPICPP.SetAnisotripicFriction2(constrain.ptr, frict); | ||
410 | } | ||
411 | |||
412 | public override bool HasAnisotripicFriction(BulletConstraint constrain) | ||
413 | { | ||
414 | return BSAPICPP.HasAnisotripicFriction2(constrain.ptr); | ||
415 | } | ||
416 | |||
417 | public override void SetContactProcessingThreshold(BulletBody obj, float val) | ||
418 | { | ||
419 | BSAPICPP.SetContactProcessingThreshold2(obj.ptr, val); | ||
420 | } | ||
421 | |||
422 | public override float GetContactProcessingThreshold(BulletBody obj) | ||
423 | { | ||
424 | return BSAPICPP.GetContactProcessingThreshold2(obj.ptr); | ||
425 | } | ||
426 | |||
427 | public override bool IsStaticObject(BulletBody obj) | ||
428 | { | ||
429 | return BSAPICPP.IsStaticObject2(obj.ptr); | ||
430 | } | ||
431 | |||
432 | public override bool IsKinematicObject(BulletBody obj) | ||
433 | { | ||
434 | return BSAPICPP.IsKinematicObject2(obj.ptr); | ||
435 | } | ||
436 | |||
437 | public override bool IsStaticOrKinematicObject(BulletBody obj) | ||
438 | { | ||
439 | return BSAPICPP.IsStaticOrKinematicObject2(obj.ptr); | ||
440 | } | ||
441 | |||
442 | public override bool HasContactResponse(BulletBody obj) | ||
443 | { | ||
444 | return BSAPICPP.HasContactResponse2(obj.ptr); | ||
445 | } | ||
446 | |||
447 | public override void SetCollisionShape(BulletWorld sim, BulletBody obj, BulletShape shape) | ||
448 | { | ||
449 | BSAPICPP.SetCollisionShape2(sim.ptr, obj.ptr, shape.ptr); | ||
450 | } | ||
451 | |||
452 | public override BulletShape GetCollisionShape(BulletBody obj) | ||
453 | { | ||
454 | return new BulletShape(BSAPICPP.GetCollisionShape2(obj.ptr)); | ||
455 | } | ||
456 | |||
457 | public override int GetActivationState(BulletBody obj) | ||
458 | { | ||
459 | return BSAPICPP.GetActivationState2(obj.ptr); | ||
460 | } | ||
461 | |||
462 | public override void SetActivationState(BulletBody obj, int state) | ||
463 | { | ||
464 | BSAPICPP.SetActivationState2(obj.ptr, state); | ||
465 | } | ||
466 | |||
467 | public override void SetDeactivationTime(BulletBody obj, float dtime) | ||
468 | { | ||
469 | BSAPICPP.SetDeactivationTime2(obj.ptr, dtime); | ||
470 | } | ||
471 | |||
472 | public override float GetDeactivationTime(BulletBody obj) | ||
473 | { | ||
474 | return BSAPICPP.GetDeactivationTime2(obj.ptr); | ||
475 | } | ||
476 | |||
477 | public override void ForceActivationState(BulletBody obj, ActivationState state) | ||
478 | { | ||
479 | BSAPICPP.ForceActivationState2(obj.ptr, state); | ||
480 | } | ||
481 | |||
482 | public override void Activate(BulletBody obj, bool forceActivation) | ||
483 | { | ||
484 | BSAPICPP.Activate2(obj.ptr, forceActivation); | ||
485 | } | ||
486 | |||
487 | public override bool IsActive(BulletBody obj) | ||
488 | { | ||
489 | return BSAPICPP.IsActive2(obj.ptr); | ||
490 | } | ||
491 | |||
492 | public override void SetRestitution(BulletBody obj, float val) | ||
493 | { | ||
494 | BSAPICPP.SetRestitution2(obj.ptr, val); | ||
495 | } | ||
496 | |||
497 | public override float GetRestitution(BulletBody obj) | ||
498 | { | ||
499 | return BSAPICPP.GetRestitution2(obj.ptr); | ||
500 | } | ||
501 | |||
502 | public override void SetFriction(BulletBody obj, float val) | ||
503 | { | ||
504 | BSAPICPP.SetFriction2(obj.ptr, val); | ||
505 | } | ||
506 | |||
507 | public override float GetFriction(BulletBody obj) | ||
508 | { | ||
509 | return BSAPICPP.GetFriction2(obj.ptr); | ||
510 | } | ||
511 | |||
512 | public override Vector3 GetPosition(BulletBody obj) | ||
513 | { | ||
514 | return BSAPICPP.GetPosition2(obj.ptr); | ||
515 | } | ||
516 | |||
517 | public override Quaternion GetOrientation(BulletBody obj) | ||
518 | { | ||
519 | return BSAPICPP.GetOrientation2(obj.ptr); | ||
520 | } | ||
521 | |||
522 | public override void SetTranslation(BulletBody obj, Vector3 position, Quaternion rotation) | ||
523 | { | ||
524 | BSAPICPP.SetTranslation2(obj.ptr, position, rotation); | ||
525 | } | ||
526 | |||
527 | /* | ||
528 | public override IntPtr GetBroadphaseHandle(BulletBody obj) | ||
529 | { | ||
530 | return BSAPICPP.GetBroadphaseHandle2(obj.ptr); | ||
531 | } | ||
532 | |||
533 | public override void SetBroadphaseHandle(BulletBody obj, IntPtr handle) | ||
534 | { | ||
535 | BSAPICPP.SetUserPointer2(obj.ptr, handle); | ||
536 | } | ||
537 | */ | ||
538 | |||
539 | public override void SetInterpolationLinearVelocity(BulletBody obj, Vector3 vel) | ||
540 | { | ||
541 | BSAPICPP.SetInterpolationLinearVelocity2(obj.ptr, vel); | ||
542 | } | ||
543 | |||
544 | public override void SetInterpolationAngularVelocity(BulletBody obj, Vector3 vel) | ||
545 | { | ||
546 | BSAPICPP.SetInterpolationAngularVelocity2(obj.ptr, vel); | ||
547 | } | ||
548 | |||
549 | public override void SetInterpolationVelocity(BulletBody obj, Vector3 linearVel, Vector3 angularVel) | ||
550 | { | ||
551 | BSAPICPP.SetInterpolationVelocity2(obj.ptr, linearVel, angularVel); | ||
552 | } | ||
553 | |||
554 | public override float GetHitFraction(BulletBody obj) | ||
555 | { | ||
556 | return BSAPICPP.GetHitFraction2(obj.ptr); | ||
557 | } | ||
558 | |||
559 | public override void SetHitFraction(BulletBody obj, float val) | ||
560 | { | ||
561 | BSAPICPP.SetHitFraction2(obj.ptr, val); | ||
562 | } | ||
563 | |||
564 | public override CollisionFlags GetCollisionFlags(BulletBody obj) | ||
565 | { | ||
566 | return BSAPICPP.GetCollisionFlags2(obj.ptr); | ||
567 | } | ||
568 | |||
569 | public override CollisionFlags SetCollisionFlags(BulletBody obj, CollisionFlags flags) | ||
570 | { | ||
571 | return BSAPICPP.SetCollisionFlags2(obj.ptr, flags); | ||
572 | } | ||
573 | |||
574 | public override CollisionFlags AddToCollisionFlags(BulletBody obj, CollisionFlags flags) | ||
575 | { | ||
576 | return BSAPICPP.AddToCollisionFlags2(obj.ptr, flags); | ||
577 | } | ||
578 | |||
579 | public override CollisionFlags RemoveFromCollisionFlags(BulletBody obj, CollisionFlags flags) | ||
580 | { | ||
581 | return BSAPICPP.RemoveFromCollisionFlags2(obj.ptr, flags); | ||
582 | } | ||
583 | |||
584 | public override float GetCcdMotionThreshold(BulletBody obj) | ||
585 | { | ||
586 | return BSAPICPP.GetCcdMotionThreshold2(obj.ptr); | ||
587 | } | ||
588 | |||
589 | |||
590 | public override void SetCcdMotionThreshold(BulletBody obj, float val) | ||
591 | { | ||
592 | BSAPICPP.SetCcdMotionThreshold2(obj.ptr, val); | ||
593 | } | ||
594 | |||
595 | public override float GetCcdSweptSphereRadius(BulletBody obj) | ||
596 | { | ||
597 | return BSAPICPP.GetCcdSweptSphereRadius2(obj.ptr); | ||
598 | } | ||
599 | |||
600 | public override void SetCcdSweptSphereRadius(BulletBody obj, float val) | ||
601 | { | ||
602 | BSAPICPP.SetCcdSweptSphereRadius2(obj.ptr, val); | ||
603 | } | ||
604 | |||
605 | public override IntPtr GetUserPointer(BulletBody obj) | ||
606 | { | ||
607 | return BSAPICPP.GetUserPointer2(obj.ptr); | ||
608 | } | ||
609 | |||
610 | public override void SetUserPointer(BulletBody obj, IntPtr val) | ||
611 | { | ||
612 | BSAPICPP.SetUserPointer2(obj.ptr, val); | ||
613 | } | ||
614 | |||
615 | // ===================================================================================== | ||
616 | // btRigidBody entries | ||
617 | public override void ApplyGravity(BulletBody obj) | ||
618 | { | ||
619 | BSAPICPP.ApplyGravity2(obj.ptr); | ||
620 | } | ||
621 | |||
622 | public override void SetGravity(BulletBody obj, Vector3 val) | ||
623 | { | ||
624 | BSAPICPP.SetGravity2(obj.ptr, val); | ||
625 | } | ||
626 | |||
627 | public override Vector3 GetGravity(BulletBody obj) | ||
628 | { | ||
629 | return BSAPICPP.GetGravity2(obj.ptr); | ||
630 | } | ||
631 | |||
632 | public override void SetDamping(BulletBody obj, float lin_damping, float ang_damping) | ||
633 | { | ||
634 | BSAPICPP.SetDamping2(obj.ptr, lin_damping, ang_damping); | ||
635 | } | ||
636 | |||
637 | public override void SetLinearDamping(BulletBody obj, float lin_damping) | ||
638 | { | ||
639 | BSAPICPP.SetLinearDamping2(obj.ptr, lin_damping); | ||
640 | } | ||
641 | |||
642 | public override void SetAngularDamping(BulletBody obj, float ang_damping) | ||
643 | { | ||
644 | BSAPICPP.SetAngularDamping2(obj.ptr, ang_damping); | ||
645 | } | ||
646 | |||
647 | public override float GetLinearDamping(BulletBody obj) | ||
648 | { | ||
649 | return BSAPICPP.GetLinearDamping2(obj.ptr); | ||
650 | } | ||
651 | |||
652 | public override float GetAngularDamping(BulletBody obj) | ||
653 | { | ||
654 | return BSAPICPP.GetAngularDamping2(obj.ptr); | ||
655 | } | ||
656 | |||
657 | public override float GetLinearSleepingThreshold(BulletBody obj) | ||
658 | { | ||
659 | return BSAPICPP.GetLinearSleepingThreshold2(obj.ptr); | ||
660 | } | ||
661 | |||
662 | public override void ApplyDamping(BulletBody obj, float timeStep) | ||
663 | { | ||
664 | BSAPICPP.ApplyDamping2(obj.ptr, timeStep); | ||
665 | } | ||
666 | |||
667 | public override void SetMassProps(BulletBody obj, float mass, Vector3 inertia) | ||
668 | { | ||
669 | BSAPICPP.SetMassProps2(obj.ptr, mass, inertia); | ||
670 | } | ||
671 | |||
672 | public override Vector3 GetLinearFactor(BulletBody obj) | ||
673 | { | ||
674 | return BSAPICPP.GetLinearFactor2(obj.ptr); | ||
675 | } | ||
676 | |||
677 | public override void SetLinearFactor(BulletBody obj, Vector3 factor) | ||
678 | { | ||
679 | BSAPICPP.SetLinearFactor2(obj.ptr, factor); | ||
680 | } | ||
681 | |||
682 | public override void SetCenterOfMassByPosRot(BulletBody obj, Vector3 pos, Quaternion rot) | ||
683 | { | ||
684 | BSAPICPP.SetCenterOfMassByPosRot2(obj.ptr, pos, rot); | ||
685 | } | ||
686 | |||
687 | // Add a force to the object as if its mass is one. | ||
688 | public override void ApplyCentralForce(BulletBody obj, Vector3 force) | ||
689 | { | ||
690 | BSAPICPP.ApplyCentralForce2(obj.ptr, force); | ||
691 | } | ||
692 | |||
693 | // Set the force being applied to the object as if its mass is one. | ||
694 | public override void SetObjectForce(BulletBody obj, Vector3 force) | ||
695 | { | ||
696 | BSAPICPP.SetObjectForce2(obj.ptr, force); | ||
697 | } | ||
698 | |||
699 | public override Vector3 GetTotalForce(BulletBody obj) | ||
700 | { | ||
701 | return BSAPICPP.GetTotalForce2(obj.ptr); | ||
702 | } | ||
703 | |||
704 | public override Vector3 GetTotalTorque(BulletBody obj) | ||
705 | { | ||
706 | return BSAPICPP.GetTotalTorque2(obj.ptr); | ||
707 | } | ||
708 | |||
709 | public override Vector3 GetInvInertiaDiagLocal(BulletBody obj) | ||
710 | { | ||
711 | return BSAPICPP.GetInvInertiaDiagLocal2(obj.ptr); | ||
712 | } | ||
713 | |||
714 | public override void SetInvInertiaDiagLocal(BulletBody obj, Vector3 inert) | ||
715 | { | ||
716 | BSAPICPP.SetInvInertiaDiagLocal2(obj.ptr, inert); | ||
717 | } | ||
718 | |||
719 | public override void SetSleepingThresholds(BulletBody obj, float lin_threshold, float ang_threshold) | ||
720 | { | ||
721 | BSAPICPP.SetSleepingThresholds2(obj.ptr, lin_threshold, ang_threshold); | ||
722 | } | ||
723 | |||
724 | public override void ApplyTorque(BulletBody obj, Vector3 torque) | ||
725 | { | ||
726 | BSAPICPP.ApplyTorque2(obj.ptr, torque); | ||
727 | } | ||
728 | |||
729 | // Apply force at the given point. Will add torque to the object. | ||
730 | public override void ApplyForce(BulletBody obj, Vector3 force, Vector3 pos) | ||
731 | { | ||
732 | BSAPICPP.ApplyForce2(obj.ptr, force, pos); | ||
733 | } | ||
734 | |||
735 | // Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass. | ||
736 | public override void ApplyCentralImpulse(BulletBody obj, Vector3 imp) | ||
737 | { | ||
738 | BSAPICPP.ApplyCentralImpulse2(obj.ptr, imp); | ||
739 | } | ||
740 | |||
741 | // Apply impulse to the object's torque. Force is scaled by object's mass. | ||
742 | public override void ApplyTorqueImpulse(BulletBody obj, Vector3 imp) | ||
743 | { | ||
744 | BSAPICPP.ApplyTorqueImpulse2(obj.ptr, imp); | ||
745 | } | ||
746 | |||
747 | // Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces. | ||
748 | public override void ApplyImpulse(BulletBody obj, Vector3 imp, Vector3 pos) | ||
749 | { | ||
750 | BSAPICPP.ApplyImpulse2(obj.ptr, imp, pos); | ||
751 | } | ||
752 | |||
753 | public override void ClearForces(BulletBody obj) | ||
754 | { | ||
755 | BSAPICPP.ClearForces2(obj.ptr); | ||
756 | } | ||
757 | |||
758 | public override void ClearAllForces(BulletBody obj) | ||
759 | { | ||
760 | BSAPICPP.ClearAllForces2(obj.ptr); | ||
761 | } | ||
762 | |||
763 | public override void UpdateInertiaTensor(BulletBody obj) | ||
764 | { | ||
765 | BSAPICPP.UpdateInertiaTensor2(obj.ptr); | ||
766 | } | ||
767 | |||
768 | public override Vector3 GetLinearVelocity(BulletBody obj) | ||
769 | { | ||
770 | return BSAPICPP.GetLinearVelocity2(obj.ptr); | ||
771 | } | ||
772 | |||
773 | public override Vector3 GetAngularVelocity(BulletBody obj) | ||
774 | { | ||
775 | return BSAPICPP.GetAngularVelocity2(obj.ptr); | ||
776 | } | ||
777 | |||
778 | public override void SetLinearVelocity(BulletBody obj, Vector3 vel) | ||
779 | { | ||
780 | BSAPICPP.SetLinearVelocity2(obj.ptr, vel); | ||
781 | } | ||
782 | |||
783 | public override void SetAngularVelocity(BulletBody obj, Vector3 angularVelocity) | ||
784 | { | ||
785 | BSAPICPP.SetAngularVelocity2(obj.ptr, angularVelocity); | ||
786 | } | ||
787 | |||
788 | public override Vector3 GetVelocityInLocalPoint(BulletBody obj, Vector3 pos) | ||
789 | { | ||
790 | return BSAPICPP.GetVelocityInLocalPoint2(obj.ptr, pos); | ||
791 | } | ||
792 | |||
793 | public override void Translate(BulletBody obj, Vector3 trans) | ||
794 | { | ||
795 | BSAPICPP.Translate2(obj.ptr, trans); | ||
796 | } | ||
797 | |||
798 | public override void UpdateDeactivation(BulletBody obj, float timeStep) | ||
799 | { | ||
800 | BSAPICPP.UpdateDeactivation2(obj.ptr, timeStep); | ||
801 | } | ||
802 | |||
803 | public override bool WantsSleeping(BulletBody obj) | ||
804 | { | ||
805 | return BSAPICPP.WantsSleeping2(obj.ptr); | ||
806 | } | ||
807 | |||
808 | public override void SetAngularFactor(BulletBody obj, float factor) | ||
809 | { | ||
810 | BSAPICPP.SetAngularFactor2(obj.ptr, factor); | ||
811 | } | ||
812 | |||
813 | public override void SetAngularFactorV(BulletBody obj, Vector3 factor) | ||
814 | { | ||
815 | BSAPICPP.SetAngularFactorV2(obj.ptr, factor); | ||
816 | } | ||
817 | |||
818 | public override Vector3 GetAngularFactor(BulletBody obj) | ||
819 | { | ||
820 | return BSAPICPP.GetAngularFactor2(obj.ptr); | ||
821 | } | ||
822 | |||
823 | public override bool IsInWorld(BulletBody obj) | ||
824 | { | ||
825 | return BSAPICPP.IsInWorld2(obj.ptr); | ||
826 | } | ||
827 | |||
828 | public override void AddConstraintRef(BulletBody obj, BulletConstraint constrain) | ||
829 | { | ||
830 | BSAPICPP.AddConstraintRef2(obj.ptr, constrain.ptr); | ||
831 | } | ||
832 | |||
833 | public override void RemoveConstraintRef(BulletBody obj, BulletConstraint constrain) | ||
834 | { | ||
835 | BSAPICPP.RemoveConstraintRef2(obj.ptr, constrain.ptr); | ||
836 | } | ||
837 | |||
838 | public override BulletConstraint GetConstraintRef(BulletBody obj, int index) | ||
839 | { | ||
840 | return new BulletConstraint(BSAPICPP.GetConstraintRef2(obj.ptr, index)); | ||
841 | } | ||
842 | |||
843 | public override int GetNumConstraintRefs(BulletBody obj) | ||
844 | { | ||
845 | return BSAPICPP.GetNumConstraintRefs2(obj.ptr); | ||
846 | } | ||
847 | |||
848 | public override bool SetCollisionGroupMask(BulletBody body, uint filter, uint mask) | ||
849 | { | ||
850 | return BSAPICPP.SetCollisionGroupMask2(body.ptr, filter, mask); | ||
851 | } | ||
852 | |||
853 | // ===================================================================================== | ||
854 | // btCollisionShape entries | ||
855 | |||
856 | public override float GetAngularMotionDisc(BulletShape shape) | ||
857 | { | ||
858 | return BSAPICPP.GetAngularMotionDisc2(shape.ptr); | ||
859 | } | ||
860 | |||
861 | public override float GetContactBreakingThreshold(BulletShape shape, float defaultFactor) | ||
862 | { | ||
863 | return BSAPICPP.GetContactBreakingThreshold2(shape.ptr, defaultFactor); | ||
864 | } | ||
865 | |||
866 | public override bool IsPolyhedral(BulletShape shape) | ||
867 | { | ||
868 | return BSAPICPP.IsPolyhedral2(shape.ptr); | ||
869 | } | ||
870 | |||
871 | public override bool IsConvex2d(BulletShape shape) | ||
872 | { | ||
873 | return BSAPICPP.IsConvex2d2(shape.ptr); | ||
874 | } | ||
875 | |||
876 | public override bool IsConvex(BulletShape shape) | ||
877 | { | ||
878 | return BSAPICPP.IsConvex2(shape.ptr); | ||
879 | } | ||
880 | |||
881 | public override bool IsNonMoving(BulletShape shape) | ||
882 | { | ||
883 | return BSAPICPP.IsNonMoving2(shape.ptr); | ||
884 | } | ||
885 | |||
886 | public override bool IsConcave(BulletShape shape) | ||
887 | { | ||
888 | return BSAPICPP.IsConcave2(shape.ptr); | ||
889 | } | ||
890 | |||
891 | public override bool IsCompound(BulletShape shape) | ||
892 | { | ||
893 | return BSAPICPP.IsCompound2(shape.ptr); | ||
894 | } | ||
895 | |||
896 | public override bool IsSoftBody(BulletShape shape) | ||
897 | { | ||
898 | return BSAPICPP.IsSoftBody2(shape.ptr); | ||
899 | } | ||
900 | |||
901 | public override bool IsInfinite(BulletShape shape) | ||
902 | { | ||
903 | return BSAPICPP.IsInfinite2(shape.ptr); | ||
904 | } | ||
905 | |||
906 | public override void SetLocalScaling(BulletShape shape, Vector3 scale) | ||
907 | { | ||
908 | BSAPICPP.SetLocalScaling2(shape.ptr, scale); | ||
909 | } | ||
910 | |||
911 | public override Vector3 GetLocalScaling(BulletShape shape) | ||
912 | { | ||
913 | return BSAPICPP.GetLocalScaling2(shape.ptr); | ||
914 | } | ||
915 | |||
916 | public override Vector3 CalculateLocalInertia(BulletShape shape, float mass) | ||
917 | { | ||
918 | return BSAPICPP.CalculateLocalInertia2(shape.ptr, mass); | ||
919 | } | ||
920 | |||
921 | public override int GetShapeType(BulletShape shape) | ||
922 | { | ||
923 | return BSAPICPP.GetShapeType2(shape.ptr); | ||
924 | } | ||
925 | |||
926 | public override void SetMargin(BulletShape shape, float val) | ||
927 | { | ||
928 | BSAPICPP.SetMargin2(shape.ptr, val); | ||
929 | } | ||
930 | |||
931 | public override float GetMargin(BulletShape shape) | ||
932 | { | ||
933 | return BSAPICPP.GetMargin2(shape.ptr); | ||
934 | } | ||
935 | |||
936 | // ===================================================================================== | ||
937 | // Debugging | ||
938 | public override void DumpRigidBody(BulletWorld sim, BulletBody collisionObject) | ||
939 | { | ||
940 | BSAPICPP.DumpRigidBody2(sim.ptr, collisionObject.ptr); | ||
941 | } | ||
942 | |||
943 | public override void DumpCollisionShape(BulletWorld sim, BulletShape collisionShape) | ||
944 | { | ||
945 | BSAPICPP.DumpCollisionShape2(sim.ptr, collisionShape.ptr); | ||
946 | } | ||
947 | |||
948 | public override void DumpConstraint(BulletWorld sim, BulletConstraint constrain) | ||
949 | { | ||
950 | BSAPICPP.DumpConstraint2(sim.ptr, constrain.ptr); | ||
951 | } | ||
952 | |||
953 | public override void DumpActivationInfo(BulletWorld sim) | ||
954 | { | ||
955 | BSAPICPP.DumpActivationInfo2(sim.ptr); | ||
956 | } | ||
957 | |||
958 | public override void DumpAllInfo(BulletWorld sim) | ||
959 | { | ||
960 | BSAPICPP.DumpAllInfo2(sim.ptr); | ||
961 | } | ||
962 | |||
963 | public override void DumpPhysicsStatistics(BulletWorld sim) | ||
964 | { | ||
965 | BSAPICPP.DumpPhysicsStatistics2(sim.ptr); | ||
966 | } | ||
967 | |||
968 | |||
969 | // ===================================================================================== | ||
970 | // ===================================================================================== | ||
971 | // ===================================================================================== | ||
972 | // ===================================================================================== | ||
973 | // ===================================================================================== | ||
974 | // The actual interface to the unmanaged code | ||
975 | static class BSAPICPP | ||
976 | { | ||
977 | // =============================================================================== | ||
978 | // Link back to the managed code for outputting log messages | ||
979 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
980 | public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg); | ||
981 | |||
982 | // =============================================================================== | ||
983 | // Initialization and simulation | ||
984 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
985 | public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms, | ||
986 | int maxCollisions, IntPtr collisionArray, | ||
987 | int maxUpdates, IntPtr updateArray, | ||
988 | DebugLogCallback logRoutine); | ||
989 | |||
990 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
991 | public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep, | ||
992 | out int updatedEntityCount, out int collidersCount); | ||
993 | |||
994 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
995 | public static extern void Shutdown2(IntPtr sim); | ||
996 | |||
997 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
998 | public static extern bool PushUpdate2(IntPtr obj); | ||
999 | |||
1000 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1001 | public static extern bool UpdateParameter2(IntPtr world, uint localID, String parm, float value); | ||
1002 | |||
1003 | // ===================================================================================== | ||
1004 | // Mesh, hull, shape and body creation helper routines | ||
1005 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1006 | public static extern IntPtr CreateMeshShape2(IntPtr world, | ||
1007 | int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices, | ||
1008 | int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices ); | ||
1009 | |||
1010 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1011 | public static extern IntPtr CreateHullShape2(IntPtr world, | ||
1012 | int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls); | ||
1013 | |||
1014 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1015 | public static extern IntPtr BuildHullShapeFromMesh2(IntPtr world, IntPtr meshShape); | ||
1016 | |||
1017 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1018 | public static extern IntPtr BuildNativeShape2(IntPtr world, ShapeData shapeData); | ||
1019 | |||
1020 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1021 | public static extern bool IsNativeShape2(IntPtr shape); | ||
1022 | |||
1023 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1024 | public static extern void SetShapeCollisionMargin2(IntPtr shape, float margin); | ||
1025 | |||
1026 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1027 | public static extern IntPtr BuildCapsuleShape2(IntPtr world, float radius, float height, Vector3 scale); | ||
1028 | |||
1029 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1030 | public static extern IntPtr CreateCompoundShape2(IntPtr sim, bool enableDynamicAabbTree); | ||
1031 | |||
1032 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1033 | public static extern int GetNumberOfCompoundChildren2(IntPtr cShape); | ||
1034 | |||
1035 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1036 | public static extern void AddChildShapeToCompoundShape2(IntPtr cShape, IntPtr addShape, Vector3 pos, Quaternion rot); | ||
1037 | |||
1038 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1039 | public static extern IntPtr GetChildShapeFromCompoundShapeIndex2(IntPtr cShape, int indx); | ||
1040 | |||
1041 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1042 | public static extern IntPtr RemoveChildShapeFromCompoundShapeIndex2(IntPtr cShape, int indx); | ||
1043 | |||
1044 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1045 | public static extern void RemoveChildShapeFromCompoundShape2(IntPtr cShape, IntPtr removeShape); | ||
1046 | |||
1047 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1048 | public static extern void RecalculateCompoundShapeLocalAabb2(IntPtr cShape); | ||
1049 | |||
1050 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1051 | public static extern IntPtr DuplicateCollisionShape2(IntPtr sim, IntPtr srcShape, uint id); | ||
1052 | |||
1053 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1054 | public static extern bool DeleteCollisionShape2(IntPtr world, IntPtr shape); | ||
1055 | |||
1056 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1057 | public static extern int GetBodyType2(IntPtr obj); | ||
1058 | |||
1059 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1060 | public static extern IntPtr CreateBodyFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot); | ||
1061 | |||
1062 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1063 | public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, uint id, Vector3 pos, Quaternion rot); | ||
1064 | |||
1065 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1066 | public static extern IntPtr CreateGhostFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot); | ||
1067 | |||
1068 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1069 | public static extern void DestroyObject2(IntPtr sim, IntPtr obj); | ||
1070 | |||
1071 | // ===================================================================================== | ||
1072 | // Terrain creation and helper routines | ||
1073 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1074 | public static extern IntPtr CreateGroundPlaneShape2(uint id, float height, float collisionMargin); | ||
1075 | |||
1076 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1077 | public static extern IntPtr CreateTerrainShape2(uint id, Vector3 size, float minHeight, float maxHeight, | ||
1078 | [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, | ||
1079 | float scaleFactor, float collisionMargin); | ||
1080 | |||
1081 | // ===================================================================================== | ||
1082 | // Constraint creation and helper routines | ||
1083 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1084 | public static extern IntPtr Create6DofConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, | ||
1085 | Vector3 frame1loc, Quaternion frame1rot, | ||
1086 | Vector3 frame2loc, Quaternion frame2rot, | ||
1087 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
1088 | |||
1089 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1090 | public static extern IntPtr Create6DofConstraintToPoint2(IntPtr world, IntPtr obj1, IntPtr obj2, | ||
1091 | Vector3 joinPoint, | ||
1092 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
1093 | |||
1094 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1095 | public static extern IntPtr CreateHingeConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, | ||
1096 | Vector3 pivotinA, Vector3 pivotinB, | ||
1097 | Vector3 axisInA, Vector3 axisInB, | ||
1098 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
1099 | |||
1100 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1101 | public static extern void SetConstraintEnable2(IntPtr constrain, float numericTrueFalse); | ||
1102 | |||
1103 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1104 | public static extern void SetConstraintNumSolverIterations2(IntPtr constrain, float iterations); | ||
1105 | |||
1106 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1107 | public static extern bool SetFrames2(IntPtr constrain, | ||
1108 | Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot); | ||
1109 | |||
1110 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1111 | public static extern bool SetLinearLimits2(IntPtr constrain, Vector3 low, Vector3 hi); | ||
1112 | |||
1113 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1114 | public static extern bool SetAngularLimits2(IntPtr constrain, Vector3 low, Vector3 hi); | ||
1115 | |||
1116 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1117 | public static extern bool UseFrameOffset2(IntPtr constrain, float enable); | ||
1118 | |||
1119 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1120 | public static extern bool TranslationalLimitMotor2(IntPtr constrain, float enable, float targetVel, float maxMotorForce); | ||
1121 | |||
1122 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1123 | public static extern bool SetBreakingImpulseThreshold2(IntPtr constrain, float threshold); | ||
1124 | |||
1125 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1126 | public static extern bool CalculateTransforms2(IntPtr constrain); | ||
1127 | |||
1128 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1129 | public static extern bool SetConstraintParam2(IntPtr constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis); | ||
1130 | |||
1131 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1132 | public static extern bool DestroyConstraint2(IntPtr world, IntPtr constrain); | ||
1133 | |||
1134 | // ===================================================================================== | ||
1135 | // btCollisionWorld entries | ||
1136 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1137 | public static extern void UpdateSingleAabb2(IntPtr world, IntPtr obj); | ||
1138 | |||
1139 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1140 | public static extern void UpdateAabbs2(IntPtr world); | ||
1141 | |||
1142 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1143 | public static extern bool GetForceUpdateAllAabbs2(IntPtr world); | ||
1144 | |||
1145 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1146 | public static extern void SetForceUpdateAllAabbs2(IntPtr world, bool force); | ||
1147 | |||
1148 | // ===================================================================================== | ||
1149 | // btDynamicsWorld entries | ||
1150 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1151 | public static extern bool AddObjectToWorld2(IntPtr world, IntPtr obj); | ||
1152 | |||
1153 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1154 | public static extern bool RemoveObjectFromWorld2(IntPtr world, IntPtr obj); | ||
1155 | |||
1156 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1157 | public static extern bool AddConstraintToWorld2(IntPtr world, IntPtr constrain, bool disableCollisionsBetweenLinkedObjects); | ||
1158 | |||
1159 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1160 | public static extern bool RemoveConstraintFromWorld2(IntPtr world, IntPtr constrain); | ||
1161 | // ===================================================================================== | ||
1162 | // btCollisionObject entries | ||
1163 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1164 | public static extern Vector3 GetAnisotripicFriction2(IntPtr constrain); | ||
1165 | |||
1166 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1167 | public static extern Vector3 SetAnisotripicFriction2(IntPtr constrain, Vector3 frict); | ||
1168 | |||
1169 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1170 | public static extern bool HasAnisotripicFriction2(IntPtr constrain); | ||
1171 | |||
1172 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1173 | public static extern void SetContactProcessingThreshold2(IntPtr obj, float val); | ||
1174 | |||
1175 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1176 | public static extern float GetContactProcessingThreshold2(IntPtr obj); | ||
1177 | |||
1178 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1179 | public static extern bool IsStaticObject2(IntPtr obj); | ||
1180 | |||
1181 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1182 | public static extern bool IsKinematicObject2(IntPtr obj); | ||
1183 | |||
1184 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1185 | public static extern bool IsStaticOrKinematicObject2(IntPtr obj); | ||
1186 | |||
1187 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1188 | public static extern bool HasContactResponse2(IntPtr obj); | ||
1189 | |||
1190 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1191 | public static extern void SetCollisionShape2(IntPtr sim, IntPtr obj, IntPtr shape); | ||
1192 | |||
1193 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1194 | public static extern IntPtr GetCollisionShape2(IntPtr obj); | ||
1195 | |||
1196 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1197 | public static extern int GetActivationState2(IntPtr obj); | ||
1198 | |||
1199 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1200 | public static extern void SetActivationState2(IntPtr obj, int state); | ||
1201 | |||
1202 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1203 | public static extern void SetDeactivationTime2(IntPtr obj, float dtime); | ||
1204 | |||
1205 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1206 | public static extern float GetDeactivationTime2(IntPtr obj); | ||
1207 | |||
1208 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1209 | public static extern void ForceActivationState2(IntPtr obj, ActivationState state); | ||
1210 | |||
1211 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1212 | public static extern void Activate2(IntPtr obj, bool forceActivation); | ||
1213 | |||
1214 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1215 | public static extern bool IsActive2(IntPtr obj); | ||
1216 | |||
1217 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1218 | public static extern void SetRestitution2(IntPtr obj, float val); | ||
1219 | |||
1220 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1221 | public static extern float GetRestitution2(IntPtr obj); | ||
1222 | |||
1223 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1224 | public static extern void SetFriction2(IntPtr obj, float val); | ||
1225 | |||
1226 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1227 | public static extern float GetFriction2(IntPtr obj); | ||
1228 | |||
1229 | /* Haven't defined the type 'Transform' | ||
1230 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1231 | public static extern Transform GetWorldTransform2(IntPtr obj); | ||
1232 | |||
1233 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1234 | public static extern void setWorldTransform2(IntPtr obj, Transform trans); | ||
1235 | */ | ||
1236 | |||
1237 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1238 | public static extern Vector3 GetPosition2(IntPtr obj); | ||
1239 | |||
1240 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1241 | public static extern Quaternion GetOrientation2(IntPtr obj); | ||
1242 | |||
1243 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1244 | public static extern void SetTranslation2(IntPtr obj, Vector3 position, Quaternion rotation); | ||
1245 | |||
1246 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1247 | public static extern IntPtr GetBroadphaseHandle2(IntPtr obj); | ||
1248 | |||
1249 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1250 | public static extern void SetBroadphaseHandle2(IntPtr obj, IntPtr handle); | ||
1251 | |||
1252 | /* | ||
1253 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1254 | public static extern Transform GetInterpolationWorldTransform2(IntPtr obj); | ||
1255 | |||
1256 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1257 | public static extern void SetInterpolationWorldTransform2(IntPtr obj, Transform trans); | ||
1258 | */ | ||
1259 | |||
1260 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1261 | public static extern void SetInterpolationLinearVelocity2(IntPtr obj, Vector3 vel); | ||
1262 | |||
1263 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1264 | public static extern void SetInterpolationAngularVelocity2(IntPtr obj, Vector3 vel); | ||
1265 | |||
1266 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1267 | public static extern void SetInterpolationVelocity2(IntPtr obj, Vector3 linearVel, Vector3 angularVel); | ||
1268 | |||
1269 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1270 | public static extern float GetHitFraction2(IntPtr obj); | ||
1271 | |||
1272 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1273 | public static extern void SetHitFraction2(IntPtr obj, float val); | ||
1274 | |||
1275 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1276 | public static extern CollisionFlags GetCollisionFlags2(IntPtr obj); | ||
1277 | |||
1278 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1279 | public static extern CollisionFlags SetCollisionFlags2(IntPtr obj, CollisionFlags flags); | ||
1280 | |||
1281 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1282 | public static extern CollisionFlags AddToCollisionFlags2(IntPtr obj, CollisionFlags flags); | ||
1283 | |||
1284 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1285 | public static extern CollisionFlags RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags); | ||
1286 | |||
1287 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1288 | public static extern float GetCcdMotionThreshold2(IntPtr obj); | ||
1289 | |||
1290 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1291 | public static extern void SetCcdMotionThreshold2(IntPtr obj, float val); | ||
1292 | |||
1293 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1294 | public static extern float GetCcdSweptSphereRadius2(IntPtr obj); | ||
1295 | |||
1296 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1297 | public static extern void SetCcdSweptSphereRadius2(IntPtr obj, float val); | ||
1298 | |||
1299 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1300 | public static extern IntPtr GetUserPointer2(IntPtr obj); | ||
1301 | |||
1302 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1303 | public static extern void SetUserPointer2(IntPtr obj, IntPtr val); | ||
1304 | |||
1305 | // ===================================================================================== | ||
1306 | // btRigidBody entries | ||
1307 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1308 | public static extern void ApplyGravity2(IntPtr obj); | ||
1309 | |||
1310 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1311 | public static extern void SetGravity2(IntPtr obj, Vector3 val); | ||
1312 | |||
1313 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1314 | public static extern Vector3 GetGravity2(IntPtr obj); | ||
1315 | |||
1316 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1317 | public static extern void SetDamping2(IntPtr obj, float lin_damping, float ang_damping); | ||
1318 | |||
1319 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1320 | public static extern void SetLinearDamping2(IntPtr obj, float lin_damping); | ||
1321 | |||
1322 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1323 | public static extern void SetAngularDamping2(IntPtr obj, float ang_damping); | ||
1324 | |||
1325 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1326 | public static extern float GetLinearDamping2(IntPtr obj); | ||
1327 | |||
1328 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1329 | public static extern float GetAngularDamping2(IntPtr obj); | ||
1330 | |||
1331 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1332 | public static extern float GetLinearSleepingThreshold2(IntPtr obj); | ||
1333 | |||
1334 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1335 | public static extern float GetAngularSleepingThreshold2(IntPtr obj); | ||
1336 | |||
1337 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1338 | public static extern void ApplyDamping2(IntPtr obj, float timeStep); | ||
1339 | |||
1340 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1341 | public static extern void SetMassProps2(IntPtr obj, float mass, Vector3 inertia); | ||
1342 | |||
1343 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1344 | public static extern Vector3 GetLinearFactor2(IntPtr obj); | ||
1345 | |||
1346 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1347 | public static extern void SetLinearFactor2(IntPtr obj, Vector3 factor); | ||
1348 | |||
1349 | /* | ||
1350 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1351 | public static extern void SetCenterOfMassTransform2(IntPtr obj, Transform trans); | ||
1352 | */ | ||
1353 | |||
1354 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1355 | public static extern void SetCenterOfMassByPosRot2(IntPtr obj, Vector3 pos, Quaternion rot); | ||
1356 | |||
1357 | // Add a force to the object as if its mass is one. | ||
1358 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1359 | public static extern void ApplyCentralForce2(IntPtr obj, Vector3 force); | ||
1360 | |||
1361 | // Set the force being applied to the object as if its mass is one. | ||
1362 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1363 | public static extern void SetObjectForce2(IntPtr obj, Vector3 force); | ||
1364 | |||
1365 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1366 | public static extern Vector3 GetTotalForce2(IntPtr obj); | ||
1367 | |||
1368 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1369 | public static extern Vector3 GetTotalTorque2(IntPtr obj); | ||
1370 | |||
1371 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1372 | public static extern Vector3 GetInvInertiaDiagLocal2(IntPtr obj); | ||
1373 | |||
1374 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1375 | public static extern void SetInvInertiaDiagLocal2(IntPtr obj, Vector3 inert); | ||
1376 | |||
1377 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1378 | public static extern void SetSleepingThresholds2(IntPtr obj, float lin_threshold, float ang_threshold); | ||
1379 | |||
1380 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1381 | public static extern void ApplyTorque2(IntPtr obj, Vector3 torque); | ||
1382 | |||
1383 | // Apply force at the given point. Will add torque to the object. | ||
1384 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1385 | public static extern void ApplyForce2(IntPtr obj, Vector3 force, Vector3 pos); | ||
1386 | |||
1387 | // Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass. | ||
1388 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1389 | public static extern void ApplyCentralImpulse2(IntPtr obj, Vector3 imp); | ||
1390 | |||
1391 | // Apply impulse to the object's torque. Force is scaled by object's mass. | ||
1392 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1393 | public static extern void ApplyTorqueImpulse2(IntPtr obj, Vector3 imp); | ||
1394 | |||
1395 | // Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces. | ||
1396 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1397 | public static extern void ApplyImpulse2(IntPtr obj, Vector3 imp, Vector3 pos); | ||
1398 | |||
1399 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1400 | public static extern void ClearForces2(IntPtr obj); | ||
1401 | |||
1402 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1403 | public static extern void ClearAllForces2(IntPtr obj); | ||
1404 | |||
1405 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1406 | public static extern void UpdateInertiaTensor2(IntPtr obj); | ||
1407 | |||
1408 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1409 | public static extern Vector3 GetCenterOfMassPosition2(IntPtr obj); | ||
1410 | |||
1411 | /* | ||
1412 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1413 | public static extern Transform GetCenterOfMassTransform2(IntPtr obj); | ||
1414 | */ | ||
1415 | |||
1416 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1417 | public static extern Vector3 GetLinearVelocity2(IntPtr obj); | ||
1418 | |||
1419 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1420 | public static extern Vector3 GetAngularVelocity2(IntPtr obj); | ||
1421 | |||
1422 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1423 | public static extern void SetLinearVelocity2(IntPtr obj, Vector3 val); | ||
1424 | |||
1425 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1426 | public static extern void SetAngularVelocity2(IntPtr obj, Vector3 angularVelocity); | ||
1427 | |||
1428 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1429 | public static extern Vector3 GetVelocityInLocalPoint2(IntPtr obj, Vector3 pos); | ||
1430 | |||
1431 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1432 | public static extern void Translate2(IntPtr obj, Vector3 trans); | ||
1433 | |||
1434 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1435 | public static extern void UpdateDeactivation2(IntPtr obj, float timeStep); | ||
1436 | |||
1437 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1438 | public static extern bool WantsSleeping2(IntPtr obj); | ||
1439 | |||
1440 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1441 | public static extern void SetAngularFactor2(IntPtr obj, float factor); | ||
1442 | |||
1443 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1444 | public static extern void SetAngularFactorV2(IntPtr obj, Vector3 factor); | ||
1445 | |||
1446 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1447 | public static extern Vector3 GetAngularFactor2(IntPtr obj); | ||
1448 | |||
1449 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1450 | public static extern bool IsInWorld2(IntPtr obj); | ||
1451 | |||
1452 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1453 | public static extern void AddConstraintRef2(IntPtr obj, IntPtr constrain); | ||
1454 | |||
1455 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1456 | public static extern void RemoveConstraintRef2(IntPtr obj, IntPtr constrain); | ||
1457 | |||
1458 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1459 | public static extern IntPtr GetConstraintRef2(IntPtr obj, int index); | ||
1460 | |||
1461 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1462 | public static extern int GetNumConstraintRefs2(IntPtr obj); | ||
1463 | |||
1464 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1465 | public static extern bool SetCollisionGroupMask2(IntPtr body, uint filter, uint mask); | ||
1466 | |||
1467 | // ===================================================================================== | ||
1468 | // btCollisionShape entries | ||
1469 | |||
1470 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1471 | public static extern float GetAngularMotionDisc2(IntPtr shape); | ||
1472 | |||
1473 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1474 | public static extern float GetContactBreakingThreshold2(IntPtr shape, float defaultFactor); | ||
1475 | |||
1476 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1477 | public static extern bool IsPolyhedral2(IntPtr shape); | ||
1478 | |||
1479 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1480 | public static extern bool IsConvex2d2(IntPtr shape); | ||
1481 | |||
1482 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1483 | public static extern bool IsConvex2(IntPtr shape); | ||
1484 | |||
1485 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1486 | public static extern bool IsNonMoving2(IntPtr shape); | ||
1487 | |||
1488 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1489 | public static extern bool IsConcave2(IntPtr shape); | ||
1490 | |||
1491 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1492 | public static extern bool IsCompound2(IntPtr shape); | ||
1493 | |||
1494 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1495 | public static extern bool IsSoftBody2(IntPtr shape); | ||
1496 | |||
1497 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1498 | public static extern bool IsInfinite2(IntPtr shape); | ||
1499 | |||
1500 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1501 | public static extern void SetLocalScaling2(IntPtr shape, Vector3 scale); | ||
1502 | |||
1503 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1504 | public static extern Vector3 GetLocalScaling2(IntPtr shape); | ||
1505 | |||
1506 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1507 | public static extern Vector3 CalculateLocalInertia2(IntPtr shape, float mass); | ||
1508 | |||
1509 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1510 | public static extern int GetShapeType2(IntPtr shape); | ||
1511 | |||
1512 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1513 | public static extern void SetMargin2(IntPtr shape, float val); | ||
1514 | |||
1515 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1516 | public static extern float GetMargin2(IntPtr shape); | ||
1517 | |||
1518 | // ===================================================================================== | ||
1519 | // Debugging | ||
1520 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1521 | public static extern void DumpRigidBody2(IntPtr sim, IntPtr collisionObject); | ||
1522 | |||
1523 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1524 | public static extern void DumpCollisionShape2(IntPtr sim, IntPtr collisionShape); | ||
1525 | |||
1526 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1527 | public static extern void DumpMapInfo2(IntPtr sim, IntPtr manInfo); | ||
1528 | |||
1529 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1530 | public static extern void DumpConstraint2(IntPtr sim, IntPtr constrain); | ||
1531 | |||
1532 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1533 | public static extern void DumpActivationInfo2(IntPtr sim); | ||
1534 | |||
1535 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1536 | public static extern void DumpAllInfo2(IntPtr sim); | ||
1537 | |||
1538 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1539 | public static extern void DumpPhysicsStatistics2(IntPtr sim); | ||
1540 | |||
1541 | } | ||
1542 | |||
1543 | } | ||
1544 | |||
1545 | } | ||