BSAPIUnman.cs 92 KB

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