diff options
Diffstat (limited to 'OpenSim/Region/PhysicsModules/BulletS/BSAPIUnman.cs')
-rwxr-xr-x | OpenSim/Region/PhysicsModules/BulletS/BSAPIUnman.cs | 2120 |
1 files changed, 2120 insertions, 0 deletions
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSAPIUnman.cs b/OpenSim/Region/PhysicsModules/BulletS/BSAPIUnman.cs new file mode 100755 index 0000000..3bd81d4 --- /dev/null +++ b/OpenSim/Region/PhysicsModules/BulletS/BSAPIUnman.cs | |||
@@ -0,0 +1,2120 @@ | |||
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 OpenSim.Framework; | ||
35 | |||
36 | using OpenMetaverse; | ||
37 | |||
38 | namespace OpenSim.Region.Physics.BulletSPlugin | ||
39 | { | ||
40 | public sealed class BSAPIUnman : BSAPITemplate | ||
41 | { | ||
42 | |||
43 | private sealed class BulletWorldUnman : BulletWorld | ||
44 | { | ||
45 | public IntPtr ptr; | ||
46 | public BulletWorldUnman(uint id, BSScene physScene, IntPtr xx) | ||
47 | : base(id, physScene) | ||
48 | { | ||
49 | ptr = xx; | ||
50 | } | ||
51 | } | ||
52 | |||
53 | private sealed class BulletBodyUnman : BulletBody | ||
54 | { | ||
55 | public IntPtr ptr; | ||
56 | public BulletBodyUnman(uint id, IntPtr xx) | ||
57 | : base(id) | ||
58 | { | ||
59 | ptr = xx; | ||
60 | } | ||
61 | public override bool HasPhysicalBody | ||
62 | { | ||
63 | get { return ptr != IntPtr.Zero; } | ||
64 | } | ||
65 | public override void Clear() | ||
66 | { | ||
67 | ptr = IntPtr.Zero; | ||
68 | } | ||
69 | public override string AddrString | ||
70 | { | ||
71 | get { return ptr.ToString("X"); } | ||
72 | } | ||
73 | } | ||
74 | |||
75 | private sealed class BulletShapeUnman : BulletShape | ||
76 | { | ||
77 | public IntPtr ptr; | ||
78 | public BulletShapeUnman(IntPtr xx, BSPhysicsShapeType typ) | ||
79 | : base() | ||
80 | { | ||
81 | ptr = xx; | ||
82 | shapeType = typ; | ||
83 | } | ||
84 | public override bool HasPhysicalShape | ||
85 | { | ||
86 | get { return ptr != IntPtr.Zero; } | ||
87 | } | ||
88 | public override void Clear() | ||
89 | { | ||
90 | ptr = IntPtr.Zero; | ||
91 | } | ||
92 | public override BulletShape Clone() | ||
93 | { | ||
94 | return new BulletShapeUnman(ptr, shapeType); | ||
95 | } | ||
96 | public override bool ReferenceSame(BulletShape other) | ||
97 | { | ||
98 | BulletShapeUnman otheru = other as BulletShapeUnman; | ||
99 | return (otheru != null) && (this.ptr == otheru.ptr); | ||
100 | |||
101 | } | ||
102 | public override string AddrString | ||
103 | { | ||
104 | get { return ptr.ToString("X"); } | ||
105 | } | ||
106 | } | ||
107 | private sealed class BulletConstraintUnman : BulletConstraint | ||
108 | { | ||
109 | public BulletConstraintUnman(IntPtr xx) : base() | ||
110 | { | ||
111 | ptr = xx; | ||
112 | } | ||
113 | public IntPtr ptr; | ||
114 | |||
115 | public override void Clear() | ||
116 | { | ||
117 | ptr = IntPtr.Zero; | ||
118 | } | ||
119 | public override bool HasPhysicalConstraint { get { return ptr != IntPtr.Zero; } } | ||
120 | |||
121 | // Used for log messages for a unique display of the memory/object allocated to this instance | ||
122 | public override string AddrString | ||
123 | { | ||
124 | get { return ptr.ToString("X"); } | ||
125 | } | ||
126 | } | ||
127 | |||
128 | // We pin the memory passed between the managed and unmanaged code. | ||
129 | GCHandle m_paramsHandle; | ||
130 | private GCHandle m_collisionArrayPinnedHandle; | ||
131 | private GCHandle m_updateArrayPinnedHandle; | ||
132 | |||
133 | // Handle to the callback used by the unmanaged code to call into the managed code. | ||
134 | // Used for debug logging. | ||
135 | // Need to store the handle in a persistant variable so it won't be freed. | ||
136 | private BSAPICPP.DebugLogCallback m_DebugLogCallbackHandle; | ||
137 | |||
138 | private BSScene PhysicsScene { get; set; } | ||
139 | |||
140 | public override string BulletEngineName { get { return "BulletUnmanaged"; } } | ||
141 | public override string BulletEngineVersion { get; protected set; } | ||
142 | |||
143 | public BSAPIUnman(string paramName, BSScene physScene) | ||
144 | { | ||
145 | PhysicsScene = physScene; | ||
146 | |||
147 | // Do something fancy with the paramName to get the right DLL implementation | ||
148 | // like "Bullet-2.80-OpenCL-Intel" loading the version for Intel based OpenCL implementation, etc. | ||
149 | if (Util.IsWindows()) | ||
150 | Util.LoadArchSpecificWindowsDll("BulletSim.dll"); | ||
151 | // If not Windows, loading is performed by the | ||
152 | // Mono loader as specified in | ||
153 | // "bin/Physics/OpenSim.Region.Physics.BulletSPlugin.dll.config". | ||
154 | } | ||
155 | |||
156 | // Initialization and simulation | ||
157 | public override BulletWorld Initialize(Vector3 maxPosition, ConfigurationParameters parms, | ||
158 | int maxCollisions, ref CollisionDesc[] collisionArray, | ||
159 | int maxUpdates, ref EntityProperties[] updateArray | ||
160 | ) | ||
161 | { | ||
162 | // Pin down the memory that will be used to pass object collisions and updates back from unmanaged code | ||
163 | m_paramsHandle = GCHandle.Alloc(parms, GCHandleType.Pinned); | ||
164 | m_collisionArrayPinnedHandle = GCHandle.Alloc(collisionArray, GCHandleType.Pinned); | ||
165 | m_updateArrayPinnedHandle = GCHandle.Alloc(updateArray, GCHandleType.Pinned); | ||
166 | |||
167 | // If Debug logging level, enable logging from the unmanaged code | ||
168 | m_DebugLogCallbackHandle = null; | ||
169 | if (BSScene.m_log.IsDebugEnabled && PhysicsScene.PhysicsLogging.Enabled) | ||
170 | { | ||
171 | BSScene.m_log.DebugFormat("{0}: Initialize: Setting debug callback for unmanaged code", BSScene.LogHeader); | ||
172 | if (PhysicsScene.PhysicsLogging.Enabled) | ||
173 | // The handle is saved in a variable to make sure it doesn't get freed after this call | ||
174 | m_DebugLogCallbackHandle = new BSAPICPP.DebugLogCallback(BulletLoggerPhysLog); | ||
175 | else | ||
176 | m_DebugLogCallbackHandle = new BSAPICPP.DebugLogCallback(BulletLogger); | ||
177 | } | ||
178 | |||
179 | // Get the version of the DLL | ||
180 | // TODO: this doesn't work yet. Something wrong with marshaling the returned string. | ||
181 | // BulletEngineVersion = BulletSimAPI.GetVersion2(); | ||
182 | BulletEngineVersion = ""; | ||
183 | |||
184 | // Call the unmanaged code with the buffers and other information | ||
185 | return new BulletWorldUnman(0, PhysicsScene, BSAPICPP.Initialize2(maxPosition, m_paramsHandle.AddrOfPinnedObject(), | ||
186 | maxCollisions, m_collisionArrayPinnedHandle.AddrOfPinnedObject(), | ||
187 | maxUpdates, m_updateArrayPinnedHandle.AddrOfPinnedObject(), | ||
188 | m_DebugLogCallbackHandle)); | ||
189 | |||
190 | } | ||
191 | |||
192 | // Called directly from unmanaged code so don't do much | ||
193 | private void BulletLogger(string msg) | ||
194 | { | ||
195 | BSScene.m_log.Debug("[BULLETS UNMANAGED]:" + msg); | ||
196 | } | ||
197 | |||
198 | // Called directly from unmanaged code so don't do much | ||
199 | private void BulletLoggerPhysLog(string msg) | ||
200 | { | ||
201 | PhysicsScene.DetailLog("[BULLETS UNMANAGED]:" + msg); | ||
202 | } | ||
203 | |||
204 | public override int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep, | ||
205 | out int updatedEntityCount, out int collidersCount) | ||
206 | { | ||
207 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
208 | return BSAPICPP.PhysicsStep2(worldu.ptr, timeStep, maxSubSteps, fixedTimeStep, out updatedEntityCount, out collidersCount); | ||
209 | } | ||
210 | |||
211 | public override void Shutdown(BulletWorld world) | ||
212 | { | ||
213 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
214 | BSAPICPP.Shutdown2(worldu.ptr); | ||
215 | |||
216 | if (m_paramsHandle.IsAllocated) | ||
217 | { | ||
218 | m_paramsHandle.Free(); | ||
219 | } | ||
220 | if (m_collisionArrayPinnedHandle.IsAllocated) | ||
221 | { | ||
222 | m_collisionArrayPinnedHandle.Free(); | ||
223 | } | ||
224 | if (m_updateArrayPinnedHandle.IsAllocated) | ||
225 | { | ||
226 | m_updateArrayPinnedHandle.Free(); | ||
227 | } | ||
228 | } | ||
229 | |||
230 | public override bool PushUpdate(BulletBody obj) | ||
231 | { | ||
232 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
233 | return BSAPICPP.PushUpdate2(bodyu.ptr); | ||
234 | } | ||
235 | |||
236 | public override bool UpdateParameter(BulletWorld world, uint localID, String parm, float value) | ||
237 | { | ||
238 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
239 | return BSAPICPP.UpdateParameter2(worldu.ptr, localID, parm, value); | ||
240 | } | ||
241 | |||
242 | // ===================================================================================== | ||
243 | // Mesh, hull, shape and body creation helper routines | ||
244 | public override BulletShape CreateMeshShape(BulletWorld world, | ||
245 | int indicesCount, int[] indices, | ||
246 | int verticesCount, float[] vertices) | ||
247 | { | ||
248 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
249 | return new BulletShapeUnman( | ||
250 | BSAPICPP.CreateMeshShape2(worldu.ptr, indicesCount, indices, verticesCount, vertices), | ||
251 | BSPhysicsShapeType.SHAPE_MESH); | ||
252 | } | ||
253 | |||
254 | public override BulletShape CreateGImpactShape(BulletWorld world, | ||
255 | int indicesCount, int[] indices, | ||
256 | int verticesCount, float[] vertices) | ||
257 | { | ||
258 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
259 | return new BulletShapeUnman( | ||
260 | BSAPICPP.CreateGImpactShape2(worldu.ptr, indicesCount, indices, verticesCount, vertices), | ||
261 | BSPhysicsShapeType.SHAPE_GIMPACT); | ||
262 | } | ||
263 | |||
264 | public override BulletShape CreateHullShape(BulletWorld world, int hullCount, float[] hulls) | ||
265 | { | ||
266 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
267 | return new BulletShapeUnman( | ||
268 | BSAPICPP.CreateHullShape2(worldu.ptr, hullCount, hulls), | ||
269 | BSPhysicsShapeType.SHAPE_HULL); | ||
270 | } | ||
271 | |||
272 | public override BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape, HACDParams parms) | ||
273 | { | ||
274 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
275 | BulletShapeUnman shapeu = meshShape as BulletShapeUnman; | ||
276 | return new BulletShapeUnman( | ||
277 | BSAPICPP.BuildHullShapeFromMesh2(worldu.ptr, shapeu.ptr, parms), | ||
278 | BSPhysicsShapeType.SHAPE_HULL); | ||
279 | } | ||
280 | |||
281 | public override BulletShape BuildConvexHullShapeFromMesh(BulletWorld world, BulletShape meshShape) | ||
282 | { | ||
283 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
284 | BulletShapeUnman shapeu = meshShape as BulletShapeUnman; | ||
285 | return new BulletShapeUnman( | ||
286 | BSAPICPP.BuildConvexHullShapeFromMesh2(worldu.ptr, shapeu.ptr), | ||
287 | BSPhysicsShapeType.SHAPE_CONVEXHULL); | ||
288 | } | ||
289 | |||
290 | public override BulletShape CreateConvexHullShape(BulletWorld world, | ||
291 | int indicesCount, int[] indices, | ||
292 | int verticesCount, float[] vertices) | ||
293 | { | ||
294 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
295 | return new BulletShapeUnman( | ||
296 | BSAPICPP.CreateConvexHullShape2(worldu.ptr, indicesCount, indices, verticesCount, vertices), | ||
297 | BSPhysicsShapeType.SHAPE_CONVEXHULL); | ||
298 | } | ||
299 | |||
300 | public override BulletShape BuildNativeShape(BulletWorld world, ShapeData shapeData) | ||
301 | { | ||
302 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
303 | return new BulletShapeUnman(BSAPICPP.BuildNativeShape2(worldu.ptr, shapeData), shapeData.Type); | ||
304 | } | ||
305 | |||
306 | public override bool IsNativeShape(BulletShape shape) | ||
307 | { | ||
308 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
309 | if (shapeu != null && shapeu.HasPhysicalShape) | ||
310 | return BSAPICPP.IsNativeShape2(shapeu.ptr); | ||
311 | return false; | ||
312 | } | ||
313 | |||
314 | public override void SetShapeCollisionMargin(BulletShape shape, float margin) | ||
315 | { | ||
316 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
317 | if (shapeu != null && shapeu.HasPhysicalShape) | ||
318 | BSAPICPP.SetShapeCollisionMargin(shapeu.ptr, margin); | ||
319 | } | ||
320 | |||
321 | public override BulletShape BuildCapsuleShape(BulletWorld world, float radius, float height, Vector3 scale) | ||
322 | { | ||
323 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
324 | return new BulletShapeUnman( | ||
325 | BSAPICPP.BuildCapsuleShape2(worldu.ptr, radius, height, scale), | ||
326 | BSPhysicsShapeType.SHAPE_CAPSULE); | ||
327 | } | ||
328 | |||
329 | public override BulletShape CreateCompoundShape(BulletWorld world, bool enableDynamicAabbTree) | ||
330 | { | ||
331 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
332 | return new BulletShapeUnman( | ||
333 | BSAPICPP.CreateCompoundShape2(worldu.ptr, enableDynamicAabbTree), | ||
334 | BSPhysicsShapeType.SHAPE_COMPOUND); | ||
335 | |||
336 | } | ||
337 | |||
338 | public override int GetNumberOfCompoundChildren(BulletShape shape) | ||
339 | { | ||
340 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
341 | if (shapeu != null && shapeu.HasPhysicalShape) | ||
342 | return BSAPICPP.GetNumberOfCompoundChildren2(shapeu.ptr); | ||
343 | return 0; | ||
344 | } | ||
345 | |||
346 | public override void AddChildShapeToCompoundShape(BulletShape shape, BulletShape addShape, Vector3 pos, Quaternion rot) | ||
347 | { | ||
348 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
349 | BulletShapeUnman addShapeu = addShape as BulletShapeUnman; | ||
350 | BSAPICPP.AddChildShapeToCompoundShape2(shapeu.ptr, addShapeu.ptr, pos, rot); | ||
351 | } | ||
352 | |||
353 | public override BulletShape GetChildShapeFromCompoundShapeIndex(BulletShape shape, int indx) | ||
354 | { | ||
355 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
356 | return new BulletShapeUnman(BSAPICPP.GetChildShapeFromCompoundShapeIndex2(shapeu.ptr, indx), BSPhysicsShapeType.SHAPE_UNKNOWN); | ||
357 | } | ||
358 | |||
359 | public override BulletShape RemoveChildShapeFromCompoundShapeIndex(BulletShape shape, int indx) | ||
360 | { | ||
361 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
362 | return new BulletShapeUnman(BSAPICPP.RemoveChildShapeFromCompoundShapeIndex2(shapeu.ptr, indx), BSPhysicsShapeType.SHAPE_UNKNOWN); | ||
363 | } | ||
364 | |||
365 | public override void RemoveChildShapeFromCompoundShape(BulletShape shape, BulletShape removeShape) | ||
366 | { | ||
367 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
368 | BulletShapeUnman removeShapeu = removeShape as BulletShapeUnman; | ||
369 | BSAPICPP.RemoveChildShapeFromCompoundShape2(shapeu.ptr, removeShapeu.ptr); | ||
370 | } | ||
371 | |||
372 | public override void UpdateChildTransform(BulletShape pShape, int childIndex, Vector3 pos, Quaternion rot, bool shouldRecalculateLocalAabb) | ||
373 | { | ||
374 | BulletShapeUnman shapeu = pShape as BulletShapeUnman; | ||
375 | BSAPICPP.UpdateChildTransform2(shapeu.ptr, childIndex, pos, rot, shouldRecalculateLocalAabb); | ||
376 | } | ||
377 | |||
378 | public override void RecalculateCompoundShapeLocalAabb(BulletShape shape) | ||
379 | { | ||
380 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
381 | BSAPICPP.RecalculateCompoundShapeLocalAabb2(shapeu.ptr); | ||
382 | } | ||
383 | |||
384 | public override BulletShape DuplicateCollisionShape(BulletWorld world, BulletShape srcShape, uint id) | ||
385 | { | ||
386 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
387 | BulletShapeUnman srcShapeu = srcShape as BulletShapeUnman; | ||
388 | return new BulletShapeUnman(BSAPICPP.DuplicateCollisionShape2(worldu.ptr, srcShapeu.ptr, id), srcShape.shapeType); | ||
389 | } | ||
390 | |||
391 | public override bool DeleteCollisionShape(BulletWorld world, BulletShape shape) | ||
392 | { | ||
393 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
394 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
395 | return BSAPICPP.DeleteCollisionShape2(worldu.ptr, shapeu.ptr); | ||
396 | } | ||
397 | |||
398 | public override CollisionObjectTypes GetBodyType(BulletBody obj) | ||
399 | { | ||
400 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
401 | return (CollisionObjectTypes)BSAPICPP.GetBodyType2(bodyu.ptr); | ||
402 | } | ||
403 | |||
404 | public override BulletBody CreateBodyFromShape(BulletWorld world, BulletShape shape, uint id, Vector3 pos, Quaternion rot) | ||
405 | { | ||
406 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
407 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
408 | return new BulletBodyUnman(id, BSAPICPP.CreateBodyFromShape2(worldu.ptr, shapeu.ptr, id, pos, rot)); | ||
409 | } | ||
410 | |||
411 | public override BulletBody CreateBodyWithDefaultMotionState(BulletShape shape, uint id, Vector3 pos, Quaternion rot) | ||
412 | { | ||
413 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
414 | return new BulletBodyUnman(id, BSAPICPP.CreateBodyWithDefaultMotionState2(shapeu.ptr, id, pos, rot)); | ||
415 | } | ||
416 | |||
417 | public override BulletBody CreateGhostFromShape(BulletWorld world, BulletShape shape, uint id, Vector3 pos, Quaternion rot) | ||
418 | { | ||
419 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
420 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
421 | return new BulletBodyUnman(id, BSAPICPP.CreateGhostFromShape2(worldu.ptr, shapeu.ptr, id, pos, rot)); | ||
422 | } | ||
423 | |||
424 | public override void DestroyObject(BulletWorld world, BulletBody obj) | ||
425 | { | ||
426 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
427 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
428 | BSAPICPP.DestroyObject2(worldu.ptr, bodyu.ptr); | ||
429 | } | ||
430 | |||
431 | // ===================================================================================== | ||
432 | // Terrain creation and helper routines | ||
433 | public override BulletShape CreateGroundPlaneShape(uint id, float height, float collisionMargin) | ||
434 | { | ||
435 | return new BulletShapeUnman(BSAPICPP.CreateGroundPlaneShape2(id, height, collisionMargin), BSPhysicsShapeType.SHAPE_GROUNDPLANE); | ||
436 | } | ||
437 | |||
438 | public override BulletShape CreateTerrainShape(uint id, Vector3 size, float minHeight, float maxHeight, float[] heightMap, | ||
439 | float scaleFactor, float collisionMargin) | ||
440 | { | ||
441 | return new BulletShapeUnman(BSAPICPP.CreateTerrainShape2(id, size, minHeight, maxHeight, heightMap, scaleFactor, collisionMargin), | ||
442 | BSPhysicsShapeType.SHAPE_TERRAIN); | ||
443 | } | ||
444 | |||
445 | // ===================================================================================== | ||
446 | // Constraint creation and helper routines | ||
447 | public override BulletConstraint Create6DofConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
448 | Vector3 frame1loc, Quaternion frame1rot, | ||
449 | Vector3 frame2loc, Quaternion frame2rot, | ||
450 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) | ||
451 | { | ||
452 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
453 | BulletBodyUnman bodyu1 = obj1 as BulletBodyUnman; | ||
454 | BulletBodyUnman bodyu2 = obj2 as BulletBodyUnman; | ||
455 | return new BulletConstraintUnman(BSAPICPP.Create6DofConstraint2(worldu.ptr, bodyu1.ptr, bodyu2.ptr, frame1loc, frame1rot, | ||
456 | frame2loc, frame2rot, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies)); | ||
457 | } | ||
458 | |||
459 | public override BulletConstraint Create6DofConstraintToPoint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
460 | Vector3 joinPoint, | ||
461 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) | ||
462 | { | ||
463 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
464 | BulletBodyUnman bodyu1 = obj1 as BulletBodyUnman; | ||
465 | BulletBodyUnman bodyu2 = obj2 as BulletBodyUnman; | ||
466 | return new BulletConstraintUnman(BSAPICPP.Create6DofConstraintToPoint2(worldu.ptr, bodyu1.ptr, bodyu2.ptr, | ||
467 | joinPoint, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies)); | ||
468 | } | ||
469 | |||
470 | public override BulletConstraint Create6DofConstraintFixed(BulletWorld world, BulletBody obj1, | ||
471 | Vector3 frameInBloc, Quaternion frameInBrot, | ||
472 | bool useLinearReferenceFrameB, bool disableCollisionsBetweenLinkedBodies) | ||
473 | { | ||
474 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
475 | BulletBodyUnman bodyu1 = obj1 as BulletBodyUnman; | ||
476 | return new BulletConstraintUnman(BSAPICPP.Create6DofConstraintFixed2(worldu.ptr, bodyu1.ptr, | ||
477 | frameInBloc, frameInBrot, useLinearReferenceFrameB, disableCollisionsBetweenLinkedBodies)); | ||
478 | } | ||
479 | |||
480 | public override BulletConstraint Create6DofSpringConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
481 | Vector3 frame1loc, Quaternion frame1rot, | ||
482 | Vector3 frame2loc, Quaternion frame2rot, | ||
483 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) | ||
484 | { | ||
485 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
486 | BulletBodyUnman bodyu1 = obj1 as BulletBodyUnman; | ||
487 | BulletBodyUnman bodyu2 = obj2 as BulletBodyUnman; | ||
488 | return new BulletConstraintUnman(BSAPICPP.Create6DofSpringConstraint2(worldu.ptr, bodyu1.ptr, bodyu2.ptr, frame1loc, frame1rot, | ||
489 | frame2loc, frame2rot, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies)); | ||
490 | } | ||
491 | |||
492 | public override BulletConstraint CreateHingeConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
493 | Vector3 pivotinA, Vector3 pivotinB, | ||
494 | Vector3 axisInA, Vector3 axisInB, | ||
495 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) | ||
496 | { | ||
497 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
498 | BulletBodyUnman bodyu1 = obj1 as BulletBodyUnman; | ||
499 | BulletBodyUnman bodyu2 = obj2 as BulletBodyUnman; | ||
500 | return new BulletConstraintUnman(BSAPICPP.CreateHingeConstraint2(worldu.ptr, bodyu1.ptr, bodyu2.ptr, | ||
501 | pivotinA, pivotinB, axisInA, axisInB, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies)); | ||
502 | } | ||
503 | |||
504 | public override BulletConstraint CreateSliderConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
505 | Vector3 frame1loc, Quaternion frame1rot, | ||
506 | Vector3 frame2loc, Quaternion frame2rot, | ||
507 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) | ||
508 | { | ||
509 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
510 | BulletBodyUnman bodyu1 = obj1 as BulletBodyUnman; | ||
511 | BulletBodyUnman bodyu2 = obj2 as BulletBodyUnman; | ||
512 | return new BulletConstraintUnman(BSAPICPP.CreateSliderConstraint2(worldu.ptr, bodyu1.ptr, bodyu2.ptr, frame1loc, frame1rot, | ||
513 | frame2loc, frame2rot, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies)); | ||
514 | } | ||
515 | |||
516 | public override BulletConstraint CreateConeTwistConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
517 | Vector3 frame1loc, Quaternion frame1rot, | ||
518 | Vector3 frame2loc, Quaternion frame2rot, | ||
519 | bool disableCollisionsBetweenLinkedBodies) | ||
520 | { | ||
521 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
522 | BulletBodyUnman bodyu1 = obj1 as BulletBodyUnman; | ||
523 | BulletBodyUnman bodyu2 = obj2 as BulletBodyUnman; | ||
524 | return new BulletConstraintUnman(BSAPICPP.CreateConeTwistConstraint2(worldu.ptr, bodyu1.ptr, bodyu2.ptr, frame1loc, frame1rot, | ||
525 | frame2loc, frame2rot, disableCollisionsBetweenLinkedBodies)); | ||
526 | } | ||
527 | |||
528 | public override BulletConstraint CreateGearConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
529 | Vector3 axisInA, Vector3 axisInB, | ||
530 | float ratio, bool disableCollisionsBetweenLinkedBodies) | ||
531 | { | ||
532 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
533 | BulletBodyUnman bodyu1 = obj1 as BulletBodyUnman; | ||
534 | BulletBodyUnman bodyu2 = obj2 as BulletBodyUnman; | ||
535 | return new BulletConstraintUnman(BSAPICPP.CreateGearConstraint2(worldu.ptr, bodyu1.ptr, bodyu2.ptr, axisInA, axisInB, | ||
536 | ratio, disableCollisionsBetweenLinkedBodies)); | ||
537 | } | ||
538 | |||
539 | public override BulletConstraint CreatePoint2PointConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
540 | Vector3 pivotInA, Vector3 pivotInB, | ||
541 | bool disableCollisionsBetweenLinkedBodies) | ||
542 | { | ||
543 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
544 | BulletBodyUnman bodyu1 = obj1 as BulletBodyUnman; | ||
545 | BulletBodyUnman bodyu2 = obj2 as BulletBodyUnman; | ||
546 | return new BulletConstraintUnman(BSAPICPP.CreatePoint2PointConstraint2(worldu.ptr, bodyu1.ptr, bodyu2.ptr, pivotInA, pivotInB, | ||
547 | disableCollisionsBetweenLinkedBodies)); | ||
548 | } | ||
549 | |||
550 | public override void SetConstraintEnable(BulletConstraint constrain, float numericTrueFalse) | ||
551 | { | ||
552 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
553 | BSAPICPP.SetConstraintEnable2(constrainu.ptr, numericTrueFalse); | ||
554 | } | ||
555 | |||
556 | public override void SetConstraintNumSolverIterations(BulletConstraint constrain, float iterations) | ||
557 | { | ||
558 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
559 | BSAPICPP.SetConstraintNumSolverIterations2(constrainu.ptr, iterations); | ||
560 | } | ||
561 | |||
562 | public override bool SetFrames(BulletConstraint constrain, | ||
563 | Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot) | ||
564 | { | ||
565 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
566 | return BSAPICPP.SetFrames2(constrainu.ptr, frameA, frameArot, frameB, frameBrot); | ||
567 | } | ||
568 | |||
569 | public override bool SetLinearLimits(BulletConstraint constrain, Vector3 low, Vector3 hi) | ||
570 | { | ||
571 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
572 | return BSAPICPP.SetLinearLimits2(constrainu.ptr, low, hi); | ||
573 | } | ||
574 | |||
575 | public override bool SetAngularLimits(BulletConstraint constrain, Vector3 low, Vector3 hi) | ||
576 | { | ||
577 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
578 | return BSAPICPP.SetAngularLimits2(constrainu.ptr, low, hi); | ||
579 | } | ||
580 | |||
581 | public override bool UseFrameOffset(BulletConstraint constrain, float enable) | ||
582 | { | ||
583 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
584 | return BSAPICPP.UseFrameOffset2(constrainu.ptr, enable); | ||
585 | } | ||
586 | |||
587 | public override bool TranslationalLimitMotor(BulletConstraint constrain, float enable, float targetVel, float maxMotorForce) | ||
588 | { | ||
589 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
590 | return BSAPICPP.TranslationalLimitMotor2(constrainu.ptr, enable, targetVel, maxMotorForce); | ||
591 | } | ||
592 | |||
593 | public override bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold) | ||
594 | { | ||
595 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
596 | return BSAPICPP.SetBreakingImpulseThreshold2(constrainu.ptr, threshold); | ||
597 | } | ||
598 | |||
599 | public override bool HingeSetLimits(BulletConstraint constrain, float low, float high, float softness, float bias, float relaxation) | ||
600 | { | ||
601 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
602 | return BSAPICPP.HingeSetLimits2(constrainu.ptr, low, high, softness, bias, relaxation); | ||
603 | } | ||
604 | |||
605 | public override bool SpringEnable(BulletConstraint constrain, int index, float numericTrueFalse) | ||
606 | { | ||
607 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
608 | return BSAPICPP.ConstraintSpringEnable2(constrainu.ptr, index, numericTrueFalse); | ||
609 | } | ||
610 | |||
611 | public override bool SpringSetEquilibriumPoint(BulletConstraint constrain, int index, float equilibriumPoint) | ||
612 | { | ||
613 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
614 | return BSAPICPP.ConstraintSpringSetEquilibriumPoint2(constrainu.ptr, index, equilibriumPoint); | ||
615 | } | ||
616 | |||
617 | public override bool SpringSetStiffness(BulletConstraint constrain, int index, float stiffnesss) | ||
618 | { | ||
619 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
620 | return BSAPICPP.ConstraintSpringSetStiffness2(constrainu.ptr, index, stiffnesss); | ||
621 | } | ||
622 | |||
623 | public override bool SpringSetDamping(BulletConstraint constrain, int index, float damping) | ||
624 | { | ||
625 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
626 | return BSAPICPP.ConstraintSpringSetDamping2(constrainu.ptr, index, damping); | ||
627 | } | ||
628 | |||
629 | public override bool SliderSetLimits(BulletConstraint constrain, int lowerUpper, int linAng, float val) | ||
630 | { | ||
631 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
632 | return BSAPICPP.SliderSetLimits2(constrainu.ptr, lowerUpper, linAng, val); | ||
633 | } | ||
634 | |||
635 | public override bool SliderSet(BulletConstraint constrain, int softRestDamp, int dirLimOrtho, int linAng, float val) | ||
636 | { | ||
637 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
638 | return BSAPICPP.SliderSet2(constrainu.ptr, softRestDamp, dirLimOrtho, linAng, val); | ||
639 | } | ||
640 | |||
641 | public override bool SliderMotorEnable(BulletConstraint constrain, int linAng, float numericTrueFalse) | ||
642 | { | ||
643 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
644 | return BSAPICPP.SliderMotorEnable2(constrainu.ptr, linAng, numericTrueFalse); | ||
645 | } | ||
646 | |||
647 | public override bool SliderMotor(BulletConstraint constrain, int forceVel, int linAng, float val) | ||
648 | { | ||
649 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
650 | return BSAPICPP.SliderMotor2(constrainu.ptr, forceVel, linAng, val); | ||
651 | } | ||
652 | |||
653 | public override bool CalculateTransforms(BulletConstraint constrain) | ||
654 | { | ||
655 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
656 | return BSAPICPP.CalculateTransforms2(constrainu.ptr); | ||
657 | } | ||
658 | |||
659 | public override bool SetConstraintParam(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis) | ||
660 | { | ||
661 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
662 | return BSAPICPP.SetConstraintParam2(constrainu.ptr, paramIndex, value, axis); | ||
663 | } | ||
664 | |||
665 | public override bool DestroyConstraint(BulletWorld world, BulletConstraint constrain) | ||
666 | { | ||
667 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
668 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
669 | return BSAPICPP.DestroyConstraint2(worldu.ptr, constrainu.ptr); | ||
670 | } | ||
671 | |||
672 | // ===================================================================================== | ||
673 | // btCollisionWorld entries | ||
674 | public override void UpdateSingleAabb(BulletWorld world, BulletBody obj) | ||
675 | { | ||
676 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
677 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
678 | BSAPICPP.UpdateSingleAabb2(worldu.ptr, bodyu.ptr); | ||
679 | } | ||
680 | |||
681 | public override void UpdateAabbs(BulletWorld world) | ||
682 | { | ||
683 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
684 | BSAPICPP.UpdateAabbs2(worldu.ptr); | ||
685 | } | ||
686 | |||
687 | public override bool GetForceUpdateAllAabbs(BulletWorld world) | ||
688 | { | ||
689 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
690 | return BSAPICPP.GetForceUpdateAllAabbs2(worldu.ptr); | ||
691 | } | ||
692 | |||
693 | public override void SetForceUpdateAllAabbs(BulletWorld world, bool force) | ||
694 | { | ||
695 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
696 | BSAPICPP.SetForceUpdateAllAabbs2(worldu.ptr, force); | ||
697 | } | ||
698 | |||
699 | // ===================================================================================== | ||
700 | // btDynamicsWorld entries | ||
701 | public override bool AddObjectToWorld(BulletWorld world, BulletBody obj) | ||
702 | { | ||
703 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
704 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
705 | |||
706 | // Bullet resets several variables when an object is added to the world. | ||
707 | // Gravity is reset to world default depending on the static/dynamic | ||
708 | // type. Of course, the collision flags in the broadphase proxy are initialized to default. | ||
709 | Vector3 origGrav = BSAPICPP.GetGravity2(bodyu.ptr); | ||
710 | |||
711 | bool ret = BSAPICPP.AddObjectToWorld2(worldu.ptr, bodyu.ptr); | ||
712 | |||
713 | if (ret) | ||
714 | { | ||
715 | BSAPICPP.SetGravity2(bodyu.ptr, origGrav); | ||
716 | obj.ApplyCollisionMask(world.physicsScene); | ||
717 | } | ||
718 | return ret; | ||
719 | } | ||
720 | |||
721 | public override bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj) | ||
722 | { | ||
723 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
724 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
725 | return BSAPICPP.RemoveObjectFromWorld2(worldu.ptr, bodyu.ptr); | ||
726 | } | ||
727 | |||
728 | public override bool ClearCollisionProxyCache(BulletWorld world, BulletBody obj) | ||
729 | { | ||
730 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
731 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
732 | return BSAPICPP.ClearCollisionProxyCache2(worldu.ptr, bodyu.ptr); | ||
733 | } | ||
734 | |||
735 | public override bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects) | ||
736 | { | ||
737 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
738 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
739 | return BSAPICPP.AddConstraintToWorld2(worldu.ptr, constrainu.ptr, disableCollisionsBetweenLinkedObjects); | ||
740 | } | ||
741 | |||
742 | public override bool RemoveConstraintFromWorld(BulletWorld world, BulletConstraint constrain) | ||
743 | { | ||
744 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
745 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
746 | return BSAPICPP.RemoveConstraintFromWorld2(worldu.ptr, constrainu.ptr); | ||
747 | } | ||
748 | // ===================================================================================== | ||
749 | // btCollisionObject entries | ||
750 | public override Vector3 GetAnisotripicFriction(BulletConstraint constrain) | ||
751 | { | ||
752 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
753 | return BSAPICPP.GetAnisotripicFriction2(constrainu.ptr); | ||
754 | } | ||
755 | |||
756 | public override Vector3 SetAnisotripicFriction(BulletConstraint constrain, Vector3 frict) | ||
757 | { | ||
758 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
759 | return BSAPICPP.SetAnisotripicFriction2(constrainu.ptr, frict); | ||
760 | } | ||
761 | |||
762 | public override bool HasAnisotripicFriction(BulletConstraint constrain) | ||
763 | { | ||
764 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
765 | return BSAPICPP.HasAnisotripicFriction2(constrainu.ptr); | ||
766 | } | ||
767 | |||
768 | public override void SetContactProcessingThreshold(BulletBody obj, float val) | ||
769 | { | ||
770 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
771 | BSAPICPP.SetContactProcessingThreshold2(bodyu.ptr, val); | ||
772 | } | ||
773 | |||
774 | public override float GetContactProcessingThreshold(BulletBody obj) | ||
775 | { | ||
776 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
777 | return BSAPICPP.GetContactProcessingThreshold2(bodyu.ptr); | ||
778 | } | ||
779 | |||
780 | public override bool IsStaticObject(BulletBody obj) | ||
781 | { | ||
782 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
783 | return BSAPICPP.IsStaticObject2(bodyu.ptr); | ||
784 | } | ||
785 | |||
786 | public override bool IsKinematicObject(BulletBody obj) | ||
787 | { | ||
788 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
789 | return BSAPICPP.IsKinematicObject2(bodyu.ptr); | ||
790 | } | ||
791 | |||
792 | public override bool IsStaticOrKinematicObject(BulletBody obj) | ||
793 | { | ||
794 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
795 | return BSAPICPP.IsStaticOrKinematicObject2(bodyu.ptr); | ||
796 | } | ||
797 | |||
798 | public override bool HasContactResponse(BulletBody obj) | ||
799 | { | ||
800 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
801 | return BSAPICPP.HasContactResponse2(bodyu.ptr); | ||
802 | } | ||
803 | |||
804 | public override void SetCollisionShape(BulletWorld world, BulletBody obj, BulletShape shape) | ||
805 | { | ||
806 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
807 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
808 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
809 | if (worldu != null && bodyu != null) | ||
810 | { | ||
811 | // Special case to allow the caller to zero out the reference to any physical shape | ||
812 | if (shapeu != null) | ||
813 | BSAPICPP.SetCollisionShape2(worldu.ptr, bodyu.ptr, shapeu.ptr); | ||
814 | else | ||
815 | BSAPICPP.SetCollisionShape2(worldu.ptr, bodyu.ptr, IntPtr.Zero); | ||
816 | } | ||
817 | } | ||
818 | |||
819 | public override BulletShape GetCollisionShape(BulletBody obj) | ||
820 | { | ||
821 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
822 | return new BulletShapeUnman(BSAPICPP.GetCollisionShape2(bodyu.ptr), BSPhysicsShapeType.SHAPE_UNKNOWN); | ||
823 | } | ||
824 | |||
825 | public override int GetActivationState(BulletBody obj) | ||
826 | { | ||
827 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
828 | return BSAPICPP.GetActivationState2(bodyu.ptr); | ||
829 | } | ||
830 | |||
831 | public override void SetActivationState(BulletBody obj, int state) | ||
832 | { | ||
833 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
834 | BSAPICPP.SetActivationState2(bodyu.ptr, state); | ||
835 | } | ||
836 | |||
837 | public override void SetDeactivationTime(BulletBody obj, float dtime) | ||
838 | { | ||
839 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
840 | BSAPICPP.SetDeactivationTime2(bodyu.ptr, dtime); | ||
841 | } | ||
842 | |||
843 | public override float GetDeactivationTime(BulletBody obj) | ||
844 | { | ||
845 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
846 | return BSAPICPP.GetDeactivationTime2(bodyu.ptr); | ||
847 | } | ||
848 | |||
849 | public override void ForceActivationState(BulletBody obj, ActivationState state) | ||
850 | { | ||
851 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
852 | BSAPICPP.ForceActivationState2(bodyu.ptr, state); | ||
853 | } | ||
854 | |||
855 | public override void Activate(BulletBody obj, bool forceActivation) | ||
856 | { | ||
857 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
858 | BSAPICPP.Activate2(bodyu.ptr, forceActivation); | ||
859 | } | ||
860 | |||
861 | public override bool IsActive(BulletBody obj) | ||
862 | { | ||
863 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
864 | return BSAPICPP.IsActive2(bodyu.ptr); | ||
865 | } | ||
866 | |||
867 | public override void SetRestitution(BulletBody obj, float val) | ||
868 | { | ||
869 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
870 | BSAPICPP.SetRestitution2(bodyu.ptr, val); | ||
871 | } | ||
872 | |||
873 | public override float GetRestitution(BulletBody obj) | ||
874 | { | ||
875 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
876 | return BSAPICPP.GetRestitution2(bodyu.ptr); | ||
877 | } | ||
878 | |||
879 | public override void SetFriction(BulletBody obj, float val) | ||
880 | { | ||
881 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
882 | BSAPICPP.SetFriction2(bodyu.ptr, val); | ||
883 | } | ||
884 | |||
885 | public override float GetFriction(BulletBody obj) | ||
886 | { | ||
887 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
888 | return BSAPICPP.GetFriction2(bodyu.ptr); | ||
889 | } | ||
890 | |||
891 | public override Vector3 GetPosition(BulletBody obj) | ||
892 | { | ||
893 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
894 | return BSAPICPP.GetPosition2(bodyu.ptr); | ||
895 | } | ||
896 | |||
897 | public override Quaternion GetOrientation(BulletBody obj) | ||
898 | { | ||
899 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
900 | return BSAPICPP.GetOrientation2(bodyu.ptr); | ||
901 | } | ||
902 | |||
903 | public override void SetTranslation(BulletBody obj, Vector3 position, Quaternion rotation) | ||
904 | { | ||
905 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
906 | BSAPICPP.SetTranslation2(bodyu.ptr, position, rotation); | ||
907 | } | ||
908 | |||
909 | /* | ||
910 | public override IntPtr GetBroadphaseHandle(BulletBody obj) | ||
911 | { | ||
912 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
913 | return BSAPICPP.GetBroadphaseHandle2(bodyu.ptr); | ||
914 | } | ||
915 | |||
916 | public override void SetBroadphaseHandle(BulletBody obj, IntPtr handle) | ||
917 | { | ||
918 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
919 | BSAPICPP.SetUserPointer2(bodyu.ptr, handle); | ||
920 | } | ||
921 | */ | ||
922 | |||
923 | public override void SetInterpolationLinearVelocity(BulletBody obj, Vector3 vel) | ||
924 | { | ||
925 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
926 | BSAPICPP.SetInterpolationLinearVelocity2(bodyu.ptr, vel); | ||
927 | } | ||
928 | |||
929 | public override void SetInterpolationAngularVelocity(BulletBody obj, Vector3 vel) | ||
930 | { | ||
931 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
932 | BSAPICPP.SetInterpolationAngularVelocity2(bodyu.ptr, vel); | ||
933 | } | ||
934 | |||
935 | public override void SetInterpolationVelocity(BulletBody obj, Vector3 linearVel, Vector3 angularVel) | ||
936 | { | ||
937 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
938 | BSAPICPP.SetInterpolationVelocity2(bodyu.ptr, linearVel, angularVel); | ||
939 | } | ||
940 | |||
941 | public override float GetHitFraction(BulletBody obj) | ||
942 | { | ||
943 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
944 | return BSAPICPP.GetHitFraction2(bodyu.ptr); | ||
945 | } | ||
946 | |||
947 | public override void SetHitFraction(BulletBody obj, float val) | ||
948 | { | ||
949 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
950 | BSAPICPP.SetHitFraction2(bodyu.ptr, val); | ||
951 | } | ||
952 | |||
953 | public override CollisionFlags GetCollisionFlags(BulletBody obj) | ||
954 | { | ||
955 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
956 | return BSAPICPP.GetCollisionFlags2(bodyu.ptr); | ||
957 | } | ||
958 | |||
959 | public override CollisionFlags SetCollisionFlags(BulletBody obj, CollisionFlags flags) | ||
960 | { | ||
961 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
962 | return BSAPICPP.SetCollisionFlags2(bodyu.ptr, flags); | ||
963 | } | ||
964 | |||
965 | public override CollisionFlags AddToCollisionFlags(BulletBody obj, CollisionFlags flags) | ||
966 | { | ||
967 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
968 | return BSAPICPP.AddToCollisionFlags2(bodyu.ptr, flags); | ||
969 | } | ||
970 | |||
971 | public override CollisionFlags RemoveFromCollisionFlags(BulletBody obj, CollisionFlags flags) | ||
972 | { | ||
973 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
974 | return BSAPICPP.RemoveFromCollisionFlags2(bodyu.ptr, flags); | ||
975 | } | ||
976 | |||
977 | public override float GetCcdMotionThreshold(BulletBody obj) | ||
978 | { | ||
979 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
980 | return BSAPICPP.GetCcdMotionThreshold2(bodyu.ptr); | ||
981 | } | ||
982 | |||
983 | |||
984 | public override void SetCcdMotionThreshold(BulletBody obj, float val) | ||
985 | { | ||
986 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
987 | BSAPICPP.SetCcdMotionThreshold2(bodyu.ptr, val); | ||
988 | } | ||
989 | |||
990 | public override float GetCcdSweptSphereRadius(BulletBody obj) | ||
991 | { | ||
992 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
993 | return BSAPICPP.GetCcdSweptSphereRadius2(bodyu.ptr); | ||
994 | } | ||
995 | |||
996 | public override void SetCcdSweptSphereRadius(BulletBody obj, float val) | ||
997 | { | ||
998 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
999 | BSAPICPP.SetCcdSweptSphereRadius2(bodyu.ptr, val); | ||
1000 | } | ||
1001 | |||
1002 | public override IntPtr GetUserPointer(BulletBody obj) | ||
1003 | { | ||
1004 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1005 | return BSAPICPP.GetUserPointer2(bodyu.ptr); | ||
1006 | } | ||
1007 | |||
1008 | public override void SetUserPointer(BulletBody obj, IntPtr val) | ||
1009 | { | ||
1010 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1011 | BSAPICPP.SetUserPointer2(bodyu.ptr, val); | ||
1012 | } | ||
1013 | |||
1014 | // ===================================================================================== | ||
1015 | // btRigidBody entries | ||
1016 | public override void ApplyGravity(BulletBody obj) | ||
1017 | { | ||
1018 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1019 | BSAPICPP.ApplyGravity2(bodyu.ptr); | ||
1020 | } | ||
1021 | |||
1022 | public override void SetGravity(BulletBody obj, Vector3 val) | ||
1023 | { | ||
1024 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1025 | BSAPICPP.SetGravity2(bodyu.ptr, val); | ||
1026 | } | ||
1027 | |||
1028 | public override Vector3 GetGravity(BulletBody obj) | ||
1029 | { | ||
1030 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1031 | return BSAPICPP.GetGravity2(bodyu.ptr); | ||
1032 | } | ||
1033 | |||
1034 | public override void SetDamping(BulletBody obj, float lin_damping, float ang_damping) | ||
1035 | { | ||
1036 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1037 | BSAPICPP.SetDamping2(bodyu.ptr, lin_damping, ang_damping); | ||
1038 | } | ||
1039 | |||
1040 | public override void SetLinearDamping(BulletBody obj, float lin_damping) | ||
1041 | { | ||
1042 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1043 | BSAPICPP.SetLinearDamping2(bodyu.ptr, lin_damping); | ||
1044 | } | ||
1045 | |||
1046 | public override void SetAngularDamping(BulletBody obj, float ang_damping) | ||
1047 | { | ||
1048 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1049 | BSAPICPP.SetAngularDamping2(bodyu.ptr, ang_damping); | ||
1050 | } | ||
1051 | |||
1052 | public override float GetLinearDamping(BulletBody obj) | ||
1053 | { | ||
1054 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1055 | return BSAPICPP.GetLinearDamping2(bodyu.ptr); | ||
1056 | } | ||
1057 | |||
1058 | public override float GetAngularDamping(BulletBody obj) | ||
1059 | { | ||
1060 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1061 | return BSAPICPP.GetAngularDamping2(bodyu.ptr); | ||
1062 | } | ||
1063 | |||
1064 | public override float GetLinearSleepingThreshold(BulletBody obj) | ||
1065 | { | ||
1066 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1067 | return BSAPICPP.GetLinearSleepingThreshold2(bodyu.ptr); | ||
1068 | } | ||
1069 | |||
1070 | public override void ApplyDamping(BulletBody obj, float timeStep) | ||
1071 | { | ||
1072 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1073 | BSAPICPP.ApplyDamping2(bodyu.ptr, timeStep); | ||
1074 | } | ||
1075 | |||
1076 | public override void SetMassProps(BulletBody obj, float mass, Vector3 inertia) | ||
1077 | { | ||
1078 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1079 | BSAPICPP.SetMassProps2(bodyu.ptr, mass, inertia); | ||
1080 | } | ||
1081 | |||
1082 | public override Vector3 GetLinearFactor(BulletBody obj) | ||
1083 | { | ||
1084 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1085 | return BSAPICPP.GetLinearFactor2(bodyu.ptr); | ||
1086 | } | ||
1087 | |||
1088 | public override void SetLinearFactor(BulletBody obj, Vector3 factor) | ||
1089 | { | ||
1090 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1091 | BSAPICPP.SetLinearFactor2(bodyu.ptr, factor); | ||
1092 | } | ||
1093 | |||
1094 | public override void SetCenterOfMassByPosRot(BulletBody obj, Vector3 pos, Quaternion rot) | ||
1095 | { | ||
1096 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1097 | BSAPICPP.SetCenterOfMassByPosRot2(bodyu.ptr, pos, rot); | ||
1098 | } | ||
1099 | |||
1100 | // Add a force to the object as if its mass is one. | ||
1101 | // Deep down in Bullet: m_totalForce += force*m_linearFactor; | ||
1102 | public override void ApplyCentralForce(BulletBody obj, Vector3 force) | ||
1103 | { | ||
1104 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1105 | BSAPICPP.ApplyCentralForce2(bodyu.ptr, force); | ||
1106 | } | ||
1107 | |||
1108 | // Set the force being applied to the object as if its mass is one. | ||
1109 | public override void SetObjectForce(BulletBody obj, Vector3 force) | ||
1110 | { | ||
1111 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1112 | BSAPICPP.SetObjectForce2(bodyu.ptr, force); | ||
1113 | } | ||
1114 | |||
1115 | public override Vector3 GetTotalForce(BulletBody obj) | ||
1116 | { | ||
1117 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1118 | return BSAPICPP.GetTotalForce2(bodyu.ptr); | ||
1119 | } | ||
1120 | |||
1121 | public override Vector3 GetTotalTorque(BulletBody obj) | ||
1122 | { | ||
1123 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1124 | return BSAPICPP.GetTotalTorque2(bodyu.ptr); | ||
1125 | } | ||
1126 | |||
1127 | public override Vector3 GetInvInertiaDiagLocal(BulletBody obj) | ||
1128 | { | ||
1129 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1130 | return BSAPICPP.GetInvInertiaDiagLocal2(bodyu.ptr); | ||
1131 | } | ||
1132 | |||
1133 | public override void SetInvInertiaDiagLocal(BulletBody obj, Vector3 inert) | ||
1134 | { | ||
1135 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1136 | BSAPICPP.SetInvInertiaDiagLocal2(bodyu.ptr, inert); | ||
1137 | } | ||
1138 | |||
1139 | public override void SetSleepingThresholds(BulletBody obj, float lin_threshold, float ang_threshold) | ||
1140 | { | ||
1141 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1142 | BSAPICPP.SetSleepingThresholds2(bodyu.ptr, lin_threshold, ang_threshold); | ||
1143 | } | ||
1144 | |||
1145 | // Deep down in Bullet: m_totalTorque += torque*m_angularFactor; | ||
1146 | public override void ApplyTorque(BulletBody obj, Vector3 torque) | ||
1147 | { | ||
1148 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1149 | BSAPICPP.ApplyTorque2(bodyu.ptr, torque); | ||
1150 | } | ||
1151 | |||
1152 | // Apply force at the given point. Will add torque to the object. | ||
1153 | // Deep down in Bullet: applyCentralForce(force); | ||
1154 | // applyTorque(rel_pos.cross(force*m_linearFactor)); | ||
1155 | public override void ApplyForce(BulletBody obj, Vector3 force, Vector3 pos) | ||
1156 | { | ||
1157 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1158 | BSAPICPP.ApplyForce2(bodyu.ptr, force, pos); | ||
1159 | } | ||
1160 | |||
1161 | // Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass. | ||
1162 | // Deep down in Bullet: m_linearVelocity += impulse *m_linearFactor * m_inverseMass; | ||
1163 | public override void ApplyCentralImpulse(BulletBody obj, Vector3 imp) | ||
1164 | { | ||
1165 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1166 | BSAPICPP.ApplyCentralImpulse2(bodyu.ptr, imp); | ||
1167 | } | ||
1168 | |||
1169 | // Apply impulse to the object's torque. Force is scaled by object's mass. | ||
1170 | // Deep down in Bullet: m_angularVelocity += m_invInertiaTensorWorld * torque * m_angularFactor; | ||
1171 | public override void ApplyTorqueImpulse(BulletBody obj, Vector3 imp) | ||
1172 | { | ||
1173 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1174 | BSAPICPP.ApplyTorqueImpulse2(bodyu.ptr, imp); | ||
1175 | } | ||
1176 | |||
1177 | // Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces. | ||
1178 | // Deep down in Bullet: applyCentralImpulse(impulse); | ||
1179 | // applyTorqueImpulse(rel_pos.cross(impulse*m_linearFactor)); | ||
1180 | public override void ApplyImpulse(BulletBody obj, Vector3 imp, Vector3 pos) | ||
1181 | { | ||
1182 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1183 | BSAPICPP.ApplyImpulse2(bodyu.ptr, imp, pos); | ||
1184 | } | ||
1185 | |||
1186 | public override void ClearForces(BulletBody obj) | ||
1187 | { | ||
1188 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1189 | BSAPICPP.ClearForces2(bodyu.ptr); | ||
1190 | } | ||
1191 | |||
1192 | public override void ClearAllForces(BulletBody obj) | ||
1193 | { | ||
1194 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1195 | BSAPICPP.ClearAllForces2(bodyu.ptr); | ||
1196 | } | ||
1197 | |||
1198 | public override void UpdateInertiaTensor(BulletBody obj) | ||
1199 | { | ||
1200 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1201 | BSAPICPP.UpdateInertiaTensor2(bodyu.ptr); | ||
1202 | } | ||
1203 | |||
1204 | public override Vector3 GetLinearVelocity(BulletBody obj) | ||
1205 | { | ||
1206 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1207 | return BSAPICPP.GetLinearVelocity2(bodyu.ptr); | ||
1208 | } | ||
1209 | |||
1210 | public override Vector3 GetAngularVelocity(BulletBody obj) | ||
1211 | { | ||
1212 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1213 | return BSAPICPP.GetAngularVelocity2(bodyu.ptr); | ||
1214 | } | ||
1215 | |||
1216 | public override void SetLinearVelocity(BulletBody obj, Vector3 vel) | ||
1217 | { | ||
1218 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1219 | BSAPICPP.SetLinearVelocity2(bodyu.ptr, vel); | ||
1220 | } | ||
1221 | |||
1222 | public override void SetAngularVelocity(BulletBody obj, Vector3 angularVelocity) | ||
1223 | { | ||
1224 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1225 | BSAPICPP.SetAngularVelocity2(bodyu.ptr, angularVelocity); | ||
1226 | } | ||
1227 | |||
1228 | public override Vector3 GetVelocityInLocalPoint(BulletBody obj, Vector3 pos) | ||
1229 | { | ||
1230 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1231 | return BSAPICPP.GetVelocityInLocalPoint2(bodyu.ptr, pos); | ||
1232 | } | ||
1233 | |||
1234 | public override void Translate(BulletBody obj, Vector3 trans) | ||
1235 | { | ||
1236 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1237 | BSAPICPP.Translate2(bodyu.ptr, trans); | ||
1238 | } | ||
1239 | |||
1240 | public override void UpdateDeactivation(BulletBody obj, float timeStep) | ||
1241 | { | ||
1242 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1243 | BSAPICPP.UpdateDeactivation2(bodyu.ptr, timeStep); | ||
1244 | } | ||
1245 | |||
1246 | public override bool WantsSleeping(BulletBody obj) | ||
1247 | { | ||
1248 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1249 | return BSAPICPP.WantsSleeping2(bodyu.ptr); | ||
1250 | } | ||
1251 | |||
1252 | public override void SetAngularFactor(BulletBody obj, float factor) | ||
1253 | { | ||
1254 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1255 | BSAPICPP.SetAngularFactor2(bodyu.ptr, factor); | ||
1256 | } | ||
1257 | |||
1258 | public override void SetAngularFactorV(BulletBody obj, Vector3 factor) | ||
1259 | { | ||
1260 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1261 | BSAPICPP.SetAngularFactorV2(bodyu.ptr, factor); | ||
1262 | } | ||
1263 | |||
1264 | public override Vector3 GetAngularFactor(BulletBody obj) | ||
1265 | { | ||
1266 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1267 | return BSAPICPP.GetAngularFactor2(bodyu.ptr); | ||
1268 | } | ||
1269 | |||
1270 | public override bool IsInWorld(BulletWorld world, BulletBody obj) | ||
1271 | { | ||
1272 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1273 | return BSAPICPP.IsInWorld2(bodyu.ptr); | ||
1274 | } | ||
1275 | |||
1276 | public override void AddConstraintRef(BulletBody obj, BulletConstraint constrain) | ||
1277 | { | ||
1278 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1279 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
1280 | BSAPICPP.AddConstraintRef2(bodyu.ptr, constrainu.ptr); | ||
1281 | } | ||
1282 | |||
1283 | public override void RemoveConstraintRef(BulletBody obj, BulletConstraint constrain) | ||
1284 | { | ||
1285 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1286 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
1287 | BSAPICPP.RemoveConstraintRef2(bodyu.ptr, constrainu.ptr); | ||
1288 | } | ||
1289 | |||
1290 | public override BulletConstraint GetConstraintRef(BulletBody obj, int index) | ||
1291 | { | ||
1292 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1293 | return new BulletConstraintUnman(BSAPICPP.GetConstraintRef2(bodyu.ptr, index)); | ||
1294 | } | ||
1295 | |||
1296 | public override int GetNumConstraintRefs(BulletBody obj) | ||
1297 | { | ||
1298 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
1299 | return BSAPICPP.GetNumConstraintRefs2(bodyu.ptr); | ||
1300 | } | ||
1301 | |||
1302 | public override bool SetCollisionGroupMask(BulletBody body, uint filter, uint mask) | ||
1303 | { | ||
1304 | BulletBodyUnman bodyu = body as BulletBodyUnman; | ||
1305 | return BSAPICPP.SetCollisionGroupMask2(bodyu.ptr, filter, mask); | ||
1306 | } | ||
1307 | |||
1308 | // ===================================================================================== | ||
1309 | // btCollisionShape entries | ||
1310 | |||
1311 | public override float GetAngularMotionDisc(BulletShape shape) | ||
1312 | { | ||
1313 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
1314 | return BSAPICPP.GetAngularMotionDisc2(shapeu.ptr); | ||
1315 | } | ||
1316 | |||
1317 | public override float GetContactBreakingThreshold(BulletShape shape, float defaultFactor) | ||
1318 | { | ||
1319 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
1320 | return BSAPICPP.GetContactBreakingThreshold2(shapeu.ptr, defaultFactor); | ||
1321 | } | ||
1322 | |||
1323 | public override bool IsPolyhedral(BulletShape shape) | ||
1324 | { | ||
1325 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
1326 | return BSAPICPP.IsPolyhedral2(shapeu.ptr); | ||
1327 | } | ||
1328 | |||
1329 | public override bool IsConvex2d(BulletShape shape) | ||
1330 | { | ||
1331 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
1332 | return BSAPICPP.IsConvex2d2(shapeu.ptr); | ||
1333 | } | ||
1334 | |||
1335 | public override bool IsConvex(BulletShape shape) | ||
1336 | { | ||
1337 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
1338 | return BSAPICPP.IsConvex2(shapeu.ptr); | ||
1339 | } | ||
1340 | |||
1341 | public override bool IsNonMoving(BulletShape shape) | ||
1342 | { | ||
1343 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
1344 | return BSAPICPP.IsNonMoving2(shapeu.ptr); | ||
1345 | } | ||
1346 | |||
1347 | public override bool IsConcave(BulletShape shape) | ||
1348 | { | ||
1349 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
1350 | return BSAPICPP.IsConcave2(shapeu.ptr); | ||
1351 | } | ||
1352 | |||
1353 | public override bool IsCompound(BulletShape shape) | ||
1354 | { | ||
1355 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
1356 | return BSAPICPP.IsCompound2(shapeu.ptr); | ||
1357 | } | ||
1358 | |||
1359 | public override bool IsSoftBody(BulletShape shape) | ||
1360 | { | ||
1361 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
1362 | return BSAPICPP.IsSoftBody2(shapeu.ptr); | ||
1363 | } | ||
1364 | |||
1365 | public override bool IsInfinite(BulletShape shape) | ||
1366 | { | ||
1367 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
1368 | return BSAPICPP.IsInfinite2(shapeu.ptr); | ||
1369 | } | ||
1370 | |||
1371 | public override void SetLocalScaling(BulletShape shape, Vector3 scale) | ||
1372 | { | ||
1373 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
1374 | BSAPICPP.SetLocalScaling2(shapeu.ptr, scale); | ||
1375 | } | ||
1376 | |||
1377 | public override Vector3 GetLocalScaling(BulletShape shape) | ||
1378 | { | ||
1379 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
1380 | return BSAPICPP.GetLocalScaling2(shapeu.ptr); | ||
1381 | } | ||
1382 | |||
1383 | public override Vector3 CalculateLocalInertia(BulletShape shape, float mass) | ||
1384 | { | ||
1385 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
1386 | return BSAPICPP.CalculateLocalInertia2(shapeu.ptr, mass); | ||
1387 | } | ||
1388 | |||
1389 | public override int GetShapeType(BulletShape shape) | ||
1390 | { | ||
1391 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
1392 | return BSAPICPP.GetShapeType2(shapeu.ptr); | ||
1393 | } | ||
1394 | |||
1395 | public override void SetMargin(BulletShape shape, float val) | ||
1396 | { | ||
1397 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
1398 | BSAPICPP.SetMargin2(shapeu.ptr, val); | ||
1399 | } | ||
1400 | |||
1401 | public override float GetMargin(BulletShape shape) | ||
1402 | { | ||
1403 | BulletShapeUnman shapeu = shape as BulletShapeUnman; | ||
1404 | return BSAPICPP.GetMargin2(shapeu.ptr); | ||
1405 | } | ||
1406 | |||
1407 | // ===================================================================================== | ||
1408 | // Debugging | ||
1409 | public override void DumpRigidBody(BulletWorld world, BulletBody collisionObject) | ||
1410 | { | ||
1411 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
1412 | BulletBodyUnman bodyu = collisionObject as BulletBodyUnman; | ||
1413 | BSAPICPP.DumpRigidBody2(worldu.ptr, bodyu.ptr); | ||
1414 | } | ||
1415 | |||
1416 | public override void DumpCollisionShape(BulletWorld world, BulletShape collisionShape) | ||
1417 | { | ||
1418 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
1419 | BulletShapeUnman shapeu = collisionShape as BulletShapeUnman; | ||
1420 | BSAPICPP.DumpCollisionShape2(worldu.ptr, shapeu.ptr); | ||
1421 | } | ||
1422 | |||
1423 | public override void DumpConstraint(BulletWorld world, BulletConstraint constrain) | ||
1424 | { | ||
1425 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
1426 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
1427 | BSAPICPP.DumpConstraint2(worldu.ptr, constrainu.ptr); | ||
1428 | } | ||
1429 | |||
1430 | public override void DumpActivationInfo(BulletWorld world) | ||
1431 | { | ||
1432 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
1433 | BSAPICPP.DumpActivationInfo2(worldu.ptr); | ||
1434 | } | ||
1435 | |||
1436 | public override void DumpAllInfo(BulletWorld world) | ||
1437 | { | ||
1438 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
1439 | BSAPICPP.DumpAllInfo2(worldu.ptr); | ||
1440 | } | ||
1441 | |||
1442 | public override void DumpPhysicsStatistics(BulletWorld world) | ||
1443 | { | ||
1444 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
1445 | BSAPICPP.DumpPhysicsStatistics2(worldu.ptr); | ||
1446 | } | ||
1447 | public override void ResetBroadphasePool(BulletWorld world) | ||
1448 | { | ||
1449 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
1450 | BSAPICPP.ResetBroadphasePool(worldu.ptr); | ||
1451 | } | ||
1452 | public override void ResetConstraintSolver(BulletWorld world) | ||
1453 | { | ||
1454 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
1455 | BSAPICPP.ResetConstraintSolver(worldu.ptr); | ||
1456 | } | ||
1457 | |||
1458 | // ===================================================================================== | ||
1459 | // ===================================================================================== | ||
1460 | // ===================================================================================== | ||
1461 | // ===================================================================================== | ||
1462 | // ===================================================================================== | ||
1463 | // The actual interface to the unmanaged code | ||
1464 | static class BSAPICPP | ||
1465 | { | ||
1466 | // =============================================================================== | ||
1467 | // Link back to the managed code for outputting log messages | ||
1468 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
1469 | public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg); | ||
1470 | |||
1471 | // =============================================================================== | ||
1472 | // Initialization and simulation | ||
1473 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1474 | public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms, | ||
1475 | int maxCollisions, IntPtr collisionArray, | ||
1476 | int maxUpdates, IntPtr updateArray, | ||
1477 | DebugLogCallback logRoutine); | ||
1478 | |||
1479 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1480 | public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep, | ||
1481 | out int updatedEntityCount, out int collidersCount); | ||
1482 | |||
1483 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1484 | public static extern void Shutdown2(IntPtr sim); | ||
1485 | |||
1486 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1487 | public static extern bool PushUpdate2(IntPtr obj); | ||
1488 | |||
1489 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1490 | public static extern bool UpdateParameter2(IntPtr world, uint localID, String parm, float value); | ||
1491 | |||
1492 | // ===================================================================================== | ||
1493 | // Mesh, hull, shape and body creation helper routines | ||
1494 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1495 | public static extern IntPtr CreateMeshShape2(IntPtr world, | ||
1496 | int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices, | ||
1497 | int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices ); | ||
1498 | |||
1499 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1500 | public static extern IntPtr CreateGImpactShape2(IntPtr world, | ||
1501 | int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices, | ||
1502 | int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices ); | ||
1503 | |||
1504 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1505 | public static extern IntPtr CreateHullShape2(IntPtr world, | ||
1506 | int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls); | ||
1507 | |||
1508 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1509 | public static extern IntPtr BuildHullShapeFromMesh2(IntPtr world, IntPtr meshShape, HACDParams parms); | ||
1510 | |||
1511 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1512 | public static extern IntPtr BuildConvexHullShapeFromMesh2(IntPtr world, IntPtr meshShape); | ||
1513 | |||
1514 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1515 | public static extern IntPtr CreateConvexHullShape2(IntPtr world, | ||
1516 | int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices, | ||
1517 | int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices ); | ||
1518 | |||
1519 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1520 | public static extern IntPtr BuildNativeShape2(IntPtr world, ShapeData shapeData); | ||
1521 | |||
1522 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1523 | public static extern bool IsNativeShape2(IntPtr shape); | ||
1524 | |||
1525 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1526 | public static extern void SetShapeCollisionMargin(IntPtr shape, float margin); | ||
1527 | |||
1528 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1529 | public static extern IntPtr BuildCapsuleShape2(IntPtr world, float radius, float height, Vector3 scale); | ||
1530 | |||
1531 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1532 | public static extern IntPtr CreateCompoundShape2(IntPtr sim, bool enableDynamicAabbTree); | ||
1533 | |||
1534 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1535 | public static extern int GetNumberOfCompoundChildren2(IntPtr cShape); | ||
1536 | |||
1537 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1538 | public static extern void AddChildShapeToCompoundShape2(IntPtr cShape, IntPtr addShape, Vector3 pos, Quaternion rot); | ||
1539 | |||
1540 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1541 | public static extern IntPtr GetChildShapeFromCompoundShapeIndex2(IntPtr cShape, int indx); | ||
1542 | |||
1543 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1544 | public static extern IntPtr RemoveChildShapeFromCompoundShapeIndex2(IntPtr cShape, int indx); | ||
1545 | |||
1546 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1547 | public static extern void RemoveChildShapeFromCompoundShape2(IntPtr cShape, IntPtr removeShape); | ||
1548 | |||
1549 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1550 | public static extern void UpdateChildTransform2(IntPtr pShape, int childIndex, Vector3 pos, Quaternion rot, bool shouldRecalculateLocalAabb); | ||
1551 | |||
1552 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1553 | public static extern void RecalculateCompoundShapeLocalAabb2(IntPtr cShape); | ||
1554 | |||
1555 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1556 | public static extern IntPtr DuplicateCollisionShape2(IntPtr sim, IntPtr srcShape, uint id); | ||
1557 | |||
1558 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1559 | public static extern bool DeleteCollisionShape2(IntPtr world, IntPtr shape); | ||
1560 | |||
1561 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1562 | public static extern int GetBodyType2(IntPtr obj); | ||
1563 | |||
1564 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1565 | public static extern IntPtr CreateBodyFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot); | ||
1566 | |||
1567 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1568 | public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, uint id, Vector3 pos, Quaternion rot); | ||
1569 | |||
1570 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1571 | public static extern IntPtr CreateGhostFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot); | ||
1572 | |||
1573 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1574 | public static extern void DestroyObject2(IntPtr sim, IntPtr obj); | ||
1575 | |||
1576 | // ===================================================================================== | ||
1577 | // Terrain creation and helper routines | ||
1578 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1579 | public static extern IntPtr CreateGroundPlaneShape2(uint id, float height, float collisionMargin); | ||
1580 | |||
1581 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1582 | public static extern IntPtr CreateTerrainShape2(uint id, Vector3 size, float minHeight, float maxHeight, | ||
1583 | [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, | ||
1584 | float scaleFactor, float collisionMargin); | ||
1585 | |||
1586 | // ===================================================================================== | ||
1587 | // Constraint creation and helper routines | ||
1588 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1589 | public static extern IntPtr Create6DofConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, | ||
1590 | Vector3 frame1loc, Quaternion frame1rot, | ||
1591 | Vector3 frame2loc, Quaternion frame2rot, | ||
1592 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
1593 | |||
1594 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1595 | public static extern IntPtr Create6DofConstraintToPoint2(IntPtr world, IntPtr obj1, IntPtr obj2, | ||
1596 | Vector3 joinPoint, | ||
1597 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
1598 | |||
1599 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1600 | public static extern IntPtr Create6DofConstraintFixed2(IntPtr world, IntPtr obj1, | ||
1601 | Vector3 frameInBloc, Quaternion frameInBrot, | ||
1602 | bool useLinearReferenceFrameB, bool disableCollisionsBetweenLinkedBodies); | ||
1603 | |||
1604 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1605 | public static extern IntPtr Create6DofSpringConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, | ||
1606 | Vector3 frame1loc, Quaternion frame1rot, | ||
1607 | Vector3 frame2loc, Quaternion frame2rot, | ||
1608 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
1609 | |||
1610 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1611 | public static extern IntPtr CreateHingeConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, | ||
1612 | Vector3 pivotinA, Vector3 pivotinB, | ||
1613 | Vector3 axisInA, Vector3 axisInB, | ||
1614 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
1615 | |||
1616 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1617 | public static extern IntPtr CreateSliderConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, | ||
1618 | Vector3 frameInAloc, Quaternion frameInArot, | ||
1619 | Vector3 frameInBloc, Quaternion frameInBrot, | ||
1620 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
1621 | |||
1622 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1623 | public static extern IntPtr CreateConeTwistConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, | ||
1624 | Vector3 frameInAloc, Quaternion frameInArot, | ||
1625 | Vector3 frameInBloc, Quaternion frameInBrot, | ||
1626 | bool disableCollisionsBetweenLinkedBodies); | ||
1627 | |||
1628 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1629 | public static extern IntPtr CreateGearConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, | ||
1630 | Vector3 axisInA, Vector3 axisInB, | ||
1631 | float ratio, bool disableCollisionsBetweenLinkedBodies); | ||
1632 | |||
1633 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1634 | public static extern IntPtr CreatePoint2PointConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, | ||
1635 | Vector3 pivotInA, Vector3 pivotInB, | ||
1636 | bool disableCollisionsBetweenLinkedBodies); | ||
1637 | |||
1638 | |||
1639 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1640 | public static extern void SetConstraintEnable2(IntPtr constrain, float numericTrueFalse); | ||
1641 | |||
1642 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1643 | public static extern void SetConstraintNumSolverIterations2(IntPtr constrain, float iterations); | ||
1644 | |||
1645 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1646 | public static extern bool SetFrames2(IntPtr constrain, | ||
1647 | Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot); | ||
1648 | |||
1649 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1650 | public static extern bool SetLinearLimits2(IntPtr constrain, Vector3 low, Vector3 hi); | ||
1651 | |||
1652 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1653 | public static extern bool SetAngularLimits2(IntPtr constrain, Vector3 low, Vector3 hi); | ||
1654 | |||
1655 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1656 | public static extern bool UseFrameOffset2(IntPtr constrain, float enable); | ||
1657 | |||
1658 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1659 | public static extern bool TranslationalLimitMotor2(IntPtr constrain, float enable, float targetVel, float maxMotorForce); | ||
1660 | |||
1661 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1662 | public static extern bool SetBreakingImpulseThreshold2(IntPtr constrain, float threshold); | ||
1663 | |||
1664 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1665 | public static extern bool HingeSetLimits2(IntPtr constrain, float low, float high, float softness, float bias, float relaxation); | ||
1666 | |||
1667 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1668 | public static extern bool ConstraintSpringEnable2(IntPtr constrain, int index, float numericTrueFalse); | ||
1669 | |||
1670 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1671 | public static extern bool ConstraintSpringSetEquilibriumPoint2(IntPtr constrain, int index, float equilibriumPoint); | ||
1672 | |||
1673 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1674 | public static extern bool ConstraintSpringSetStiffness2(IntPtr constrain, int index, float stiffness); | ||
1675 | |||
1676 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1677 | public static extern bool ConstraintSpringSetDamping2(IntPtr constrain, int index, float damping); | ||
1678 | |||
1679 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1680 | public static extern bool SliderSetLimits2(IntPtr constrain, int lowerUpper, int linAng, float val); | ||
1681 | |||
1682 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1683 | public static extern bool SliderSet2(IntPtr constrain, int softRestDamp, int dirLimOrtho, int linAng, float val); | ||
1684 | |||
1685 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1686 | public static extern bool SliderMotorEnable2(IntPtr constrain, int linAng, float numericTrueFalse); | ||
1687 | |||
1688 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1689 | public static extern bool SliderMotor2(IntPtr constrain, int forceVel, int linAng, float val); | ||
1690 | |||
1691 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1692 | public static extern bool CalculateTransforms2(IntPtr constrain); | ||
1693 | |||
1694 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1695 | public static extern bool SetConstraintParam2(IntPtr constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis); | ||
1696 | |||
1697 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1698 | public static extern bool DestroyConstraint2(IntPtr world, IntPtr constrain); | ||
1699 | |||
1700 | // ===================================================================================== | ||
1701 | // btCollisionWorld entries | ||
1702 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1703 | public static extern void UpdateSingleAabb2(IntPtr world, IntPtr obj); | ||
1704 | |||
1705 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1706 | public static extern void UpdateAabbs2(IntPtr world); | ||
1707 | |||
1708 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1709 | public static extern bool GetForceUpdateAllAabbs2(IntPtr world); | ||
1710 | |||
1711 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1712 | public static extern void SetForceUpdateAllAabbs2(IntPtr world, bool force); | ||
1713 | |||
1714 | // ===================================================================================== | ||
1715 | // btDynamicsWorld entries | ||
1716 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1717 | public static extern bool AddObjectToWorld2(IntPtr world, IntPtr obj); | ||
1718 | |||
1719 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1720 | public static extern bool RemoveObjectFromWorld2(IntPtr world, IntPtr obj); | ||
1721 | |||
1722 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1723 | public static extern bool ClearCollisionProxyCache2(IntPtr world, IntPtr obj); | ||
1724 | |||
1725 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1726 | public static extern bool AddConstraintToWorld2(IntPtr world, IntPtr constrain, bool disableCollisionsBetweenLinkedObjects); | ||
1727 | |||
1728 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1729 | public static extern bool RemoveConstraintFromWorld2(IntPtr world, IntPtr constrain); | ||
1730 | // ===================================================================================== | ||
1731 | // btCollisionObject entries | ||
1732 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1733 | public static extern Vector3 GetAnisotripicFriction2(IntPtr constrain); | ||
1734 | |||
1735 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1736 | public static extern Vector3 SetAnisotripicFriction2(IntPtr constrain, Vector3 frict); | ||
1737 | |||
1738 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1739 | public static extern bool HasAnisotripicFriction2(IntPtr constrain); | ||
1740 | |||
1741 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1742 | public static extern void SetContactProcessingThreshold2(IntPtr obj, float val); | ||
1743 | |||
1744 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1745 | public static extern float GetContactProcessingThreshold2(IntPtr obj); | ||
1746 | |||
1747 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1748 | public static extern bool IsStaticObject2(IntPtr obj); | ||
1749 | |||
1750 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1751 | public static extern bool IsKinematicObject2(IntPtr obj); | ||
1752 | |||
1753 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1754 | public static extern bool IsStaticOrKinematicObject2(IntPtr obj); | ||
1755 | |||
1756 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1757 | public static extern bool HasContactResponse2(IntPtr obj); | ||
1758 | |||
1759 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1760 | public static extern void SetCollisionShape2(IntPtr sim, IntPtr obj, IntPtr shape); | ||
1761 | |||
1762 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1763 | public static extern IntPtr GetCollisionShape2(IntPtr obj); | ||
1764 | |||
1765 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1766 | public static extern int GetActivationState2(IntPtr obj); | ||
1767 | |||
1768 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1769 | public static extern void SetActivationState2(IntPtr obj, int state); | ||
1770 | |||
1771 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1772 | public static extern void SetDeactivationTime2(IntPtr obj, float dtime); | ||
1773 | |||
1774 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1775 | public static extern float GetDeactivationTime2(IntPtr obj); | ||
1776 | |||
1777 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1778 | public static extern void ForceActivationState2(IntPtr obj, ActivationState state); | ||
1779 | |||
1780 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1781 | public static extern void Activate2(IntPtr obj, bool forceActivation); | ||
1782 | |||
1783 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1784 | public static extern bool IsActive2(IntPtr obj); | ||
1785 | |||
1786 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1787 | public static extern void SetRestitution2(IntPtr obj, float val); | ||
1788 | |||
1789 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1790 | public static extern float GetRestitution2(IntPtr obj); | ||
1791 | |||
1792 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1793 | public static extern void SetFriction2(IntPtr obj, float val); | ||
1794 | |||
1795 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1796 | public static extern float GetFriction2(IntPtr obj); | ||
1797 | |||
1798 | /* Haven't defined the type 'Transform' | ||
1799 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1800 | public static extern Transform GetWorldTransform2(IntPtr obj); | ||
1801 | |||
1802 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1803 | public static extern void setWorldTransform2(IntPtr obj, Transform trans); | ||
1804 | */ | ||
1805 | |||
1806 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1807 | public static extern Vector3 GetPosition2(IntPtr obj); | ||
1808 | |||
1809 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1810 | public static extern Quaternion GetOrientation2(IntPtr obj); | ||
1811 | |||
1812 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1813 | public static extern void SetTranslation2(IntPtr obj, Vector3 position, Quaternion rotation); | ||
1814 | |||
1815 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1816 | public static extern IntPtr GetBroadphaseHandle2(IntPtr obj); | ||
1817 | |||
1818 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1819 | public static extern void SetBroadphaseHandle2(IntPtr obj, IntPtr handle); | ||
1820 | |||
1821 | /* | ||
1822 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1823 | public static extern Transform GetInterpolationWorldTransform2(IntPtr obj); | ||
1824 | |||
1825 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1826 | public static extern void SetInterpolationWorldTransform2(IntPtr obj, Transform trans); | ||
1827 | */ | ||
1828 | |||
1829 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1830 | public static extern void SetInterpolationLinearVelocity2(IntPtr obj, Vector3 vel); | ||
1831 | |||
1832 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1833 | public static extern void SetInterpolationAngularVelocity2(IntPtr obj, Vector3 vel); | ||
1834 | |||
1835 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1836 | public static extern void SetInterpolationVelocity2(IntPtr obj, Vector3 linearVel, Vector3 angularVel); | ||
1837 | |||
1838 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1839 | public static extern float GetHitFraction2(IntPtr obj); | ||
1840 | |||
1841 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1842 | public static extern void SetHitFraction2(IntPtr obj, float val); | ||
1843 | |||
1844 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1845 | public static extern CollisionFlags GetCollisionFlags2(IntPtr obj); | ||
1846 | |||
1847 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1848 | public static extern CollisionFlags SetCollisionFlags2(IntPtr obj, CollisionFlags flags); | ||
1849 | |||
1850 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1851 | public static extern CollisionFlags AddToCollisionFlags2(IntPtr obj, CollisionFlags flags); | ||
1852 | |||
1853 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1854 | public static extern CollisionFlags RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags); | ||
1855 | |||
1856 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1857 | public static extern float GetCcdMotionThreshold2(IntPtr obj); | ||
1858 | |||
1859 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1860 | public static extern void SetCcdMotionThreshold2(IntPtr obj, float val); | ||
1861 | |||
1862 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1863 | public static extern float GetCcdSweptSphereRadius2(IntPtr obj); | ||
1864 | |||
1865 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1866 | public static extern void SetCcdSweptSphereRadius2(IntPtr obj, float val); | ||
1867 | |||
1868 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1869 | public static extern IntPtr GetUserPointer2(IntPtr obj); | ||
1870 | |||
1871 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1872 | public static extern void SetUserPointer2(IntPtr obj, IntPtr val); | ||
1873 | |||
1874 | // ===================================================================================== | ||
1875 | // btRigidBody entries | ||
1876 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1877 | public static extern void ApplyGravity2(IntPtr obj); | ||
1878 | |||
1879 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1880 | public static extern void SetGravity2(IntPtr obj, Vector3 val); | ||
1881 | |||
1882 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1883 | public static extern Vector3 GetGravity2(IntPtr obj); | ||
1884 | |||
1885 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1886 | public static extern void SetDamping2(IntPtr obj, float lin_damping, float ang_damping); | ||
1887 | |||
1888 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1889 | public static extern void SetLinearDamping2(IntPtr obj, float lin_damping); | ||
1890 | |||
1891 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1892 | public static extern void SetAngularDamping2(IntPtr obj, float ang_damping); | ||
1893 | |||
1894 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1895 | public static extern float GetLinearDamping2(IntPtr obj); | ||
1896 | |||
1897 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1898 | public static extern float GetAngularDamping2(IntPtr obj); | ||
1899 | |||
1900 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1901 | public static extern float GetLinearSleepingThreshold2(IntPtr obj); | ||
1902 | |||
1903 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1904 | public static extern float GetAngularSleepingThreshold2(IntPtr obj); | ||
1905 | |||
1906 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1907 | public static extern void ApplyDamping2(IntPtr obj, float timeStep); | ||
1908 | |||
1909 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1910 | public static extern void SetMassProps2(IntPtr obj, float mass, Vector3 inertia); | ||
1911 | |||
1912 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1913 | public static extern Vector3 GetLinearFactor2(IntPtr obj); | ||
1914 | |||
1915 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1916 | public static extern void SetLinearFactor2(IntPtr obj, Vector3 factor); | ||
1917 | |||
1918 | /* | ||
1919 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1920 | public static extern void SetCenterOfMassTransform2(IntPtr obj, Transform trans); | ||
1921 | */ | ||
1922 | |||
1923 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1924 | public static extern void SetCenterOfMassByPosRot2(IntPtr obj, Vector3 pos, Quaternion rot); | ||
1925 | |||
1926 | // Add a force to the object as if its mass is one. | ||
1927 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1928 | public static extern void ApplyCentralForce2(IntPtr obj, Vector3 force); | ||
1929 | |||
1930 | // Set the force being applied to the object as if its mass is one. | ||
1931 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1932 | public static extern void SetObjectForce2(IntPtr obj, Vector3 force); | ||
1933 | |||
1934 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1935 | public static extern Vector3 GetTotalForce2(IntPtr obj); | ||
1936 | |||
1937 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1938 | public static extern Vector3 GetTotalTorque2(IntPtr obj); | ||
1939 | |||
1940 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1941 | public static extern Vector3 GetInvInertiaDiagLocal2(IntPtr obj); | ||
1942 | |||
1943 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1944 | public static extern void SetInvInertiaDiagLocal2(IntPtr obj, Vector3 inert); | ||
1945 | |||
1946 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1947 | public static extern void SetSleepingThresholds2(IntPtr obj, float lin_threshold, float ang_threshold); | ||
1948 | |||
1949 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1950 | public static extern void ApplyTorque2(IntPtr obj, Vector3 torque); | ||
1951 | |||
1952 | // Apply force at the given point. Will add torque to the object. | ||
1953 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1954 | public static extern void ApplyForce2(IntPtr obj, Vector3 force, Vector3 pos); | ||
1955 | |||
1956 | // Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass. | ||
1957 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1958 | public static extern void ApplyCentralImpulse2(IntPtr obj, Vector3 imp); | ||
1959 | |||
1960 | // Apply impulse to the object's torque. Force is scaled by object's mass. | ||
1961 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1962 | public static extern void ApplyTorqueImpulse2(IntPtr obj, Vector3 imp); | ||
1963 | |||
1964 | // Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces. | ||
1965 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1966 | public static extern void ApplyImpulse2(IntPtr obj, Vector3 imp, Vector3 pos); | ||
1967 | |||
1968 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1969 | public static extern void ClearForces2(IntPtr obj); | ||
1970 | |||
1971 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1972 | public static extern void ClearAllForces2(IntPtr obj); | ||
1973 | |||
1974 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1975 | public static extern void UpdateInertiaTensor2(IntPtr obj); | ||
1976 | |||
1977 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1978 | public static extern Vector3 GetCenterOfMassPosition2(IntPtr obj); | ||
1979 | |||
1980 | /* | ||
1981 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1982 | public static extern Transform GetCenterOfMassTransform2(IntPtr obj); | ||
1983 | */ | ||
1984 | |||
1985 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1986 | public static extern Vector3 GetLinearVelocity2(IntPtr obj); | ||
1987 | |||
1988 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1989 | public static extern Vector3 GetAngularVelocity2(IntPtr obj); | ||
1990 | |||
1991 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1992 | public static extern void SetLinearVelocity2(IntPtr obj, Vector3 val); | ||
1993 | |||
1994 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1995 | public static extern void SetAngularVelocity2(IntPtr obj, Vector3 angularVelocity); | ||
1996 | |||
1997 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1998 | public static extern Vector3 GetVelocityInLocalPoint2(IntPtr obj, Vector3 pos); | ||
1999 | |||
2000 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2001 | public static extern void Translate2(IntPtr obj, Vector3 trans); | ||
2002 | |||
2003 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2004 | public static extern void UpdateDeactivation2(IntPtr obj, float timeStep); | ||
2005 | |||
2006 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2007 | public static extern bool WantsSleeping2(IntPtr obj); | ||
2008 | |||
2009 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2010 | public static extern void SetAngularFactor2(IntPtr obj, float factor); | ||
2011 | |||
2012 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2013 | public static extern void SetAngularFactorV2(IntPtr obj, Vector3 factor); | ||
2014 | |||
2015 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2016 | public static extern Vector3 GetAngularFactor2(IntPtr obj); | ||
2017 | |||
2018 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2019 | public static extern bool IsInWorld2(IntPtr obj); | ||
2020 | |||
2021 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2022 | public static extern void AddConstraintRef2(IntPtr obj, IntPtr constrain); | ||
2023 | |||
2024 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2025 | public static extern void RemoveConstraintRef2(IntPtr obj, IntPtr constrain); | ||
2026 | |||
2027 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2028 | public static extern IntPtr GetConstraintRef2(IntPtr obj, int index); | ||
2029 | |||
2030 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2031 | public static extern int GetNumConstraintRefs2(IntPtr obj); | ||
2032 | |||
2033 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2034 | public static extern bool SetCollisionGroupMask2(IntPtr body, uint filter, uint mask); | ||
2035 | |||
2036 | // ===================================================================================== | ||
2037 | // btCollisionShape entries | ||
2038 | |||
2039 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2040 | public static extern float GetAngularMotionDisc2(IntPtr shape); | ||
2041 | |||
2042 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2043 | public static extern float GetContactBreakingThreshold2(IntPtr shape, float defaultFactor); | ||
2044 | |||
2045 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2046 | public static extern bool IsPolyhedral2(IntPtr shape); | ||
2047 | |||
2048 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2049 | public static extern bool IsConvex2d2(IntPtr shape); | ||
2050 | |||
2051 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2052 | public static extern bool IsConvex2(IntPtr shape); | ||
2053 | |||
2054 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2055 | public static extern bool IsNonMoving2(IntPtr shape); | ||
2056 | |||
2057 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2058 | public static extern bool IsConcave2(IntPtr shape); | ||
2059 | |||
2060 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2061 | public static extern bool IsCompound2(IntPtr shape); | ||
2062 | |||
2063 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2064 | public static extern bool IsSoftBody2(IntPtr shape); | ||
2065 | |||
2066 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2067 | public static extern bool IsInfinite2(IntPtr shape); | ||
2068 | |||
2069 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2070 | public static extern void SetLocalScaling2(IntPtr shape, Vector3 scale); | ||
2071 | |||
2072 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2073 | public static extern Vector3 GetLocalScaling2(IntPtr shape); | ||
2074 | |||
2075 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2076 | public static extern Vector3 CalculateLocalInertia2(IntPtr shape, float mass); | ||
2077 | |||
2078 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2079 | public static extern int GetShapeType2(IntPtr shape); | ||
2080 | |||
2081 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2082 | public static extern void SetMargin2(IntPtr shape, float val); | ||
2083 | |||
2084 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2085 | public static extern float GetMargin2(IntPtr shape); | ||
2086 | |||
2087 | // ===================================================================================== | ||
2088 | // Debugging | ||
2089 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2090 | public static extern void DumpRigidBody2(IntPtr sim, IntPtr collisionObject); | ||
2091 | |||
2092 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2093 | public static extern void DumpCollisionShape2(IntPtr sim, IntPtr collisionShape); | ||
2094 | |||
2095 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2096 | public static extern void DumpMapInfo2(IntPtr sim, IntPtr manInfo); | ||
2097 | |||
2098 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2099 | public static extern void DumpConstraint2(IntPtr sim, IntPtr constrain); | ||
2100 | |||
2101 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2102 | public static extern void DumpActivationInfo2(IntPtr sim); | ||
2103 | |||
2104 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2105 | public static extern void DumpAllInfo2(IntPtr sim); | ||
2106 | |||
2107 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2108 | public static extern void DumpPhysicsStatistics2(IntPtr sim); | ||
2109 | |||
2110 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2111 | public static extern void ResetBroadphasePool(IntPtr sim); | ||
2112 | |||
2113 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
2114 | public static extern void ResetConstraintSolver(IntPtr sim); | ||
2115 | |||
2116 | } | ||
2117 | |||
2118 | } | ||
2119 | |||
2120 | } | ||