aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
diff options
context:
space:
mode:
authorRobert Adams2013-01-01 09:30:49 -0800
committerRobert Adams2013-01-01 17:27:32 -0800
commit04132d3af4c8f44639ea842091f86274513e2dfd (patch)
tree8afd4aa11cb7bcf15ffd7156204f73859e762f31 /OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
parentFixed bugs when getting the root folder. (diff)
downloadopensim-SC_OLD-04132d3af4c8f44639ea842091f86274513e2dfd.zip
opensim-SC_OLD-04132d3af4c8f44639ea842091f86274513e2dfd.tar.gz
opensim-SC_OLD-04132d3af4c8f44639ea842091f86274513e2dfd.tar.bz2
opensim-SC_OLD-04132d3af4c8f44639ea842091f86274513e2dfd.tar.xz
BulletSim: subclass Bullet[World|Body|Shape|Constraint] for unmanaged
to have pointers and managed to have objects. Initial paste of XNA code. Commented out.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs654
1 files changed, 464 insertions, 190 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
index 3975776..2c0cb43 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
@@ -38,6 +38,91 @@ namespace OpenSim.Region.Physics.BulletSPlugin
38public sealed class BSAPIUnman : BSAPITemplate 38public sealed class BSAPIUnman : BSAPITemplate
39{ 39{
40 40
41private sealed class BulletWorldUnman : BulletWorld
42{
43 public IntPtr ptr;
44 public BulletWorldUnman(uint id, BSScene physScene, IntPtr xx)
45 : base(id, physScene)
46 {
47 ptr = xx;
48 }
49}
50
51private sealed class BulletBodyUnman : BulletBody
52{
53 public IntPtr ptr;
54 public BulletBodyUnman(uint id, IntPtr xx)
55 : base(id)
56 {
57 ptr = xx;
58 }
59 public override bool HasPhysicalBody
60 {
61 get { return ptr != IntPtr.Zero; }
62 }
63 public override void Clear()
64 {
65 ptr = IntPtr.Zero;
66 }
67 public override string AddrString
68 {
69 get { return ptr.ToString("X"); }
70 }
71}
72
73private sealed class BulletShapeUnman : BulletShape
74{
75 public IntPtr ptr;
76 public BulletShapeUnman(IntPtr xx, BSPhysicsShapeType typ)
77 : base()
78 {
79 ptr = xx;
80 type = typ;
81 }
82 public override bool HasPhysicalShape
83 {
84 get { return ptr != IntPtr.Zero; }
85 }
86 public override void Clear()
87 {
88 ptr = IntPtr.Zero;
89 }
90 public override BulletShape Clone()
91 {
92 return new BulletShapeUnman(ptr, type);
93 }
94 public override bool ReferenceSame(BulletShape other)
95 {
96 BulletShapeUnman otheru = other as BulletShapeUnman;
97 return (otheru != null) && (this.ptr == otheru.ptr);
98
99 }
100 public override string AddrString
101 {
102 get { return ptr.ToString("X"); }
103 }
104}
105private sealed class BulletConstraintUnman : BulletConstraint
106{
107 public BulletConstraintUnman(IntPtr xx) : base()
108 {
109 ptr = xx;
110 }
111 public IntPtr ptr;
112
113 public override void Clear()
114 {
115 ptr = IntPtr.Zero;
116 }
117 public override bool HasPhysicalConstraint { get { return ptr != IntPtr.Zero; } }
118
119 // Used for log messages for a unique display of the memory/object allocated to this instance
120 public override string AddrString
121 {
122 get { return ptr.ToString("X"); }
123 }
124}
125
41// We pin the memory passed between the managed and unmanaged code. 126// We pin the memory passed between the managed and unmanaged code.
42GCHandle m_paramsHandle; 127GCHandle m_paramsHandle;
43private GCHandle m_collisionArrayPinnedHandle; 128private GCHandle m_collisionArrayPinnedHandle;
@@ -89,7 +174,7 @@ public override BulletWorld Initialize(Vector3 maxPosition, ConfigurationParamet
89 BulletEngineVersion = ""; 174 BulletEngineVersion = "";
90 175
91 // Call the unmanaged code with the buffers and other information 176 // Call the unmanaged code with the buffers and other information
92 return new BulletWorld(0, PhysicsScene, BSAPICPP.Initialize2(maxPosition, m_paramsHandle.AddrOfPinnedObject(), 177 return new BulletWorldUnman(0, PhysicsScene, BSAPICPP.Initialize2(maxPosition, m_paramsHandle.AddrOfPinnedObject(),
93 maxCollisions, m_collisionArrayPinnedHandle.AddrOfPinnedObject(), 178 maxCollisions, m_collisionArrayPinnedHandle.AddrOfPinnedObject(),
94 maxUpdates, m_updateArrayPinnedHandle.AddrOfPinnedObject(), 179 maxUpdates, m_updateArrayPinnedHandle.AddrOfPinnedObject(),
95 m_DebugLogCallbackHandle)); 180 m_DebugLogCallbackHandle));
@@ -111,22 +196,26 @@ private void BulletLoggerPhysLog(string msg)
111public override int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep, 196public override int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep,
112 out int updatedEntityCount, out int collidersCount) 197 out int updatedEntityCount, out int collidersCount)
113{ 198{
114 return BSAPICPP.PhysicsStep2(world.ptr, timeStep, maxSubSteps, fixedTimeStep, out updatedEntityCount, out collidersCount); 199 BulletWorldUnman worldu = world as BulletWorldUnman;
200 return BSAPICPP.PhysicsStep2(worldu.ptr, timeStep, maxSubSteps, fixedTimeStep, out updatedEntityCount, out collidersCount);
115} 201}
116 202
117public override void Shutdown(BulletWorld sim) 203public override void Shutdown(BulletWorld world)
118{ 204{
119 BSAPICPP.Shutdown2(sim.ptr); 205 BulletWorldUnman worldu = world as BulletWorldUnman;
206 BSAPICPP.Shutdown2(worldu.ptr);
120} 207}
121 208
122public override bool PushUpdate(BulletBody obj) 209public override bool PushUpdate(BulletBody obj)
123{ 210{
124 return BSAPICPP.PushUpdate2(obj.ptr); 211 BulletBodyUnman bodyu = obj as BulletBodyUnman;
212 return BSAPICPP.PushUpdate2(bodyu.ptr);
125} 213}
126 214
127public override bool UpdateParameter(BulletWorld world, uint localID, String parm, float value) 215public override bool UpdateParameter(BulletWorld world, uint localID, String parm, float value)
128{ 216{
129 return BSAPICPP.UpdateParameter2(world.ptr, localID, parm, value); 217 BulletWorldUnman worldu = world as BulletWorldUnman;
218 return BSAPICPP.UpdateParameter2(worldu.ptr, localID, parm, value);
130} 219}
131 220
132// ===================================================================================== 221// =====================================================================================
@@ -135,138 +224,165 @@ public override BulletShape CreateMeshShape(BulletWorld world,
135 int indicesCount, int[] indices, 224 int indicesCount, int[] indices,
136 int verticesCount, float[] vertices) 225 int verticesCount, float[] vertices)
137{ 226{
138 return new BulletShape( 227 BulletWorldUnman worldu = world as BulletWorldUnman;
139 BSAPICPP.CreateMeshShape2(world.ptr, indicesCount, indices, verticesCount, vertices), 228 return new BulletShapeUnman(
229 BSAPICPP.CreateMeshShape2(worldu.ptr, indicesCount, indices, verticesCount, vertices),
140 BSPhysicsShapeType.SHAPE_MESH); 230 BSPhysicsShapeType.SHAPE_MESH);
141} 231}
142 232
143public override BulletShape CreateHullShape(BulletWorld world, int hullCount, float[] hulls) 233public override BulletShape CreateHullShape(BulletWorld world, int hullCount, float[] hulls)
144{ 234{
145 return new BulletShape( 235 BulletWorldUnman worldu = world as BulletWorldUnman;
146 BSAPICPP.CreateHullShape2(world.ptr, hullCount, hulls), 236 return new BulletShapeUnman(
237 BSAPICPP.CreateHullShape2(worldu.ptr, hullCount, hulls),
147 BSPhysicsShapeType.SHAPE_HULL); 238 BSPhysicsShapeType.SHAPE_HULL);
148} 239}
149 240
150public override BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape) 241public override BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape)
151{ 242{
152 return new BulletShape( 243 BulletWorldUnman worldu = world as BulletWorldUnman;
153 BSAPICPP.BuildHullShapeFromMesh2(world.ptr, meshShape.ptr), 244 BulletShapeUnman shapeu = meshShape as BulletShapeUnman;
245 return new BulletShapeUnman(
246 BSAPICPP.BuildHullShapeFromMesh2(worldu.ptr, shapeu.ptr),
154 BSPhysicsShapeType.SHAPE_HULL); 247 BSPhysicsShapeType.SHAPE_HULL);
155} 248}
156 249
157public override BulletShape BuildNativeShape( BulletWorld world, ShapeData shapeData) 250public override BulletShape BuildNativeShape(BulletWorld world, ShapeData shapeData)
158{ 251{
159 return new BulletShape( 252 BulletWorldUnman worldu = world as BulletWorldUnman;
160 BSAPICPP.BuildNativeShape2(world.ptr, shapeData), 253 return new BulletShapeUnman(BSAPICPP.BuildNativeShape2(worldu.ptr, shapeData), shapeData.Type);
161 shapeData.Type);
162} 254}
163 255
164public override bool IsNativeShape(BulletShape shape) 256public override bool IsNativeShape(BulletShape shape)
165{ 257{
166 if (shape.HasPhysicalShape) 258 BulletShapeUnman shapeu = shape as BulletShapeUnman;
167 return BSAPICPP.IsNativeShape2(shape.ptr); 259 if (shapeu != null && shapeu.HasPhysicalShape)
260 return BSAPICPP.IsNativeShape2(shapeu.ptr);
168 return false; 261 return false;
169} 262}
170 263
171public override void SetShapeCollisionMargin(BulletShape shape, float margin) 264public override void SetShapeCollisionMargin(BulletShape shape, float margin)
172{ 265{
173 if (shape.HasPhysicalShape) 266 BulletShapeUnman shapeu = shape as BulletShapeUnman;
174 BSAPICPP.SetShapeCollisionMargin2(shape.ptr, margin); 267 if (shapeu != null && shapeu.HasPhysicalShape)
268 BSAPICPP.SetShapeCollisionMargin2(shapeu.ptr, margin);
175} 269}
176 270
177public override BulletShape BuildCapsuleShape(BulletWorld world, float radius, float height, Vector3 scale) 271public override BulletShape BuildCapsuleShape(BulletWorld world, float radius, float height, Vector3 scale)
178{ 272{
179 return new BulletShape( 273 BulletWorldUnman worldu = world as BulletWorldUnman;
180 BSAPICPP.BuildCapsuleShape2(world.ptr, radius, height, scale), 274 return new BulletShapeUnman(
275 BSAPICPP.BuildCapsuleShape2(worldu.ptr, radius, height, scale),
181 BSPhysicsShapeType.SHAPE_CAPSULE); 276 BSPhysicsShapeType.SHAPE_CAPSULE);
182} 277}
183 278
184public override BulletShape CreateCompoundShape(BulletWorld sim, bool enableDynamicAabbTree) 279public override BulletShape CreateCompoundShape(BulletWorld world, bool enableDynamicAabbTree)
185{ 280{
186 return new BulletShape( 281 BulletWorldUnman worldu = world as BulletWorldUnman;
187 BSAPICPP.CreateCompoundShape2(sim.ptr, enableDynamicAabbTree), 282 return new BulletShapeUnman(
283 BSAPICPP.CreateCompoundShape2(worldu.ptr, enableDynamicAabbTree),
188 BSPhysicsShapeType.SHAPE_COMPOUND); 284 BSPhysicsShapeType.SHAPE_COMPOUND);
189 285
190} 286}
191 287
192public override int GetNumberOfCompoundChildren(BulletShape shape) 288public override int GetNumberOfCompoundChildren(BulletShape shape)
193{ 289{
194 if (shape.HasPhysicalShape) 290 BulletShapeUnman shapeu = shape as BulletShapeUnman;
195 return BSAPICPP.GetNumberOfCompoundChildren2(shape.ptr); 291 if (shapeu != null && shapeu.HasPhysicalShape)
292 return BSAPICPP.GetNumberOfCompoundChildren2(shapeu.ptr);
196 return 0; 293 return 0;
197} 294}
198 295
199public override void AddChildShapeToCompoundShape(BulletShape cShape, BulletShape addShape, Vector3 pos, Quaternion rot) 296public override void AddChildShapeToCompoundShape(BulletShape shape, BulletShape addShape, Vector3 pos, Quaternion rot)
200{ 297{
201 BSAPICPP.AddChildShapeToCompoundShape2(cShape.ptr, addShape.ptr, pos, rot); 298 BulletShapeUnman shapeu = shape as BulletShapeUnman;
299 BulletShapeUnman addShapeu = addShape as BulletShapeUnman;
300 BSAPICPP.AddChildShapeToCompoundShape2(shapeu.ptr, addShapeu.ptr, pos, rot);
202} 301}
203 302
204public override BulletShape GetChildShapeFromCompoundShapeIndex(BulletShape cShape, int indx) 303public override BulletShape GetChildShapeFromCompoundShapeIndex(BulletShape shape, int indx)
205{ 304{
206 return new BulletShape(BSAPICPP.GetChildShapeFromCompoundShapeIndex2(cShape.ptr, indx)); 305 BulletShapeUnman shapeu = shape as BulletShapeUnman;
306 return new BulletShapeUnman(BSAPICPP.GetChildShapeFromCompoundShapeIndex2(shapeu.ptr, indx), BSPhysicsShapeType.SHAPE_UNKNOWN);
207} 307}
208 308
209public override BulletShape RemoveChildShapeFromCompoundShapeIndex(BulletShape cShape, int indx) 309public override BulletShape RemoveChildShapeFromCompoundShapeIndex(BulletShape shape, int indx)
210{ 310{
211 return new BulletShape(BSAPICPP.RemoveChildShapeFromCompoundShapeIndex2(cShape.ptr, indx)); 311 BulletShapeUnman shapeu = shape as BulletShapeUnman;
312 return new BulletShapeUnman(BSAPICPP.RemoveChildShapeFromCompoundShapeIndex2(shapeu.ptr, indx), BSPhysicsShapeType.SHAPE_UNKNOWN);
212} 313}
213 314
214public override void RemoveChildShapeFromCompoundShape(BulletShape cShape, BulletShape removeShape) 315public override void RemoveChildShapeFromCompoundShape(BulletShape shape, BulletShape removeShape)
215{ 316{
216 BSAPICPP.RemoveChildShapeFromCompoundShape2(cShape.ptr, removeShape.ptr); 317 BulletShapeUnman shapeu = shape as BulletShapeUnman;
318 BulletShapeUnman removeShapeu = removeShape as BulletShapeUnman;
319 BSAPICPP.RemoveChildShapeFromCompoundShape2(shapeu.ptr, removeShapeu.ptr);
217} 320}
218 321
219public override void RecalculateCompoundShapeLocalAabb(BulletShape cShape) 322public override void RecalculateCompoundShapeLocalAabb(BulletShape shape)
220{ 323{
221 BSAPICPP.RecalculateCompoundShapeLocalAabb2(cShape.ptr); 324 BulletShapeUnman shapeu = shape as BulletShapeUnman;
325 BSAPICPP.RecalculateCompoundShapeLocalAabb2(shapeu.ptr);
222} 326}
223 327
224public override BulletShape DuplicateCollisionShape(BulletWorld sim, BulletShape srcShape, uint id) 328public override BulletShape DuplicateCollisionShape(BulletWorld world, BulletShape srcShape, uint id)
225{ 329{
226 return new BulletShape(BSAPICPP.DuplicateCollisionShape2(sim.ptr, srcShape.ptr, id), srcShape.type); 330 BulletWorldUnman worldu = world as BulletWorldUnman;
331 BulletShapeUnman srcShapeu = srcShape as BulletShapeUnman;
332 return new BulletShapeUnman(BSAPICPP.DuplicateCollisionShape2(worldu.ptr, srcShapeu.ptr, id), srcShape.type);
227} 333}
228 334
229public override bool DeleteCollisionShape(BulletWorld world, BulletShape shape) 335public override bool DeleteCollisionShape(BulletWorld world, BulletShape shape)
230{ 336{
231 return BSAPICPP.DeleteCollisionShape2(world.ptr, shape.ptr); 337 BulletWorldUnman worldu = world as BulletWorldUnman;
338 BulletShapeUnman shapeu = shape as BulletShapeUnman;
339 return BSAPICPP.DeleteCollisionShape2(worldu.ptr, shapeu.ptr);
232} 340}
233 341
234public override int GetBodyType(BulletBody obj) 342public override int GetBodyType(BulletBody obj)
235{ 343{
236 return BSAPICPP.GetBodyType2(obj.ptr); 344 BulletBodyUnman bodyu = obj as BulletBodyUnman;
345 return BSAPICPP.GetBodyType2(bodyu.ptr);
237} 346}
238 347
239public override BulletBody CreateBodyFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot) 348public override BulletBody CreateBodyFromShape(BulletWorld world, BulletShape shape, uint id, Vector3 pos, Quaternion rot)
240{ 349{
241 return new BulletBody(id, BSAPICPP.CreateBodyFromShape2(sim.ptr, shape.ptr, id, pos, rot)); 350 BulletWorldUnman worldu = world as BulletWorldUnman;
351 BulletShapeUnman shapeu = shape as BulletShapeUnman;
352 return new BulletBodyUnman(id, BSAPICPP.CreateBodyFromShape2(worldu.ptr, shapeu.ptr, id, pos, rot));
242} 353}
243 354
244public override BulletBody CreateBodyWithDefaultMotionState(BulletShape shape, uint id, Vector3 pos, Quaternion rot) 355public override BulletBody CreateBodyWithDefaultMotionState(BulletShape shape, uint id, Vector3 pos, Quaternion rot)
245{ 356{
246 return new BulletBody(id, BSAPICPP.CreateBodyWithDefaultMotionState2(shape.ptr, id, pos, rot)); 357 BulletShapeUnman shapeu = shape as BulletShapeUnman;
358 return new BulletBodyUnman(id, BSAPICPP.CreateBodyWithDefaultMotionState2(shapeu.ptr, id, pos, rot));
247} 359}
248 360
249public override BulletBody CreateGhostFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot) 361public override BulletBody CreateGhostFromShape(BulletWorld world, BulletShape shape, uint id, Vector3 pos, Quaternion rot)
250{ 362{
251 return new BulletBody(id, BSAPICPP.CreateGhostFromShape2(sim.ptr, shape.ptr, id, pos, rot)); 363 BulletWorldUnman worldu = world as BulletWorldUnman;
364 BulletShapeUnman shapeu = shape as BulletShapeUnman;
365 return new BulletBodyUnman(id, BSAPICPP.CreateGhostFromShape2(worldu.ptr, shapeu.ptr, id, pos, rot));
252} 366}
253 367
254public override void DestroyObject(BulletWorld sim, BulletBody obj) 368public override void DestroyObject(BulletWorld world, BulletBody obj)
255{ 369{
256 BSAPICPP.DestroyObject2(sim.ptr, obj.ptr); 370 BulletWorldUnman worldu = world as BulletWorldUnman;
371 BulletBodyUnman bodyu = obj as BulletBodyUnman;
372 BSAPICPP.DestroyObject2(worldu.ptr, bodyu.ptr);
257} 373}
258 374
259// ===================================================================================== 375// =====================================================================================
260// Terrain creation and helper routines 376// Terrain creation and helper routines
261public override BulletShape CreateGroundPlaneShape(uint id, float height, float collisionMargin) 377public override BulletShape CreateGroundPlaneShape(uint id, float height, float collisionMargin)
262{ 378{
263 return new BulletShape(BSAPICPP.CreateGroundPlaneShape2(id, height, collisionMargin), BSPhysicsShapeType.SHAPE_GROUNDPLANE); 379 return new BulletShapeUnman(BSAPICPP.CreateGroundPlaneShape2(id, height, collisionMargin), BSPhysicsShapeType.SHAPE_GROUNDPLANE);
264} 380}
265 381
266public override BulletShape CreateTerrainShape(uint id, Vector3 size, float minHeight, float maxHeight, float[] heightMap, 382public override BulletShape CreateTerrainShape(uint id, Vector3 size, float minHeight, float maxHeight, float[] heightMap,
267 float scaleFactor, float collisionMargin) 383 float scaleFactor, float collisionMargin)
268{ 384{
269 return new BulletShape(BSAPICPP.CreateTerrainShape2(id, size, minHeight, maxHeight, heightMap, scaleFactor, collisionMargin), 385 return new BulletShapeUnman(BSAPICPP.CreateTerrainShape2(id, size, minHeight, maxHeight, heightMap, scaleFactor, collisionMargin),
270 BSPhysicsShapeType.SHAPE_TERRAIN); 386 BSPhysicsShapeType.SHAPE_TERRAIN);
271} 387}
272 388
@@ -277,7 +393,10 @@ public override BulletConstraint Create6DofConstraint(BulletWorld world, BulletB
277 Vector3 frame2loc, Quaternion frame2rot, 393 Vector3 frame2loc, Quaternion frame2rot,
278 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) 394 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies)
279{ 395{
280 return new BulletConstraint(BSAPICPP.Create6DofConstraint2(world.ptr, obj1.ptr, obj2.ptr, frame1loc, frame1rot, 396 BulletWorldUnman worldu = world as BulletWorldUnman;
397 BulletBodyUnman bodyu1 = obj1 as BulletBodyUnman;
398 BulletBodyUnman bodyu2 = obj2 as BulletBodyUnman;
399 return new BulletConstraintUnman(BSAPICPP.Create6DofConstraint2(worldu.ptr, bodyu1.ptr, bodyu2.ptr, frame1loc, frame1rot,
281 frame2loc, frame2rot, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies)); 400 frame2loc, frame2rot, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies));
282} 401}
283 402
@@ -285,7 +404,10 @@ public override BulletConstraint Create6DofConstraintToPoint(BulletWorld world,
285 Vector3 joinPoint, 404 Vector3 joinPoint,
286 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) 405 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies)
287{ 406{
288 return new BulletConstraint(BSAPICPP.Create6DofConstraintToPoint2(world.ptr, obj1.ptr, obj2.ptr, 407 BulletWorldUnman worldu = world as BulletWorldUnman;
408 BulletBodyUnman bodyu1 = obj1 as BulletBodyUnman;
409 BulletBodyUnman bodyu2 = obj2 as BulletBodyUnman;
410 return new BulletConstraintUnman(BSAPICPP.Create6DofConstraintToPoint2(worldu.ptr, bodyu1.ptr, bodyu2.ptr,
289 joinPoint, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies)); 411 joinPoint, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies));
290} 412}
291 413
@@ -294,560 +416,687 @@ public override BulletConstraint CreateHingeConstraint(BulletWorld world, Bullet
294 Vector3 axisInA, Vector3 axisInB, 416 Vector3 axisInA, Vector3 axisInB,
295 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) 417 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies)
296{ 418{
297 return new BulletConstraint(BSAPICPP.CreateHingeConstraint2(world.ptr, obj1.ptr, obj2.ptr, 419 BulletWorldUnman worldu = world as BulletWorldUnman;
420 BulletBodyUnman bodyu1 = obj1 as BulletBodyUnman;
421 BulletBodyUnman bodyu2 = obj2 as BulletBodyUnman;
422 return new BulletConstraintUnman(BSAPICPP.CreateHingeConstraint2(worldu.ptr, bodyu1.ptr, bodyu2.ptr,
298 pivotinA, pivotinB, axisInA, axisInB, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies)); 423 pivotinA, pivotinB, axisInA, axisInB, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies));
299} 424}
300 425
301public override void SetConstraintEnable(BulletConstraint constrain, float numericTrueFalse) 426public override void SetConstraintEnable(BulletConstraint constrain, float numericTrueFalse)
302{ 427{
303 BSAPICPP.SetConstraintEnable2(constrain.ptr, numericTrueFalse); 428 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
429 BSAPICPP.SetConstraintEnable2(constrainu.ptr, numericTrueFalse);
304} 430}
305 431
306public override void SetConstraintNumSolverIterations(BulletConstraint constrain, float iterations) 432public override void SetConstraintNumSolverIterations(BulletConstraint constrain, float iterations)
307{ 433{
308 BSAPICPP.SetConstraintNumSolverIterations2(constrain.ptr, iterations); 434 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
435 BSAPICPP.SetConstraintNumSolverIterations2(constrainu.ptr, iterations);
309} 436}
310 437
311public override bool SetFrames(BulletConstraint constrain, 438public override bool SetFrames(BulletConstraint constrain,
312 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot) 439 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot)
313{ 440{
314 return BSAPICPP.SetFrames2(constrain.ptr, frameA, frameArot, frameB, frameBrot); 441 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
442 return BSAPICPP.SetFrames2(constrainu.ptr, frameA, frameArot, frameB, frameBrot);
315} 443}
316 444
317public override bool SetLinearLimits(BulletConstraint constrain, Vector3 low, Vector3 hi) 445public override bool SetLinearLimits(BulletConstraint constrain, Vector3 low, Vector3 hi)
318{ 446{
319 return BSAPICPP.SetLinearLimits2(constrain.ptr, low, hi); 447 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
448 return BSAPICPP.SetLinearLimits2(constrainu.ptr, low, hi);
320} 449}
321 450
322public override bool SetAngularLimits(BulletConstraint constrain, Vector3 low, Vector3 hi) 451public override bool SetAngularLimits(BulletConstraint constrain, Vector3 low, Vector3 hi)
323{ 452{
324 return BSAPICPP.SetAngularLimits2(constrain.ptr, low, hi); 453 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
454 return BSAPICPP.SetAngularLimits2(constrainu.ptr, low, hi);
325} 455}
326 456
327public override bool UseFrameOffset(BulletConstraint constrain, float enable) 457public override bool UseFrameOffset(BulletConstraint constrain, float enable)
328{ 458{
329 return BSAPICPP.UseFrameOffset2(constrain.ptr, enable); 459 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
460 return BSAPICPP.UseFrameOffset2(constrainu.ptr, enable);
330} 461}
331 462
332public override bool TranslationalLimitMotor(BulletConstraint constrain, float enable, float targetVel, float maxMotorForce) 463public override bool TranslationalLimitMotor(BulletConstraint constrain, float enable, float targetVel, float maxMotorForce)
333{ 464{
334 return BSAPICPP.TranslationalLimitMotor2(constrain.ptr, enable, targetVel, maxMotorForce); 465 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
466 return BSAPICPP.TranslationalLimitMotor2(constrainu.ptr, enable, targetVel, maxMotorForce);
335} 467}
336 468
337public override bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold) 469public override bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold)
338{ 470{
339 return BSAPICPP.SetBreakingImpulseThreshold2(constrain.ptr, threshold); 471 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
472 return BSAPICPP.SetBreakingImpulseThreshold2(constrainu.ptr, threshold);
340} 473}
341 474
342public override bool CalculateTransforms(BulletConstraint constrain) 475public override bool CalculateTransforms(BulletConstraint constrain)
343{ 476{
344 return BSAPICPP.CalculateTransforms2(constrain.ptr); 477 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
478 return BSAPICPP.CalculateTransforms2(constrainu.ptr);
345} 479}
346 480
347public override bool SetConstraintParam(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis) 481public override bool SetConstraintParam(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis)
348{ 482{
349 return BSAPICPP.SetConstraintParam2(constrain.ptr, paramIndex, value, axis); 483 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
484 return BSAPICPP.SetConstraintParam2(constrainu.ptr, paramIndex, value, axis);
350} 485}
351 486
352public override bool DestroyConstraint(BulletWorld world, BulletConstraint constrain) 487public override bool DestroyConstraint(BulletWorld world, BulletConstraint constrain)
353{ 488{
354 return BSAPICPP.DestroyConstraint2(world.ptr, constrain.ptr); 489 BulletWorldUnman worldu = world as BulletWorldUnman;
490 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
491 return BSAPICPP.DestroyConstraint2(worldu.ptr, constrainu.ptr);
355} 492}
356 493
357// ===================================================================================== 494// =====================================================================================
358// btCollisionWorld entries 495// btCollisionWorld entries
359public override void UpdateSingleAabb(BulletWorld world, BulletBody obj) 496public override void UpdateSingleAabb(BulletWorld world, BulletBody obj)
360{ 497{
361 BSAPICPP.UpdateSingleAabb2(world.ptr, obj.ptr); 498 BulletWorldUnman worldu = world as BulletWorldUnman;
499 BulletBodyUnman bodyu = obj as BulletBodyUnman;
500 BSAPICPP.UpdateSingleAabb2(worldu.ptr, bodyu.ptr);
362} 501}
363 502
364public override void UpdateAabbs(BulletWorld world) 503public override void UpdateAabbs(BulletWorld world)
365{ 504{
366 BSAPICPP.UpdateAabbs2(world.ptr); 505 BulletWorldUnman worldu = world as BulletWorldUnman;
506 BSAPICPP.UpdateAabbs2(worldu.ptr);
367} 507}
368 508
369public override bool GetForceUpdateAllAabbs(BulletWorld world) 509public override bool GetForceUpdateAllAabbs(BulletWorld world)
370{ 510{
371 return BSAPICPP.GetForceUpdateAllAabbs2(world.ptr); 511 BulletWorldUnman worldu = world as BulletWorldUnman;
512 return BSAPICPP.GetForceUpdateAllAabbs2(worldu.ptr);
372} 513}
373 514
374public override void SetForceUpdateAllAabbs(BulletWorld world, bool force) 515public override void SetForceUpdateAllAabbs(BulletWorld world, bool force)
375{ 516{
376 BSAPICPP.SetForceUpdateAllAabbs2(world.ptr, force); 517 BulletWorldUnman worldu = world as BulletWorldUnman;
518 BSAPICPP.SetForceUpdateAllAabbs2(worldu.ptr, force);
377} 519}
378 520
379// ===================================================================================== 521// =====================================================================================
380// btDynamicsWorld entries 522// btDynamicsWorld entries
381public override bool AddObjectToWorld(BulletWorld world, BulletBody obj) 523public override bool AddObjectToWorld(BulletWorld world, BulletBody obj)
382{ 524{
383 return BSAPICPP.AddObjectToWorld2(world.ptr, obj.ptr); 525 BulletWorldUnman worldu = world as BulletWorldUnman;
526 BulletBodyUnman bodyu = obj as BulletBodyUnman;
527 return BSAPICPP.AddObjectToWorld2(worldu.ptr, bodyu.ptr);
384} 528}
385 529
386public override bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj) 530public override bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj)
387{ 531{
388 return BSAPICPP.RemoveObjectFromWorld2(world.ptr, obj.ptr); 532 BulletWorldUnman worldu = world as BulletWorldUnman;
533 BulletBodyUnman bodyu = obj as BulletBodyUnman;
534 return BSAPICPP.RemoveObjectFromWorld2(worldu.ptr, bodyu.ptr);
389} 535}
390 536
391public override bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects) 537public override bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects)
392{ 538{
393 return BSAPICPP.AddConstraintToWorld2(world.ptr, constrain.ptr, disableCollisionsBetweenLinkedObjects); 539 BulletWorldUnman worldu = world as BulletWorldUnman;
540 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
541 return BSAPICPP.AddConstraintToWorld2(worldu.ptr, constrainu.ptr, disableCollisionsBetweenLinkedObjects);
394} 542}
395 543
396public override bool RemoveConstraintFromWorld(BulletWorld world, BulletConstraint constrain) 544public override bool RemoveConstraintFromWorld(BulletWorld world, BulletConstraint constrain)
397{ 545{
398 return BSAPICPP.RemoveConstraintFromWorld2(world.ptr, constrain.ptr); 546 BulletWorldUnman worldu = world as BulletWorldUnman;
547 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
548 return BSAPICPP.RemoveConstraintFromWorld2(worldu.ptr, constrainu.ptr);
399} 549}
400// ===================================================================================== 550// =====================================================================================
401// btCollisionObject entries 551// btCollisionObject entries
402public override Vector3 GetAnisotripicFriction(BulletConstraint constrain) 552public override Vector3 GetAnisotripicFriction(BulletConstraint constrain)
403{ 553{
404 return BSAPICPP.GetAnisotripicFriction2(constrain.ptr); 554 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
555 return BSAPICPP.GetAnisotripicFriction2(constrainu.ptr);
405} 556}
406 557
407public override Vector3 SetAnisotripicFriction(BulletConstraint constrain, Vector3 frict) 558public override Vector3 SetAnisotripicFriction(BulletConstraint constrain, Vector3 frict)
408{ 559{
409 return BSAPICPP.SetAnisotripicFriction2(constrain.ptr, frict); 560 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
561 return BSAPICPP.SetAnisotripicFriction2(constrainu.ptr, frict);
410} 562}
411 563
412public override bool HasAnisotripicFriction(BulletConstraint constrain) 564public override bool HasAnisotripicFriction(BulletConstraint constrain)
413{ 565{
414 return BSAPICPP.HasAnisotripicFriction2(constrain.ptr); 566 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
567 return BSAPICPP.HasAnisotripicFriction2(constrainu.ptr);
415} 568}
416 569
417public override void SetContactProcessingThreshold(BulletBody obj, float val) 570public override void SetContactProcessingThreshold(BulletBody obj, float val)
418{ 571{
419 BSAPICPP.SetContactProcessingThreshold2(obj.ptr, val); 572 BulletBodyUnman bodyu = obj as BulletBodyUnman;
573 BSAPICPP.SetContactProcessingThreshold2(bodyu.ptr, val);
420} 574}
421 575
422public override float GetContactProcessingThreshold(BulletBody obj) 576public override float GetContactProcessingThreshold(BulletBody obj)
423{ 577{
424 return BSAPICPP.GetContactProcessingThreshold2(obj.ptr); 578 BulletBodyUnman bodyu = obj as BulletBodyUnman;
579 return BSAPICPP.GetContactProcessingThreshold2(bodyu.ptr);
425} 580}
426 581
427public override bool IsStaticObject(BulletBody obj) 582public override bool IsStaticObject(BulletBody obj)
428{ 583{
429 return BSAPICPP.IsStaticObject2(obj.ptr); 584 BulletBodyUnman bodyu = obj as BulletBodyUnman;
585 return BSAPICPP.IsStaticObject2(bodyu.ptr);
430} 586}
431 587
432public override bool IsKinematicObject(BulletBody obj) 588public override bool IsKinematicObject(BulletBody obj)
433{ 589{
434 return BSAPICPP.IsKinematicObject2(obj.ptr); 590 BulletBodyUnman bodyu = obj as BulletBodyUnman;
591 return BSAPICPP.IsKinematicObject2(bodyu.ptr);
435} 592}
436 593
437public override bool IsStaticOrKinematicObject(BulletBody obj) 594public override bool IsStaticOrKinematicObject(BulletBody obj)
438{ 595{
439 return BSAPICPP.IsStaticOrKinematicObject2(obj.ptr); 596 BulletBodyUnman bodyu = obj as BulletBodyUnman;
597 return BSAPICPP.IsStaticOrKinematicObject2(bodyu.ptr);
440} 598}
441 599
442public override bool HasContactResponse(BulletBody obj) 600public override bool HasContactResponse(BulletBody obj)
443{ 601{
444 return BSAPICPP.HasContactResponse2(obj.ptr); 602 BulletBodyUnman bodyu = obj as BulletBodyUnman;
603 return BSAPICPP.HasContactResponse2(bodyu.ptr);
445} 604}
446 605
447public override void SetCollisionShape(BulletWorld sim, BulletBody obj, BulletShape shape) 606public override void SetCollisionShape(BulletWorld world, BulletBody obj, BulletShape shape)
448{ 607{
449 BSAPICPP.SetCollisionShape2(sim.ptr, obj.ptr, shape.ptr); 608 BulletWorldUnman worldu = world as BulletWorldUnman;
609 BulletBodyUnman bodyu = obj as BulletBodyUnman;
610 BulletShapeUnman shapeu = shape as BulletShapeUnman;
611 if (worldu != null && bodyu != null)
612 {
613 // Special case to allow the caller to zero out the reference to any physical shape
614 if (shapeu != null)
615 BSAPICPP.SetCollisionShape2(worldu.ptr, bodyu.ptr, shapeu.ptr);
616 else
617 BSAPICPP.SetCollisionShape2(worldu.ptr, bodyu.ptr, IntPtr.Zero);
618 }
450} 619}
451 620
452public override BulletShape GetCollisionShape(BulletBody obj) 621public override BulletShape GetCollisionShape(BulletBody obj)
453{ 622{
454 return new BulletShape(BSAPICPP.GetCollisionShape2(obj.ptr)); 623 BulletBodyUnman bodyu = obj as BulletBodyUnman;
624 return new BulletShapeUnman(BSAPICPP.GetCollisionShape2(bodyu.ptr), BSPhysicsShapeType.SHAPE_UNKNOWN);
455} 625}
456 626
457public override int GetActivationState(BulletBody obj) 627public override int GetActivationState(BulletBody obj)
458{ 628{
459 return BSAPICPP.GetActivationState2(obj.ptr); 629 BulletBodyUnman bodyu = obj as BulletBodyUnman;
630 return BSAPICPP.GetActivationState2(bodyu.ptr);
460} 631}
461 632
462public override void SetActivationState(BulletBody obj, int state) 633public override void SetActivationState(BulletBody obj, int state)
463{ 634{
464 BSAPICPP.SetActivationState2(obj.ptr, state); 635 BulletBodyUnman bodyu = obj as BulletBodyUnman;
636 BSAPICPP.SetActivationState2(bodyu.ptr, state);
465} 637}
466 638
467public override void SetDeactivationTime(BulletBody obj, float dtime) 639public override void SetDeactivationTime(BulletBody obj, float dtime)
468{ 640{
469 BSAPICPP.SetDeactivationTime2(obj.ptr, dtime); 641 BulletBodyUnman bodyu = obj as BulletBodyUnman;
642 BSAPICPP.SetDeactivationTime2(bodyu.ptr, dtime);
470} 643}
471 644
472public override float GetDeactivationTime(BulletBody obj) 645public override float GetDeactivationTime(BulletBody obj)
473{ 646{
474 return BSAPICPP.GetDeactivationTime2(obj.ptr); 647 BulletBodyUnman bodyu = obj as BulletBodyUnman;
648 return BSAPICPP.GetDeactivationTime2(bodyu.ptr);
475} 649}
476 650
477public override void ForceActivationState(BulletBody obj, ActivationState state) 651public override void ForceActivationState(BulletBody obj, ActivationState state)
478{ 652{
479 BSAPICPP.ForceActivationState2(obj.ptr, state); 653 BulletBodyUnman bodyu = obj as BulletBodyUnman;
654 BSAPICPP.ForceActivationState2(bodyu.ptr, state);
480} 655}
481 656
482public override void Activate(BulletBody obj, bool forceActivation) 657public override void Activate(BulletBody obj, bool forceActivation)
483{ 658{
484 BSAPICPP.Activate2(obj.ptr, forceActivation); 659 BulletBodyUnman bodyu = obj as BulletBodyUnman;
660 BSAPICPP.Activate2(bodyu.ptr, forceActivation);
485} 661}
486 662
487public override bool IsActive(BulletBody obj) 663public override bool IsActive(BulletBody obj)
488{ 664{
489 return BSAPICPP.IsActive2(obj.ptr); 665 BulletBodyUnman bodyu = obj as BulletBodyUnman;
666 return BSAPICPP.IsActive2(bodyu.ptr);
490} 667}
491 668
492public override void SetRestitution(BulletBody obj, float val) 669public override void SetRestitution(BulletBody obj, float val)
493{ 670{
494 BSAPICPP.SetRestitution2(obj.ptr, val); 671 BulletBodyUnman bodyu = obj as BulletBodyUnman;
672 BSAPICPP.SetRestitution2(bodyu.ptr, val);
495} 673}
496 674
497public override float GetRestitution(BulletBody obj) 675public override float GetRestitution(BulletBody obj)
498{ 676{
499 return BSAPICPP.GetRestitution2(obj.ptr); 677 BulletBodyUnman bodyu = obj as BulletBodyUnman;
678 return BSAPICPP.GetRestitution2(bodyu.ptr);
500} 679}
501 680
502public override void SetFriction(BulletBody obj, float val) 681public override void SetFriction(BulletBody obj, float val)
503{ 682{
504 BSAPICPP.SetFriction2(obj.ptr, val); 683 BulletBodyUnman bodyu = obj as BulletBodyUnman;
684 BSAPICPP.SetFriction2(bodyu.ptr, val);
505} 685}
506 686
507public override float GetFriction(BulletBody obj) 687public override float GetFriction(BulletBody obj)
508{ 688{
509 return BSAPICPP.GetFriction2(obj.ptr); 689 BulletBodyUnman bodyu = obj as BulletBodyUnman;
690 return BSAPICPP.GetFriction2(bodyu.ptr);
510} 691}
511 692
512public override Vector3 GetPosition(BulletBody obj) 693public override Vector3 GetPosition(BulletBody obj)
513{ 694{
514 return BSAPICPP.GetPosition2(obj.ptr); 695 BulletBodyUnman bodyu = obj as BulletBodyUnman;
696 return BSAPICPP.GetPosition2(bodyu.ptr);
515} 697}
516 698
517public override Quaternion GetOrientation(BulletBody obj) 699public override Quaternion GetOrientation(BulletBody obj)
518{ 700{
519 return BSAPICPP.GetOrientation2(obj.ptr); 701 BulletBodyUnman bodyu = obj as BulletBodyUnman;
702 return BSAPICPP.GetOrientation2(bodyu.ptr);
520} 703}
521 704
522public override void SetTranslation(BulletBody obj, Vector3 position, Quaternion rotation) 705public override void SetTranslation(BulletBody obj, Vector3 position, Quaternion rotation)
523{ 706{
524 BSAPICPP.SetTranslation2(obj.ptr, position, rotation); 707 BulletBodyUnman bodyu = obj as BulletBodyUnman;
708 BSAPICPP.SetTranslation2(bodyu.ptr, position, rotation);
525} 709}
526 710
527 /* 711 /*
528public override IntPtr GetBroadphaseHandle(BulletBody obj) 712public override IntPtr GetBroadphaseHandle(BulletBody obj)
529{ 713{
530 return BSAPICPP.GetBroadphaseHandle2(obj.ptr); 714 BulletBodyUnman bodyu = obj as BulletBodyUnman;
715 return BSAPICPP.GetBroadphaseHandle2(bodyu.ptr);
531} 716}
532 717
533public override void SetBroadphaseHandle(BulletBody obj, IntPtr handle) 718public override void SetBroadphaseHandle(BulletBody obj, IntPtr handle)
534{ 719{
535 BSAPICPP.SetUserPointer2(obj.ptr, handle); 720 BulletBodyUnman bodyu = obj as BulletBodyUnman;
721 BSAPICPP.SetUserPointer2(bodyu.ptr, handle);
536} 722}
537 */ 723 */
538 724
539public override void SetInterpolationLinearVelocity(BulletBody obj, Vector3 vel) 725public override void SetInterpolationLinearVelocity(BulletBody obj, Vector3 vel)
540{ 726{
541 BSAPICPP.SetInterpolationLinearVelocity2(obj.ptr, vel); 727 BulletBodyUnman bodyu = obj as BulletBodyUnman;
728 BSAPICPP.SetInterpolationLinearVelocity2(bodyu.ptr, vel);
542} 729}
543 730
544public override void SetInterpolationAngularVelocity(BulletBody obj, Vector3 vel) 731public override void SetInterpolationAngularVelocity(BulletBody obj, Vector3 vel)
545{ 732{
546 BSAPICPP.SetInterpolationAngularVelocity2(obj.ptr, vel); 733 BulletBodyUnman bodyu = obj as BulletBodyUnman;
734 BSAPICPP.SetInterpolationAngularVelocity2(bodyu.ptr, vel);
547} 735}
548 736
549public override void SetInterpolationVelocity(BulletBody obj, Vector3 linearVel, Vector3 angularVel) 737public override void SetInterpolationVelocity(BulletBody obj, Vector3 linearVel, Vector3 angularVel)
550{ 738{
551 BSAPICPP.SetInterpolationVelocity2(obj.ptr, linearVel, angularVel); 739 BulletBodyUnman bodyu = obj as BulletBodyUnman;
740 BSAPICPP.SetInterpolationVelocity2(bodyu.ptr, linearVel, angularVel);
552} 741}
553 742
554public override float GetHitFraction(BulletBody obj) 743public override float GetHitFraction(BulletBody obj)
555{ 744{
556 return BSAPICPP.GetHitFraction2(obj.ptr); 745 BulletBodyUnman bodyu = obj as BulletBodyUnman;
746 return BSAPICPP.GetHitFraction2(bodyu.ptr);
557} 747}
558 748
559public override void SetHitFraction(BulletBody obj, float val) 749public override void SetHitFraction(BulletBody obj, float val)
560{ 750{
561 BSAPICPP.SetHitFraction2(obj.ptr, val); 751 BulletBodyUnman bodyu = obj as BulletBodyUnman;
752 BSAPICPP.SetHitFraction2(bodyu.ptr, val);
562} 753}
563 754
564public override CollisionFlags GetCollisionFlags(BulletBody obj) 755public override CollisionFlags GetCollisionFlags(BulletBody obj)
565{ 756{
566 return BSAPICPP.GetCollisionFlags2(obj.ptr); 757 BulletBodyUnman bodyu = obj as BulletBodyUnman;
758 return BSAPICPP.GetCollisionFlags2(bodyu.ptr);
567} 759}
568 760
569public override CollisionFlags SetCollisionFlags(BulletBody obj, CollisionFlags flags) 761public override CollisionFlags SetCollisionFlags(BulletBody obj, CollisionFlags flags)
570{ 762{
571 return BSAPICPP.SetCollisionFlags2(obj.ptr, flags); 763 BulletBodyUnman bodyu = obj as BulletBodyUnman;
764 return BSAPICPP.SetCollisionFlags2(bodyu.ptr, flags);
572} 765}
573 766
574public override CollisionFlags AddToCollisionFlags(BulletBody obj, CollisionFlags flags) 767public override CollisionFlags AddToCollisionFlags(BulletBody obj, CollisionFlags flags)
575{ 768{
576 return BSAPICPP.AddToCollisionFlags2(obj.ptr, flags); 769 BulletBodyUnman bodyu = obj as BulletBodyUnman;
770 return BSAPICPP.AddToCollisionFlags2(bodyu.ptr, flags);
577} 771}
578 772
579public override CollisionFlags RemoveFromCollisionFlags(BulletBody obj, CollisionFlags flags) 773public override CollisionFlags RemoveFromCollisionFlags(BulletBody obj, CollisionFlags flags)
580{ 774{
581 return BSAPICPP.RemoveFromCollisionFlags2(obj.ptr, flags); 775 BulletBodyUnman bodyu = obj as BulletBodyUnman;
776 return BSAPICPP.RemoveFromCollisionFlags2(bodyu.ptr, flags);
582} 777}
583 778
584public override float GetCcdMotionThreshold(BulletBody obj) 779public override float GetCcdMotionThreshold(BulletBody obj)
585{ 780{
586 return BSAPICPP.GetCcdMotionThreshold2(obj.ptr); 781 BulletBodyUnman bodyu = obj as BulletBodyUnman;
782 return BSAPICPP.GetCcdMotionThreshold2(bodyu.ptr);
587} 783}
588 784
589 785
590public override void SetCcdMotionThreshold(BulletBody obj, float val) 786public override void SetCcdMotionThreshold(BulletBody obj, float val)
591{ 787{
592 BSAPICPP.SetCcdMotionThreshold2(obj.ptr, val); 788 BulletBodyUnman bodyu = obj as BulletBodyUnman;
789 BSAPICPP.SetCcdMotionThreshold2(bodyu.ptr, val);
593} 790}
594 791
595public override float GetCcdSweptSphereRadius(BulletBody obj) 792public override float GetCcdSweptSphereRadius(BulletBody obj)
596{ 793{
597 return BSAPICPP.GetCcdSweptSphereRadius2(obj.ptr); 794 BulletBodyUnman bodyu = obj as BulletBodyUnman;
795 return BSAPICPP.GetCcdSweptSphereRadius2(bodyu.ptr);
598} 796}
599 797
600public override void SetCcdSweptSphereRadius(BulletBody obj, float val) 798public override void SetCcdSweptSphereRadius(BulletBody obj, float val)
601{ 799{
602 BSAPICPP.SetCcdSweptSphereRadius2(obj.ptr, val); 800 BulletBodyUnman bodyu = obj as BulletBodyUnman;
801 BSAPICPP.SetCcdSweptSphereRadius2(bodyu.ptr, val);
603} 802}
604 803
605public override IntPtr GetUserPointer(BulletBody obj) 804public override IntPtr GetUserPointer(BulletBody obj)
606{ 805{
607 return BSAPICPP.GetUserPointer2(obj.ptr); 806 BulletBodyUnman bodyu = obj as BulletBodyUnman;
807 return BSAPICPP.GetUserPointer2(bodyu.ptr);
608} 808}
609 809
610public override void SetUserPointer(BulletBody obj, IntPtr val) 810public override void SetUserPointer(BulletBody obj, IntPtr val)
611{ 811{
612 BSAPICPP.SetUserPointer2(obj.ptr, val); 812 BulletBodyUnman bodyu = obj as BulletBodyUnman;
813 BSAPICPP.SetUserPointer2(bodyu.ptr, val);
613} 814}
614 815
615// ===================================================================================== 816// =====================================================================================
616// btRigidBody entries 817// btRigidBody entries
617public override void ApplyGravity(BulletBody obj) 818public override void ApplyGravity(BulletBody obj)
618{ 819{
619 BSAPICPP.ApplyGravity2(obj.ptr); 820 BulletBodyUnman bodyu = obj as BulletBodyUnman;
821 BSAPICPP.ApplyGravity2(bodyu.ptr);
620} 822}
621 823
622public override void SetGravity(BulletBody obj, Vector3 val) 824public override void SetGravity(BulletBody obj, Vector3 val)
623{ 825{
624 BSAPICPP.SetGravity2(obj.ptr, val); 826 BulletBodyUnman bodyu = obj as BulletBodyUnman;
827 BSAPICPP.SetGravity2(bodyu.ptr, val);
625} 828}
626 829
627public override Vector3 GetGravity(BulletBody obj) 830public override Vector3 GetGravity(BulletBody obj)
628{ 831{
629 return BSAPICPP.GetGravity2(obj.ptr); 832 BulletBodyUnman bodyu = obj as BulletBodyUnman;
833 return BSAPICPP.GetGravity2(bodyu.ptr);
630} 834}
631 835
632public override void SetDamping(BulletBody obj, float lin_damping, float ang_damping) 836public override void SetDamping(BulletBody obj, float lin_damping, float ang_damping)
633{ 837{
634 BSAPICPP.SetDamping2(obj.ptr, lin_damping, ang_damping); 838 BulletBodyUnman bodyu = obj as BulletBodyUnman;
839 BSAPICPP.SetDamping2(bodyu.ptr, lin_damping, ang_damping);
635} 840}
636 841
637public override void SetLinearDamping(BulletBody obj, float lin_damping) 842public override void SetLinearDamping(BulletBody obj, float lin_damping)
638{ 843{
639 BSAPICPP.SetLinearDamping2(obj.ptr, lin_damping); 844 BulletBodyUnman bodyu = obj as BulletBodyUnman;
845 BSAPICPP.SetLinearDamping2(bodyu.ptr, lin_damping);
640} 846}
641 847
642public override void SetAngularDamping(BulletBody obj, float ang_damping) 848public override void SetAngularDamping(BulletBody obj, float ang_damping)
643{ 849{
644 BSAPICPP.SetAngularDamping2(obj.ptr, ang_damping); 850 BulletBodyUnman bodyu = obj as BulletBodyUnman;
851 BSAPICPP.SetAngularDamping2(bodyu.ptr, ang_damping);
645} 852}
646 853
647public override float GetLinearDamping(BulletBody obj) 854public override float GetLinearDamping(BulletBody obj)
648{ 855{
649 return BSAPICPP.GetLinearDamping2(obj.ptr); 856 BulletBodyUnman bodyu = obj as BulletBodyUnman;
857 return BSAPICPP.GetLinearDamping2(bodyu.ptr);
650} 858}
651 859
652public override float GetAngularDamping(BulletBody obj) 860public override float GetAngularDamping(BulletBody obj)
653{ 861{
654 return BSAPICPP.GetAngularDamping2(obj.ptr); 862 BulletBodyUnman bodyu = obj as BulletBodyUnman;
863 return BSAPICPP.GetAngularDamping2(bodyu.ptr);
655} 864}
656 865
657public override float GetLinearSleepingThreshold(BulletBody obj) 866public override float GetLinearSleepingThreshold(BulletBody obj)
658{ 867{
659 return BSAPICPP.GetLinearSleepingThreshold2(obj.ptr); 868 BulletBodyUnman bodyu = obj as BulletBodyUnman;
869 return BSAPICPP.GetLinearSleepingThreshold2(bodyu.ptr);
660} 870}
661 871
662public override void ApplyDamping(BulletBody obj, float timeStep) 872public override void ApplyDamping(BulletBody obj, float timeStep)
663{ 873{
664 BSAPICPP.ApplyDamping2(obj.ptr, timeStep); 874 BulletBodyUnman bodyu = obj as BulletBodyUnman;
875 BSAPICPP.ApplyDamping2(bodyu.ptr, timeStep);
665} 876}
666 877
667public override void SetMassProps(BulletBody obj, float mass, Vector3 inertia) 878public override void SetMassProps(BulletBody obj, float mass, Vector3 inertia)
668{ 879{
669 BSAPICPP.SetMassProps2(obj.ptr, mass, inertia); 880 BulletBodyUnman bodyu = obj as BulletBodyUnman;
881 BSAPICPP.SetMassProps2(bodyu.ptr, mass, inertia);
670} 882}
671 883
672public override Vector3 GetLinearFactor(BulletBody obj) 884public override Vector3 GetLinearFactor(BulletBody obj)
673{ 885{
674 return BSAPICPP.GetLinearFactor2(obj.ptr); 886 BulletBodyUnman bodyu = obj as BulletBodyUnman;
887 return BSAPICPP.GetLinearFactor2(bodyu.ptr);
675} 888}
676 889
677public override void SetLinearFactor(BulletBody obj, Vector3 factor) 890public override void SetLinearFactor(BulletBody obj, Vector3 factor)
678{ 891{
679 BSAPICPP.SetLinearFactor2(obj.ptr, factor); 892 BulletBodyUnman bodyu = obj as BulletBodyUnman;
893 BSAPICPP.SetLinearFactor2(bodyu.ptr, factor);
680} 894}
681 895
682public override void SetCenterOfMassByPosRot(BulletBody obj, Vector3 pos, Quaternion rot) 896public override void SetCenterOfMassByPosRot(BulletBody obj, Vector3 pos, Quaternion rot)
683{ 897{
684 BSAPICPP.SetCenterOfMassByPosRot2(obj.ptr, pos, rot); 898 BulletBodyUnman bodyu = obj as BulletBodyUnman;
899 BSAPICPP.SetCenterOfMassByPosRot2(bodyu.ptr, pos, rot);
685} 900}
686 901
687// Add a force to the object as if its mass is one. 902// Add a force to the object as if its mass is one.
688public override void ApplyCentralForce(BulletBody obj, Vector3 force) 903public override void ApplyCentralForce(BulletBody obj, Vector3 force)
689{ 904{
690 BSAPICPP.ApplyCentralForce2(obj.ptr, force); 905 BulletBodyUnman bodyu = obj as BulletBodyUnman;
906 BSAPICPP.ApplyCentralForce2(bodyu.ptr, force);
691} 907}
692 908
693// Set the force being applied to the object as if its mass is one. 909// Set the force being applied to the object as if its mass is one.
694public override void SetObjectForce(BulletBody obj, Vector3 force) 910public override void SetObjectForce(BulletBody obj, Vector3 force)
695{ 911{
696 BSAPICPP.SetObjectForce2(obj.ptr, force); 912 BulletBodyUnman bodyu = obj as BulletBodyUnman;
913 BSAPICPP.SetObjectForce2(bodyu.ptr, force);
697} 914}
698 915
699public override Vector3 GetTotalForce(BulletBody obj) 916public override Vector3 GetTotalForce(BulletBody obj)
700{ 917{
701 return BSAPICPP.GetTotalForce2(obj.ptr); 918 BulletBodyUnman bodyu = obj as BulletBodyUnman;
919 return BSAPICPP.GetTotalForce2(bodyu.ptr);
702} 920}
703 921
704public override Vector3 GetTotalTorque(BulletBody obj) 922public override Vector3 GetTotalTorque(BulletBody obj)
705{ 923{
706 return BSAPICPP.GetTotalTorque2(obj.ptr); 924 BulletBodyUnman bodyu = obj as BulletBodyUnman;
925 return BSAPICPP.GetTotalTorque2(bodyu.ptr);
707} 926}
708 927
709public override Vector3 GetInvInertiaDiagLocal(BulletBody obj) 928public override Vector3 GetInvInertiaDiagLocal(BulletBody obj)
710{ 929{
711 return BSAPICPP.GetInvInertiaDiagLocal2(obj.ptr); 930 BulletBodyUnman bodyu = obj as BulletBodyUnman;
931 return BSAPICPP.GetInvInertiaDiagLocal2(bodyu.ptr);
712} 932}
713 933
714public override void SetInvInertiaDiagLocal(BulletBody obj, Vector3 inert) 934public override void SetInvInertiaDiagLocal(BulletBody obj, Vector3 inert)
715{ 935{
716 BSAPICPP.SetInvInertiaDiagLocal2(obj.ptr, inert); 936 BulletBodyUnman bodyu = obj as BulletBodyUnman;
937 BSAPICPP.SetInvInertiaDiagLocal2(bodyu.ptr, inert);
717} 938}
718 939
719public override void SetSleepingThresholds(BulletBody obj, float lin_threshold, float ang_threshold) 940public override void SetSleepingThresholds(BulletBody obj, float lin_threshold, float ang_threshold)
720{ 941{
721 BSAPICPP.SetSleepingThresholds2(obj.ptr, lin_threshold, ang_threshold); 942 BulletBodyUnman bodyu = obj as BulletBodyUnman;
943 BSAPICPP.SetSleepingThresholds2(bodyu.ptr, lin_threshold, ang_threshold);
722} 944}
723 945
724public override void ApplyTorque(BulletBody obj, Vector3 torque) 946public override void ApplyTorque(BulletBody obj, Vector3 torque)
725{ 947{
726 BSAPICPP.ApplyTorque2(obj.ptr, torque); 948 BulletBodyUnman bodyu = obj as BulletBodyUnman;
949 BSAPICPP.ApplyTorque2(bodyu.ptr, torque);
727} 950}
728 951
729// Apply force at the given point. Will add torque to the object. 952// Apply force at the given point. Will add torque to the object.
730public override void ApplyForce(BulletBody obj, Vector3 force, Vector3 pos) 953public override void ApplyForce(BulletBody obj, Vector3 force, Vector3 pos)
731{ 954{
732 BSAPICPP.ApplyForce2(obj.ptr, force, pos); 955 BulletBodyUnman bodyu = obj as BulletBodyUnman;
956 BSAPICPP.ApplyForce2(bodyu.ptr, force, pos);
733} 957}
734 958
735// Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass. 959// Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass.
736public override void ApplyCentralImpulse(BulletBody obj, Vector3 imp) 960public override void ApplyCentralImpulse(BulletBody obj, Vector3 imp)
737{ 961{
738 BSAPICPP.ApplyCentralImpulse2(obj.ptr, imp); 962 BulletBodyUnman bodyu = obj as BulletBodyUnman;
963 BSAPICPP.ApplyCentralImpulse2(bodyu.ptr, imp);
739} 964}
740 965
741// Apply impulse to the object's torque. Force is scaled by object's mass. 966// Apply impulse to the object's torque. Force is scaled by object's mass.
742public override void ApplyTorqueImpulse(BulletBody obj, Vector3 imp) 967public override void ApplyTorqueImpulse(BulletBody obj, Vector3 imp)
743{ 968{
744 BSAPICPP.ApplyTorqueImpulse2(obj.ptr, imp); 969 BulletBodyUnman bodyu = obj as BulletBodyUnman;
970 BSAPICPP.ApplyTorqueImpulse2(bodyu.ptr, imp);
745} 971}
746 972
747// Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces. 973// Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces.
748public override void ApplyImpulse(BulletBody obj, Vector3 imp, Vector3 pos) 974public override void ApplyImpulse(BulletBody obj, Vector3 imp, Vector3 pos)
749{ 975{
750 BSAPICPP.ApplyImpulse2(obj.ptr, imp, pos); 976 BulletBodyUnman bodyu = obj as BulletBodyUnman;
977 BSAPICPP.ApplyImpulse2(bodyu.ptr, imp, pos);
751} 978}
752 979
753public override void ClearForces(BulletBody obj) 980public override void ClearForces(BulletBody obj)
754{ 981{
755 BSAPICPP.ClearForces2(obj.ptr); 982 BulletBodyUnman bodyu = obj as BulletBodyUnman;
983 BSAPICPP.ClearForces2(bodyu.ptr);
756} 984}
757 985
758public override void ClearAllForces(BulletBody obj) 986public override void ClearAllForces(BulletBody obj)
759{ 987{
760 BSAPICPP.ClearAllForces2(obj.ptr); 988 BulletBodyUnman bodyu = obj as BulletBodyUnman;
989 BSAPICPP.ClearAllForces2(bodyu.ptr);
761} 990}
762 991
763public override void UpdateInertiaTensor(BulletBody obj) 992public override void UpdateInertiaTensor(BulletBody obj)
764{ 993{
765 BSAPICPP.UpdateInertiaTensor2(obj.ptr); 994 BulletBodyUnman bodyu = obj as BulletBodyUnman;
995 BSAPICPP.UpdateInertiaTensor2(bodyu.ptr);
766} 996}
767 997
768public override Vector3 GetLinearVelocity(BulletBody obj) 998public override Vector3 GetLinearVelocity(BulletBody obj)
769{ 999{
770 return BSAPICPP.GetLinearVelocity2(obj.ptr); 1000 BulletBodyUnman bodyu = obj as BulletBodyUnman;
1001 return BSAPICPP.GetLinearVelocity2(bodyu.ptr);
771} 1002}
772 1003
773public override Vector3 GetAngularVelocity(BulletBody obj) 1004public override Vector3 GetAngularVelocity(BulletBody obj)
774{ 1005{
775 return BSAPICPP.GetAngularVelocity2(obj.ptr); 1006 BulletBodyUnman bodyu = obj as BulletBodyUnman;
1007 return BSAPICPP.GetAngularVelocity2(bodyu.ptr);
776} 1008}
777 1009
778public override void SetLinearVelocity(BulletBody obj, Vector3 vel) 1010public override void SetLinearVelocity(BulletBody obj, Vector3 vel)
779{ 1011{
780 BSAPICPP.SetLinearVelocity2(obj.ptr, vel); 1012 BulletBodyUnman bodyu = obj as BulletBodyUnman;
1013 BSAPICPP.SetLinearVelocity2(bodyu.ptr, vel);
781} 1014}
782 1015
783public override void SetAngularVelocity(BulletBody obj, Vector3 angularVelocity) 1016public override void SetAngularVelocity(BulletBody obj, Vector3 angularVelocity)
784{ 1017{
785 BSAPICPP.SetAngularVelocity2(obj.ptr, angularVelocity); 1018 BulletBodyUnman bodyu = obj as BulletBodyUnman;
1019 BSAPICPP.SetAngularVelocity2(bodyu.ptr, angularVelocity);
786} 1020}
787 1021
788public override Vector3 GetVelocityInLocalPoint(BulletBody obj, Vector3 pos) 1022public override Vector3 GetVelocityInLocalPoint(BulletBody obj, Vector3 pos)
789{ 1023{
790 return BSAPICPP.GetVelocityInLocalPoint2(obj.ptr, pos); 1024 BulletBodyUnman bodyu = obj as BulletBodyUnman;
1025 return BSAPICPP.GetVelocityInLocalPoint2(bodyu.ptr, pos);
791} 1026}
792 1027
793public override void Translate(BulletBody obj, Vector3 trans) 1028public override void Translate(BulletBody obj, Vector3 trans)
794{ 1029{
795 BSAPICPP.Translate2(obj.ptr, trans); 1030 BulletBodyUnman bodyu = obj as BulletBodyUnman;
1031 BSAPICPP.Translate2(bodyu.ptr, trans);
796} 1032}
797 1033
798public override void UpdateDeactivation(BulletBody obj, float timeStep) 1034public override void UpdateDeactivation(BulletBody obj, float timeStep)
799{ 1035{
800 BSAPICPP.UpdateDeactivation2(obj.ptr, timeStep); 1036 BulletBodyUnman bodyu = obj as BulletBodyUnman;
1037 BSAPICPP.UpdateDeactivation2(bodyu.ptr, timeStep);
801} 1038}
802 1039
803public override bool WantsSleeping(BulletBody obj) 1040public override bool WantsSleeping(BulletBody obj)
804{ 1041{
805 return BSAPICPP.WantsSleeping2(obj.ptr); 1042 BulletBodyUnman bodyu = obj as BulletBodyUnman;
1043 return BSAPICPP.WantsSleeping2(bodyu.ptr);
806} 1044}
807 1045
808public override void SetAngularFactor(BulletBody obj, float factor) 1046public override void SetAngularFactor(BulletBody obj, float factor)
809{ 1047{
810 BSAPICPP.SetAngularFactor2(obj.ptr, factor); 1048 BulletBodyUnman bodyu = obj as BulletBodyUnman;
1049 BSAPICPP.SetAngularFactor2(bodyu.ptr, factor);
811} 1050}
812 1051
813public override void SetAngularFactorV(BulletBody obj, Vector3 factor) 1052public override void SetAngularFactorV(BulletBody obj, Vector3 factor)
814{ 1053{
815 BSAPICPP.SetAngularFactorV2(obj.ptr, factor); 1054 BulletBodyUnman bodyu = obj as BulletBodyUnman;
1055 BSAPICPP.SetAngularFactorV2(bodyu.ptr, factor);
816} 1056}
817 1057
818public override Vector3 GetAngularFactor(BulletBody obj) 1058public override Vector3 GetAngularFactor(BulletBody obj)
819{ 1059{
820 return BSAPICPP.GetAngularFactor2(obj.ptr); 1060 BulletBodyUnman bodyu = obj as BulletBodyUnman;
1061 return BSAPICPP.GetAngularFactor2(bodyu.ptr);
821} 1062}
822 1063
823public override bool IsInWorld(BulletBody obj) 1064public override bool IsInWorld(BulletBody obj)
824{ 1065{
825 return BSAPICPP.IsInWorld2(obj.ptr); 1066 BulletBodyUnman bodyu = obj as BulletBodyUnman;
1067 return BSAPICPP.IsInWorld2(bodyu.ptr);
826} 1068}
827 1069
828public override void AddConstraintRef(BulletBody obj, BulletConstraint constrain) 1070public override void AddConstraintRef(BulletBody obj, BulletConstraint constrain)
829{ 1071{
830 BSAPICPP.AddConstraintRef2(obj.ptr, constrain.ptr); 1072 BulletBodyUnman bodyu = obj as BulletBodyUnman;
1073 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
1074 BSAPICPP.AddConstraintRef2(bodyu.ptr, constrainu.ptr);
831} 1075}
832 1076
833public override void RemoveConstraintRef(BulletBody obj, BulletConstraint constrain) 1077public override void RemoveConstraintRef(BulletBody obj, BulletConstraint constrain)
834{ 1078{
835 BSAPICPP.RemoveConstraintRef2(obj.ptr, constrain.ptr); 1079 BulletBodyUnman bodyu = obj as BulletBodyUnman;
1080 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
1081 BSAPICPP.RemoveConstraintRef2(bodyu.ptr, constrainu.ptr);
836} 1082}
837 1083
838public override BulletConstraint GetConstraintRef(BulletBody obj, int index) 1084public override BulletConstraint GetConstraintRef(BulletBody obj, int index)
839{ 1085{
840 return new BulletConstraint(BSAPICPP.GetConstraintRef2(obj.ptr, index)); 1086 BulletBodyUnman bodyu = obj as BulletBodyUnman;
1087 return new BulletConstraintUnman(BSAPICPP.GetConstraintRef2(bodyu.ptr, index));
841} 1088}
842 1089
843public override int GetNumConstraintRefs(BulletBody obj) 1090public override int GetNumConstraintRefs(BulletBody obj)
844{ 1091{
845 return BSAPICPP.GetNumConstraintRefs2(obj.ptr); 1092 BulletBodyUnman bodyu = obj as BulletBodyUnman;
1093 return BSAPICPP.GetNumConstraintRefs2(bodyu.ptr);
846} 1094}
847 1095
848public override bool SetCollisionGroupMask(BulletBody body, uint filter, uint mask) 1096public override bool SetCollisionGroupMask(BulletBody body, uint filter, uint mask)
849{ 1097{
850 return BSAPICPP.SetCollisionGroupMask2(body.ptr, filter, mask); 1098 BulletBodyUnman bodyu = body as BulletBodyUnman;
1099 return BSAPICPP.SetCollisionGroupMask2(bodyu.ptr, filter, mask);
851} 1100}
852 1101
853// ===================================================================================== 1102// =====================================================================================
@@ -855,114 +1104,139 @@ public override bool SetCollisionGroupMask(BulletBody body, uint filter, uint ma
855 1104
856public override float GetAngularMotionDisc(BulletShape shape) 1105public override float GetAngularMotionDisc(BulletShape shape)
857{ 1106{
858 return BSAPICPP.GetAngularMotionDisc2(shape.ptr); 1107 BulletShapeUnman shapeu = shape as BulletShapeUnman;
1108 return BSAPICPP.GetAngularMotionDisc2(shapeu.ptr);
859} 1109}
860 1110
861public override float GetContactBreakingThreshold(BulletShape shape, float defaultFactor) 1111public override float GetContactBreakingThreshold(BulletShape shape, float defaultFactor)
862{ 1112{
863 return BSAPICPP.GetContactBreakingThreshold2(shape.ptr, defaultFactor); 1113 BulletShapeUnman shapeu = shape as BulletShapeUnman;
1114 return BSAPICPP.GetContactBreakingThreshold2(shapeu.ptr, defaultFactor);
864} 1115}
865 1116
866public override bool IsPolyhedral(BulletShape shape) 1117public override bool IsPolyhedral(BulletShape shape)
867{ 1118{
868 return BSAPICPP.IsPolyhedral2(shape.ptr); 1119 BulletShapeUnman shapeu = shape as BulletShapeUnman;
1120 return BSAPICPP.IsPolyhedral2(shapeu.ptr);
869} 1121}
870 1122
871public override bool IsConvex2d(BulletShape shape) 1123public override bool IsConvex2d(BulletShape shape)
872{ 1124{
873 return BSAPICPP.IsConvex2d2(shape.ptr); 1125 BulletShapeUnman shapeu = shape as BulletShapeUnman;
1126 return BSAPICPP.IsConvex2d2(shapeu.ptr);
874} 1127}
875 1128
876public override bool IsConvex(BulletShape shape) 1129public override bool IsConvex(BulletShape shape)
877{ 1130{
878 return BSAPICPP.IsConvex2(shape.ptr); 1131 BulletShapeUnman shapeu = shape as BulletShapeUnman;
1132 return BSAPICPP.IsConvex2(shapeu.ptr);
879} 1133}
880 1134
881public override bool IsNonMoving(BulletShape shape) 1135public override bool IsNonMoving(BulletShape shape)
882{ 1136{
883 return BSAPICPP.IsNonMoving2(shape.ptr); 1137 BulletShapeUnman shapeu = shape as BulletShapeUnman;
1138 return BSAPICPP.IsNonMoving2(shapeu.ptr);
884} 1139}
885 1140
886public override bool IsConcave(BulletShape shape) 1141public override bool IsConcave(BulletShape shape)
887{ 1142{
888 return BSAPICPP.IsConcave2(shape.ptr); 1143 BulletShapeUnman shapeu = shape as BulletShapeUnman;
1144 return BSAPICPP.IsConcave2(shapeu.ptr);
889} 1145}
890 1146
891public override bool IsCompound(BulletShape shape) 1147public override bool IsCompound(BulletShape shape)
892{ 1148{
893 return BSAPICPP.IsCompound2(shape.ptr); 1149 BulletShapeUnman shapeu = shape as BulletShapeUnman;
1150 return BSAPICPP.IsCompound2(shapeu.ptr);
894} 1151}
895 1152
896public override bool IsSoftBody(BulletShape shape) 1153public override bool IsSoftBody(BulletShape shape)
897{ 1154{
898 return BSAPICPP.IsSoftBody2(shape.ptr); 1155 BulletShapeUnman shapeu = shape as BulletShapeUnman;
1156 return BSAPICPP.IsSoftBody2(shapeu.ptr);
899} 1157}
900 1158
901public override bool IsInfinite(BulletShape shape) 1159public override bool IsInfinite(BulletShape shape)
902{ 1160{
903 return BSAPICPP.IsInfinite2(shape.ptr); 1161 BulletShapeUnman shapeu = shape as BulletShapeUnman;
1162 return BSAPICPP.IsInfinite2(shapeu.ptr);
904} 1163}
905 1164
906public override void SetLocalScaling(BulletShape shape, Vector3 scale) 1165public override void SetLocalScaling(BulletShape shape, Vector3 scale)
907{ 1166{
908 BSAPICPP.SetLocalScaling2(shape.ptr, scale); 1167 BulletShapeUnman shapeu = shape as BulletShapeUnman;
1168 BSAPICPP.SetLocalScaling2(shapeu.ptr, scale);
909} 1169}
910 1170
911public override Vector3 GetLocalScaling(BulletShape shape) 1171public override Vector3 GetLocalScaling(BulletShape shape)
912{ 1172{
913 return BSAPICPP.GetLocalScaling2(shape.ptr); 1173 BulletShapeUnman shapeu = shape as BulletShapeUnman;
1174 return BSAPICPP.GetLocalScaling2(shapeu.ptr);
914} 1175}
915 1176
916public override Vector3 CalculateLocalInertia(BulletShape shape, float mass) 1177public override Vector3 CalculateLocalInertia(BulletShape shape, float mass)
917{ 1178{
918 return BSAPICPP.CalculateLocalInertia2(shape.ptr, mass); 1179 BulletShapeUnman shapeu = shape as BulletShapeUnman;
1180 return BSAPICPP.CalculateLocalInertia2(shapeu.ptr, mass);
919} 1181}
920 1182
921public override int GetShapeType(BulletShape shape) 1183public override int GetShapeType(BulletShape shape)
922{ 1184{
923 return BSAPICPP.GetShapeType2(shape.ptr); 1185 BulletShapeUnman shapeu = shape as BulletShapeUnman;
1186 return BSAPICPP.GetShapeType2(shapeu.ptr);
924} 1187}
925 1188
926public override void SetMargin(BulletShape shape, float val) 1189public override void SetMargin(BulletShape shape, float val)
927{ 1190{
928 BSAPICPP.SetMargin2(shape.ptr, val); 1191 BulletShapeUnman shapeu = shape as BulletShapeUnman;
1192 BSAPICPP.SetMargin2(shapeu.ptr, val);
929} 1193}
930 1194
931public override float GetMargin(BulletShape shape) 1195public override float GetMargin(BulletShape shape)
932{ 1196{
933 return BSAPICPP.GetMargin2(shape.ptr); 1197 BulletShapeUnman shapeu = shape as BulletShapeUnman;
1198 return BSAPICPP.GetMargin2(shapeu.ptr);
934} 1199}
935 1200
936// ===================================================================================== 1201// =====================================================================================
937// Debugging 1202// Debugging
938public override void DumpRigidBody(BulletWorld sim, BulletBody collisionObject) 1203public override void DumpRigidBody(BulletWorld world, BulletBody collisionObject)
939{ 1204{
940 BSAPICPP.DumpRigidBody2(sim.ptr, collisionObject.ptr); 1205 BulletWorldUnman worldu = world as BulletWorldUnman;
1206 BulletBodyUnman bodyu = collisionObject as BulletBodyUnman;
1207 BSAPICPP.DumpRigidBody2(worldu.ptr, bodyu.ptr);
941} 1208}
942 1209
943public override void DumpCollisionShape(BulletWorld sim, BulletShape collisionShape) 1210public override void DumpCollisionShape(BulletWorld world, BulletShape collisionShape)
944{ 1211{
945 BSAPICPP.DumpCollisionShape2(sim.ptr, collisionShape.ptr); 1212 BulletWorldUnman worldu = world as BulletWorldUnman;
1213 BulletShapeUnman shapeu = collisionShape as BulletShapeUnman;
1214 BSAPICPP.DumpCollisionShape2(worldu.ptr, shapeu.ptr);
946} 1215}
947 1216
948public override void DumpConstraint(BulletWorld sim, BulletConstraint constrain) 1217public override void DumpConstraint(BulletWorld world, BulletConstraint constrain)
949{ 1218{
950 BSAPICPP.DumpConstraint2(sim.ptr, constrain.ptr); 1219 BulletWorldUnman worldu = world as BulletWorldUnman;
1220 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
1221 BSAPICPP.DumpConstraint2(worldu.ptr, constrainu.ptr);
951} 1222}
952 1223
953public override void DumpActivationInfo(BulletWorld sim) 1224public override void DumpActivationInfo(BulletWorld world)
954{ 1225{
955 BSAPICPP.DumpActivationInfo2(sim.ptr); 1226 BulletWorldUnman worldu = world as BulletWorldUnman;
1227 BSAPICPP.DumpActivationInfo2(worldu.ptr);
956} 1228}
957 1229
958public override void DumpAllInfo(BulletWorld sim) 1230public override void DumpAllInfo(BulletWorld world)
959{ 1231{
960 BSAPICPP.DumpAllInfo2(sim.ptr); 1232 BulletWorldUnman worldu = world as BulletWorldUnman;
1233 BSAPICPP.DumpAllInfo2(worldu.ptr);
961} 1234}
962 1235
963public override void DumpPhysicsStatistics(BulletWorld sim) 1236public override void DumpPhysicsStatistics(BulletWorld world)
964{ 1237{
965 BSAPICPP.DumpPhysicsStatistics2(sim.ptr); 1238 BulletWorldUnman worldu = world as BulletWorldUnman;
1239 BSAPICPP.DumpPhysicsStatistics2(worldu.ptr);
966} 1240}
967 1241
968 1242