lua_PhysicsRigidBody.cpp 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941
  1. #include "Base.h"
  2. #include "ScriptController.h"
  3. #include "lua_PhysicsRigidBody.h"
  4. #include "Animation.h"
  5. #include "AnimationTarget.h"
  6. #include "Base.h"
  7. #include "Game.h"
  8. #include "Image.h"
  9. #include "MeshPart.h"
  10. #include "Node.h"
  11. #include "PhysicsCollisionObject.h"
  12. #include "PhysicsController.h"
  13. #include "PhysicsRigidBody.h"
  14. #include "ScriptController.h"
  15. #include "ScriptTarget.h"
  16. #include "Transform.h"
  17. #include "lua_CurveInterpolationType.h"
  18. #include "lua_PhysicsCollisionObjectCollisionListenerEventType.h"
  19. #include "lua_PhysicsCollisionObjectType.h"
  20. #include "lua_PhysicsCollisionShapeType.h"
  21. namespace gameplay
  22. {
  23. void luaRegister_PhysicsRigidBody()
  24. {
  25. const luaL_Reg lua_members[] =
  26. {
  27. {"addCollisionListener", lua_PhysicsRigidBody_addCollisionListener},
  28. {"applyForce", lua_PhysicsRigidBody_applyForce},
  29. {"applyImpulse", lua_PhysicsRigidBody_applyImpulse},
  30. {"applyTorque", lua_PhysicsRigidBody_applyTorque},
  31. {"applyTorqueImpulse", lua_PhysicsRigidBody_applyTorqueImpulse},
  32. {"collidesWith", lua_PhysicsRigidBody_collidesWith},
  33. {"getAngularDamping", lua_PhysicsRigidBody_getAngularDamping},
  34. {"getAngularFactor", lua_PhysicsRigidBody_getAngularFactor},
  35. {"getAngularVelocity", lua_PhysicsRigidBody_getAngularVelocity},
  36. {"getAnisotropicFriction", lua_PhysicsRigidBody_getAnisotropicFriction},
  37. {"getCollisionShape", lua_PhysicsRigidBody_getCollisionShape},
  38. {"getFriction", lua_PhysicsRigidBody_getFriction},
  39. {"getGravity", lua_PhysicsRigidBody_getGravity},
  40. {"getHeight", lua_PhysicsRigidBody_getHeight},
  41. {"getLinearDamping", lua_PhysicsRigidBody_getLinearDamping},
  42. {"getLinearFactor", lua_PhysicsRigidBody_getLinearFactor},
  43. {"getLinearVelocity", lua_PhysicsRigidBody_getLinearVelocity},
  44. {"getMass", lua_PhysicsRigidBody_getMass},
  45. {"getNode", lua_PhysicsRigidBody_getNode},
  46. {"getRestitution", lua_PhysicsRigidBody_getRestitution},
  47. {"getShapeType", lua_PhysicsRigidBody_getShapeType},
  48. {"getType", lua_PhysicsRigidBody_getType},
  49. {"isDynamic", lua_PhysicsRigidBody_isDynamic},
  50. {"isEnabled", lua_PhysicsRigidBody_isEnabled},
  51. {"isKinematic", lua_PhysicsRigidBody_isKinematic},
  52. {"isStatic", lua_PhysicsRigidBody_isStatic},
  53. {"removeCollisionListener", lua_PhysicsRigidBody_removeCollisionListener},
  54. {"setAngularFactor", lua_PhysicsRigidBody_setAngularFactor},
  55. {"setAngularVelocity", lua_PhysicsRigidBody_setAngularVelocity},
  56. {"setAnisotropicFriction", lua_PhysicsRigidBody_setAnisotropicFriction},
  57. {"setDamping", lua_PhysicsRigidBody_setDamping},
  58. {"setEnabled", lua_PhysicsRigidBody_setEnabled},
  59. {"setFriction", lua_PhysicsRigidBody_setFriction},
  60. {"setGravity", lua_PhysicsRigidBody_setGravity},
  61. {"setKinematic", lua_PhysicsRigidBody_setKinematic},
  62. {"setLinearFactor", lua_PhysicsRigidBody_setLinearFactor},
  63. {"setLinearVelocity", lua_PhysicsRigidBody_setLinearVelocity},
  64. {"setRestitution", lua_PhysicsRigidBody_setRestitution},
  65. {NULL, NULL}
  66. };
  67. const luaL_Reg* lua_statics = NULL;
  68. std::vector<std::string> scopePath;
  69. ScriptUtil::registerClass("PhysicsRigidBody", lua_members, NULL, NULL, lua_statics, scopePath);
  70. }
  71. static PhysicsRigidBody* getInstance(lua_State* state)
  72. {
  73. void* userdata = luaL_checkudata(state, 1, "PhysicsRigidBody");
  74. luaL_argcheck(state, userdata != NULL, 1, "'PhysicsRigidBody' expected.");
  75. return (PhysicsRigidBody*)((ScriptUtil::LuaObject*)userdata)->instance;
  76. }
  77. int lua_PhysicsRigidBody_addCollisionListener(lua_State* state)
  78. {
  79. // Get the number of parameters.
  80. int paramCount = lua_gettop(state);
  81. // Attempt to match the parameters to a valid binding.
  82. switch (paramCount)
  83. {
  84. case 2:
  85. {
  86. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  87. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  88. {
  89. // Get parameter 1 off the stack.
  90. ScriptUtil::LuaArray<PhysicsCollisionObject::CollisionListener> param1 = ScriptUtil::getObjectPointer<PhysicsCollisionObject::CollisionListener>(2, "PhysicsCollisionObjectCollisionListener", false);
  91. PhysicsRigidBody* instance = getInstance(state);
  92. instance->addCollisionListener(param1);
  93. return 0;
  94. }
  95. else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  96. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  97. {
  98. // Get parameter 1 off the stack.
  99. ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
  100. PhysicsRigidBody* instance = getInstance(state);
  101. instance->addCollisionListener(param1);
  102. return 0;
  103. }
  104. else
  105. {
  106. lua_pushstring(state, "lua_PhysicsRigidBody_addCollisionListener - Failed to match the given parameters to a valid function signature.");
  107. lua_error(state);
  108. }
  109. break;
  110. }
  111. case 3:
  112. {
  113. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  114. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  115. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  116. {
  117. // Get parameter 1 off the stack.
  118. ScriptUtil::LuaArray<PhysicsCollisionObject::CollisionListener> param1 = ScriptUtil::getObjectPointer<PhysicsCollisionObject::CollisionListener>(2, "PhysicsCollisionObjectCollisionListener", false);
  119. // Get parameter 2 off the stack.
  120. ScriptUtil::LuaArray<PhysicsCollisionObject> param2 = ScriptUtil::getObjectPointer<PhysicsCollisionObject>(3, "PhysicsCollisionObject", false);
  121. PhysicsRigidBody* instance = getInstance(state);
  122. instance->addCollisionListener(param1, param2);
  123. return 0;
  124. }
  125. else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  126. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  127. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  128. {
  129. // Get parameter 1 off the stack.
  130. ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
  131. // Get parameter 2 off the stack.
  132. ScriptUtil::LuaArray<PhysicsCollisionObject> param2 = ScriptUtil::getObjectPointer<PhysicsCollisionObject>(3, "PhysicsCollisionObject", false);
  133. PhysicsRigidBody* instance = getInstance(state);
  134. instance->addCollisionListener(param1, param2);
  135. return 0;
  136. }
  137. else
  138. {
  139. lua_pushstring(state, "lua_PhysicsRigidBody_addCollisionListener - Failed to match the given parameters to a valid function signature.");
  140. lua_error(state);
  141. }
  142. break;
  143. }
  144. default:
  145. {
  146. lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
  147. lua_error(state);
  148. break;
  149. }
  150. }
  151. return 0;
  152. }
  153. int lua_PhysicsRigidBody_applyForce(lua_State* state)
  154. {
  155. // Get the number of parameters.
  156. int paramCount = lua_gettop(state);
  157. // Attempt to match the parameters to a valid binding.
  158. switch (paramCount)
  159. {
  160. case 2:
  161. {
  162. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  163. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  164. {
  165. // Get parameter 1 off the stack.
  166. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  167. PhysicsRigidBody* instance = getInstance(state);
  168. instance->applyForce(*param1);
  169. return 0;
  170. }
  171. else
  172. {
  173. lua_pushstring(state, "lua_PhysicsRigidBody_applyForce - Failed to match the given parameters to a valid function signature.");
  174. lua_error(state);
  175. }
  176. break;
  177. }
  178. case 3:
  179. {
  180. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  181. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  182. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  183. {
  184. // Get parameter 1 off the stack.
  185. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  186. // Get parameter 2 off the stack.
  187. ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", false);
  188. PhysicsRigidBody* instance = getInstance(state);
  189. instance->applyForce(*param1, param2);
  190. return 0;
  191. }
  192. else
  193. {
  194. lua_pushstring(state, "lua_PhysicsRigidBody_applyForce - Failed to match the given parameters to a valid function signature.");
  195. lua_error(state);
  196. }
  197. break;
  198. }
  199. default:
  200. {
  201. lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
  202. lua_error(state);
  203. break;
  204. }
  205. }
  206. return 0;
  207. }
  208. int lua_PhysicsRigidBody_applyImpulse(lua_State* state)
  209. {
  210. // Get the number of parameters.
  211. int paramCount = lua_gettop(state);
  212. // Attempt to match the parameters to a valid binding.
  213. switch (paramCount)
  214. {
  215. case 2:
  216. {
  217. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  218. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  219. {
  220. // Get parameter 1 off the stack.
  221. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  222. PhysicsRigidBody* instance = getInstance(state);
  223. instance->applyImpulse(*param1);
  224. return 0;
  225. }
  226. else
  227. {
  228. lua_pushstring(state, "lua_PhysicsRigidBody_applyImpulse - Failed to match the given parameters to a valid function signature.");
  229. lua_error(state);
  230. }
  231. break;
  232. }
  233. case 3:
  234. {
  235. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  236. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  237. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  238. {
  239. // Get parameter 1 off the stack.
  240. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  241. // Get parameter 2 off the stack.
  242. ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", false);
  243. PhysicsRigidBody* instance = getInstance(state);
  244. instance->applyImpulse(*param1, param2);
  245. return 0;
  246. }
  247. else
  248. {
  249. lua_pushstring(state, "lua_PhysicsRigidBody_applyImpulse - Failed to match the given parameters to a valid function signature.");
  250. lua_error(state);
  251. }
  252. break;
  253. }
  254. default:
  255. {
  256. lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
  257. lua_error(state);
  258. break;
  259. }
  260. }
  261. return 0;
  262. }
  263. int lua_PhysicsRigidBody_applyTorque(lua_State* state)
  264. {
  265. // Get the number of parameters.
  266. int paramCount = lua_gettop(state);
  267. // Attempt to match the parameters to a valid binding.
  268. switch (paramCount)
  269. {
  270. case 2:
  271. {
  272. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  273. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  274. {
  275. // Get parameter 1 off the stack.
  276. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  277. PhysicsRigidBody* instance = getInstance(state);
  278. instance->applyTorque(*param1);
  279. return 0;
  280. }
  281. else
  282. {
  283. lua_pushstring(state, "lua_PhysicsRigidBody_applyTorque - Failed to match the given parameters to a valid function signature.");
  284. lua_error(state);
  285. }
  286. break;
  287. }
  288. default:
  289. {
  290. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  291. lua_error(state);
  292. break;
  293. }
  294. }
  295. return 0;
  296. }
  297. int lua_PhysicsRigidBody_applyTorqueImpulse(lua_State* state)
  298. {
  299. // Get the number of parameters.
  300. int paramCount = lua_gettop(state);
  301. // Attempt to match the parameters to a valid binding.
  302. switch (paramCount)
  303. {
  304. case 2:
  305. {
  306. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  307. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  308. {
  309. // Get parameter 1 off the stack.
  310. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  311. PhysicsRigidBody* instance = getInstance(state);
  312. instance->applyTorqueImpulse(*param1);
  313. return 0;
  314. }
  315. else
  316. {
  317. lua_pushstring(state, "lua_PhysicsRigidBody_applyTorqueImpulse - Failed to match the given parameters to a valid function signature.");
  318. lua_error(state);
  319. }
  320. break;
  321. }
  322. default:
  323. {
  324. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  325. lua_error(state);
  326. break;
  327. }
  328. }
  329. return 0;
  330. }
  331. int lua_PhysicsRigidBody_collidesWith(lua_State* state)
  332. {
  333. // Get the number of parameters.
  334. int paramCount = lua_gettop(state);
  335. // Attempt to match the parameters to a valid binding.
  336. switch (paramCount)
  337. {
  338. case 2:
  339. {
  340. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  341. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  342. {
  343. // Get parameter 1 off the stack.
  344. ScriptUtil::LuaArray<PhysicsCollisionObject> param1 = ScriptUtil::getObjectPointer<PhysicsCollisionObject>(2, "PhysicsCollisionObject", false);
  345. PhysicsRigidBody* instance = getInstance(state);
  346. bool result = instance->collidesWith(param1);
  347. // Push the return value onto the stack.
  348. lua_pushboolean(state, result);
  349. return 1;
  350. }
  351. else
  352. {
  353. lua_pushstring(state, "lua_PhysicsRigidBody_collidesWith - Failed to match the given parameters to a valid function signature.");
  354. lua_error(state);
  355. }
  356. break;
  357. }
  358. default:
  359. {
  360. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  361. lua_error(state);
  362. break;
  363. }
  364. }
  365. return 0;
  366. }
  367. int lua_PhysicsRigidBody_getAngularDamping(lua_State* state)
  368. {
  369. // Get the number of parameters.
  370. int paramCount = lua_gettop(state);
  371. // Attempt to match the parameters to a valid binding.
  372. switch (paramCount)
  373. {
  374. case 1:
  375. {
  376. if ((lua_type(state, 1) == LUA_TUSERDATA))
  377. {
  378. PhysicsRigidBody* instance = getInstance(state);
  379. float result = instance->getAngularDamping();
  380. // Push the return value onto the stack.
  381. lua_pushnumber(state, result);
  382. return 1;
  383. }
  384. else
  385. {
  386. lua_pushstring(state, "lua_PhysicsRigidBody_getAngularDamping - Failed to match the given parameters to a valid function signature.");
  387. lua_error(state);
  388. }
  389. break;
  390. }
  391. default:
  392. {
  393. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  394. lua_error(state);
  395. break;
  396. }
  397. }
  398. return 0;
  399. }
  400. int lua_PhysicsRigidBody_getAngularFactor(lua_State* state)
  401. {
  402. // Get the number of parameters.
  403. int paramCount = lua_gettop(state);
  404. // Attempt to match the parameters to a valid binding.
  405. switch (paramCount)
  406. {
  407. case 1:
  408. {
  409. if ((lua_type(state, 1) == LUA_TUSERDATA))
  410. {
  411. PhysicsRigidBody* instance = getInstance(state);
  412. void* returnPtr = (void*)new Vector3(instance->getAngularFactor());
  413. if (returnPtr)
  414. {
  415. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  416. object->instance = returnPtr;
  417. object->owns = true;
  418. luaL_getmetatable(state, "Vector3");
  419. lua_setmetatable(state, -2);
  420. }
  421. else
  422. {
  423. lua_pushnil(state);
  424. }
  425. return 1;
  426. }
  427. else
  428. {
  429. lua_pushstring(state, "lua_PhysicsRigidBody_getAngularFactor - Failed to match the given parameters to a valid function signature.");
  430. lua_error(state);
  431. }
  432. break;
  433. }
  434. default:
  435. {
  436. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  437. lua_error(state);
  438. break;
  439. }
  440. }
  441. return 0;
  442. }
  443. int lua_PhysicsRigidBody_getAngularVelocity(lua_State* state)
  444. {
  445. // Get the number of parameters.
  446. int paramCount = lua_gettop(state);
  447. // Attempt to match the parameters to a valid binding.
  448. switch (paramCount)
  449. {
  450. case 1:
  451. {
  452. if ((lua_type(state, 1) == LUA_TUSERDATA))
  453. {
  454. PhysicsRigidBody* instance = getInstance(state);
  455. void* returnPtr = (void*)new Vector3(instance->getAngularVelocity());
  456. if (returnPtr)
  457. {
  458. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  459. object->instance = returnPtr;
  460. object->owns = true;
  461. luaL_getmetatable(state, "Vector3");
  462. lua_setmetatable(state, -2);
  463. }
  464. else
  465. {
  466. lua_pushnil(state);
  467. }
  468. return 1;
  469. }
  470. else
  471. {
  472. lua_pushstring(state, "lua_PhysicsRigidBody_getAngularVelocity - Failed to match the given parameters to a valid function signature.");
  473. lua_error(state);
  474. }
  475. break;
  476. }
  477. default:
  478. {
  479. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  480. lua_error(state);
  481. break;
  482. }
  483. }
  484. return 0;
  485. }
  486. int lua_PhysicsRigidBody_getAnisotropicFriction(lua_State* state)
  487. {
  488. // Get the number of parameters.
  489. int paramCount = lua_gettop(state);
  490. // Attempt to match the parameters to a valid binding.
  491. switch (paramCount)
  492. {
  493. case 1:
  494. {
  495. if ((lua_type(state, 1) == LUA_TUSERDATA))
  496. {
  497. PhysicsRigidBody* instance = getInstance(state);
  498. void* returnPtr = (void*)new Vector3(instance->getAnisotropicFriction());
  499. if (returnPtr)
  500. {
  501. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  502. object->instance = returnPtr;
  503. object->owns = true;
  504. luaL_getmetatable(state, "Vector3");
  505. lua_setmetatable(state, -2);
  506. }
  507. else
  508. {
  509. lua_pushnil(state);
  510. }
  511. return 1;
  512. }
  513. else
  514. {
  515. lua_pushstring(state, "lua_PhysicsRigidBody_getAnisotropicFriction - Failed to match the given parameters to a valid function signature.");
  516. lua_error(state);
  517. }
  518. break;
  519. }
  520. default:
  521. {
  522. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  523. lua_error(state);
  524. break;
  525. }
  526. }
  527. return 0;
  528. }
  529. int lua_PhysicsRigidBody_getCollisionShape(lua_State* state)
  530. {
  531. // Get the number of parameters.
  532. int paramCount = lua_gettop(state);
  533. // Attempt to match the parameters to a valid binding.
  534. switch (paramCount)
  535. {
  536. case 1:
  537. {
  538. if ((lua_type(state, 1) == LUA_TUSERDATA))
  539. {
  540. PhysicsRigidBody* instance = getInstance(state);
  541. void* returnPtr = (void*)instance->getCollisionShape();
  542. if (returnPtr)
  543. {
  544. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  545. object->instance = returnPtr;
  546. object->owns = false;
  547. luaL_getmetatable(state, "PhysicsCollisionShape");
  548. lua_setmetatable(state, -2);
  549. }
  550. else
  551. {
  552. lua_pushnil(state);
  553. }
  554. return 1;
  555. }
  556. else
  557. {
  558. lua_pushstring(state, "lua_PhysicsRigidBody_getCollisionShape - Failed to match the given parameters to a valid function signature.");
  559. lua_error(state);
  560. }
  561. break;
  562. }
  563. default:
  564. {
  565. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  566. lua_error(state);
  567. break;
  568. }
  569. }
  570. return 0;
  571. }
  572. int lua_PhysicsRigidBody_getFriction(lua_State* state)
  573. {
  574. // Get the number of parameters.
  575. int paramCount = lua_gettop(state);
  576. // Attempt to match the parameters to a valid binding.
  577. switch (paramCount)
  578. {
  579. case 1:
  580. {
  581. if ((lua_type(state, 1) == LUA_TUSERDATA))
  582. {
  583. PhysicsRigidBody* instance = getInstance(state);
  584. float result = instance->getFriction();
  585. // Push the return value onto the stack.
  586. lua_pushnumber(state, result);
  587. return 1;
  588. }
  589. else
  590. {
  591. lua_pushstring(state, "lua_PhysicsRigidBody_getFriction - Failed to match the given parameters to a valid function signature.");
  592. lua_error(state);
  593. }
  594. break;
  595. }
  596. default:
  597. {
  598. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  599. lua_error(state);
  600. break;
  601. }
  602. }
  603. return 0;
  604. }
  605. int lua_PhysicsRigidBody_getGravity(lua_State* state)
  606. {
  607. // Get the number of parameters.
  608. int paramCount = lua_gettop(state);
  609. // Attempt to match the parameters to a valid binding.
  610. switch (paramCount)
  611. {
  612. case 1:
  613. {
  614. if ((lua_type(state, 1) == LUA_TUSERDATA))
  615. {
  616. PhysicsRigidBody* instance = getInstance(state);
  617. void* returnPtr = (void*)new Vector3(instance->getGravity());
  618. if (returnPtr)
  619. {
  620. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  621. object->instance = returnPtr;
  622. object->owns = true;
  623. luaL_getmetatable(state, "Vector3");
  624. lua_setmetatable(state, -2);
  625. }
  626. else
  627. {
  628. lua_pushnil(state);
  629. }
  630. return 1;
  631. }
  632. else
  633. {
  634. lua_pushstring(state, "lua_PhysicsRigidBody_getGravity - Failed to match the given parameters to a valid function signature.");
  635. lua_error(state);
  636. }
  637. break;
  638. }
  639. default:
  640. {
  641. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  642. lua_error(state);
  643. break;
  644. }
  645. }
  646. return 0;
  647. }
  648. int lua_PhysicsRigidBody_getHeight(lua_State* state)
  649. {
  650. // Get the number of parameters.
  651. int paramCount = lua_gettop(state);
  652. // Attempt to match the parameters to a valid binding.
  653. switch (paramCount)
  654. {
  655. case 3:
  656. {
  657. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  658. lua_type(state, 2) == LUA_TNUMBER &&
  659. lua_type(state, 3) == LUA_TNUMBER)
  660. {
  661. // Get parameter 1 off the stack.
  662. float param1 = (float)luaL_checknumber(state, 2);
  663. // Get parameter 2 off the stack.
  664. float param2 = (float)luaL_checknumber(state, 3);
  665. PhysicsRigidBody* instance = getInstance(state);
  666. float result = instance->getHeight(param1, param2);
  667. // Push the return value onto the stack.
  668. lua_pushnumber(state, result);
  669. return 1;
  670. }
  671. else
  672. {
  673. lua_pushstring(state, "lua_PhysicsRigidBody_getHeight - Failed to match the given parameters to a valid function signature.");
  674. lua_error(state);
  675. }
  676. break;
  677. }
  678. case 4:
  679. {
  680. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  681. lua_type(state, 2) == LUA_TNUMBER &&
  682. lua_type(state, 3) == LUA_TNUMBER &&
  683. (lua_type(state, 4) == LUA_TUSERDATA || lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TNIL))
  684. {
  685. // Get parameter 1 off the stack.
  686. float param1 = (float)luaL_checknumber(state, 2);
  687. // Get parameter 2 off the stack.
  688. float param2 = (float)luaL_checknumber(state, 3);
  689. // Get parameter 3 off the stack.
  690. ScriptUtil::LuaArray<Vector3> param3 = ScriptUtil::getObjectPointer<Vector3>(4, "Vector3", false);
  691. PhysicsRigidBody* instance = getInstance(state);
  692. float result = instance->getHeight(param1, param2, param3);
  693. // Push the return value onto the stack.
  694. lua_pushnumber(state, result);
  695. return 1;
  696. }
  697. else
  698. {
  699. lua_pushstring(state, "lua_PhysicsRigidBody_getHeight - Failed to match the given parameters to a valid function signature.");
  700. lua_error(state);
  701. }
  702. break;
  703. }
  704. default:
  705. {
  706. lua_pushstring(state, "Invalid number of parameters (expected 3 or 4).");
  707. lua_error(state);
  708. break;
  709. }
  710. }
  711. return 0;
  712. }
  713. int lua_PhysicsRigidBody_getLinearDamping(lua_State* state)
  714. {
  715. // Get the number of parameters.
  716. int paramCount = lua_gettop(state);
  717. // Attempt to match the parameters to a valid binding.
  718. switch (paramCount)
  719. {
  720. case 1:
  721. {
  722. if ((lua_type(state, 1) == LUA_TUSERDATA))
  723. {
  724. PhysicsRigidBody* instance = getInstance(state);
  725. float result = instance->getLinearDamping();
  726. // Push the return value onto the stack.
  727. lua_pushnumber(state, result);
  728. return 1;
  729. }
  730. else
  731. {
  732. lua_pushstring(state, "lua_PhysicsRigidBody_getLinearDamping - Failed to match the given parameters to a valid function signature.");
  733. lua_error(state);
  734. }
  735. break;
  736. }
  737. default:
  738. {
  739. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  740. lua_error(state);
  741. break;
  742. }
  743. }
  744. return 0;
  745. }
  746. int lua_PhysicsRigidBody_getLinearFactor(lua_State* state)
  747. {
  748. // Get the number of parameters.
  749. int paramCount = lua_gettop(state);
  750. // Attempt to match the parameters to a valid binding.
  751. switch (paramCount)
  752. {
  753. case 1:
  754. {
  755. if ((lua_type(state, 1) == LUA_TUSERDATA))
  756. {
  757. PhysicsRigidBody* instance = getInstance(state);
  758. void* returnPtr = (void*)new Vector3(instance->getLinearFactor());
  759. if (returnPtr)
  760. {
  761. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  762. object->instance = returnPtr;
  763. object->owns = true;
  764. luaL_getmetatable(state, "Vector3");
  765. lua_setmetatable(state, -2);
  766. }
  767. else
  768. {
  769. lua_pushnil(state);
  770. }
  771. return 1;
  772. }
  773. else
  774. {
  775. lua_pushstring(state, "lua_PhysicsRigidBody_getLinearFactor - Failed to match the given parameters to a valid function signature.");
  776. lua_error(state);
  777. }
  778. break;
  779. }
  780. default:
  781. {
  782. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  783. lua_error(state);
  784. break;
  785. }
  786. }
  787. return 0;
  788. }
  789. int lua_PhysicsRigidBody_getLinearVelocity(lua_State* state)
  790. {
  791. // Get the number of parameters.
  792. int paramCount = lua_gettop(state);
  793. // Attempt to match the parameters to a valid binding.
  794. switch (paramCount)
  795. {
  796. case 1:
  797. {
  798. if ((lua_type(state, 1) == LUA_TUSERDATA))
  799. {
  800. PhysicsRigidBody* instance = getInstance(state);
  801. void* returnPtr = (void*)new Vector3(instance->getLinearVelocity());
  802. if (returnPtr)
  803. {
  804. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  805. object->instance = returnPtr;
  806. object->owns = true;
  807. luaL_getmetatable(state, "Vector3");
  808. lua_setmetatable(state, -2);
  809. }
  810. else
  811. {
  812. lua_pushnil(state);
  813. }
  814. return 1;
  815. }
  816. else
  817. {
  818. lua_pushstring(state, "lua_PhysicsRigidBody_getLinearVelocity - Failed to match the given parameters to a valid function signature.");
  819. lua_error(state);
  820. }
  821. break;
  822. }
  823. default:
  824. {
  825. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  826. lua_error(state);
  827. break;
  828. }
  829. }
  830. return 0;
  831. }
  832. int lua_PhysicsRigidBody_getMass(lua_State* state)
  833. {
  834. // Get the number of parameters.
  835. int paramCount = lua_gettop(state);
  836. // Attempt to match the parameters to a valid binding.
  837. switch (paramCount)
  838. {
  839. case 1:
  840. {
  841. if ((lua_type(state, 1) == LUA_TUSERDATA))
  842. {
  843. PhysicsRigidBody* instance = getInstance(state);
  844. float result = instance->getMass();
  845. // Push the return value onto the stack.
  846. lua_pushnumber(state, result);
  847. return 1;
  848. }
  849. else
  850. {
  851. lua_pushstring(state, "lua_PhysicsRigidBody_getMass - Failed to match the given parameters to a valid function signature.");
  852. lua_error(state);
  853. }
  854. break;
  855. }
  856. default:
  857. {
  858. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  859. lua_error(state);
  860. break;
  861. }
  862. }
  863. return 0;
  864. }
  865. int lua_PhysicsRigidBody_getNode(lua_State* state)
  866. {
  867. // Get the number of parameters.
  868. int paramCount = lua_gettop(state);
  869. // Attempt to match the parameters to a valid binding.
  870. switch (paramCount)
  871. {
  872. case 1:
  873. {
  874. if ((lua_type(state, 1) == LUA_TUSERDATA))
  875. {
  876. PhysicsRigidBody* instance = getInstance(state);
  877. void* returnPtr = (void*)instance->getNode();
  878. if (returnPtr)
  879. {
  880. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  881. object->instance = returnPtr;
  882. object->owns = false;
  883. luaL_getmetatable(state, "Node");
  884. lua_setmetatable(state, -2);
  885. }
  886. else
  887. {
  888. lua_pushnil(state);
  889. }
  890. return 1;
  891. }
  892. else
  893. {
  894. lua_pushstring(state, "lua_PhysicsRigidBody_getNode - Failed to match the given parameters to a valid function signature.");
  895. lua_error(state);
  896. }
  897. break;
  898. }
  899. default:
  900. {
  901. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  902. lua_error(state);
  903. break;
  904. }
  905. }
  906. return 0;
  907. }
  908. int lua_PhysicsRigidBody_getRestitution(lua_State* state)
  909. {
  910. // Get the number of parameters.
  911. int paramCount = lua_gettop(state);
  912. // Attempt to match the parameters to a valid binding.
  913. switch (paramCount)
  914. {
  915. case 1:
  916. {
  917. if ((lua_type(state, 1) == LUA_TUSERDATA))
  918. {
  919. PhysicsRigidBody* instance = getInstance(state);
  920. float result = instance->getRestitution();
  921. // Push the return value onto the stack.
  922. lua_pushnumber(state, result);
  923. return 1;
  924. }
  925. else
  926. {
  927. lua_pushstring(state, "lua_PhysicsRigidBody_getRestitution - Failed to match the given parameters to a valid function signature.");
  928. lua_error(state);
  929. }
  930. break;
  931. }
  932. default:
  933. {
  934. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  935. lua_error(state);
  936. break;
  937. }
  938. }
  939. return 0;
  940. }
  941. int lua_PhysicsRigidBody_getShapeType(lua_State* state)
  942. {
  943. // Get the number of parameters.
  944. int paramCount = lua_gettop(state);
  945. // Attempt to match the parameters to a valid binding.
  946. switch (paramCount)
  947. {
  948. case 1:
  949. {
  950. if ((lua_type(state, 1) == LUA_TUSERDATA))
  951. {
  952. PhysicsRigidBody* instance = getInstance(state);
  953. PhysicsCollisionShape::Type result = instance->getShapeType();
  954. // Push the return value onto the stack.
  955. lua_pushstring(state, lua_stringFromEnum_PhysicsCollisionShapeType(result));
  956. return 1;
  957. }
  958. else
  959. {
  960. lua_pushstring(state, "lua_PhysicsRigidBody_getShapeType - Failed to match the given parameters to a valid function signature.");
  961. lua_error(state);
  962. }
  963. break;
  964. }
  965. default:
  966. {
  967. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  968. lua_error(state);
  969. break;
  970. }
  971. }
  972. return 0;
  973. }
  974. int lua_PhysicsRigidBody_getType(lua_State* state)
  975. {
  976. // Get the number of parameters.
  977. int paramCount = lua_gettop(state);
  978. // Attempt to match the parameters to a valid binding.
  979. switch (paramCount)
  980. {
  981. case 1:
  982. {
  983. if ((lua_type(state, 1) == LUA_TUSERDATA))
  984. {
  985. PhysicsRigidBody* instance = getInstance(state);
  986. PhysicsCollisionObject::Type result = instance->getType();
  987. // Push the return value onto the stack.
  988. lua_pushstring(state, lua_stringFromEnum_PhysicsCollisionObjectType(result));
  989. return 1;
  990. }
  991. else
  992. {
  993. lua_pushstring(state, "lua_PhysicsRigidBody_getType - Failed to match the given parameters to a valid function signature.");
  994. lua_error(state);
  995. }
  996. break;
  997. }
  998. default:
  999. {
  1000. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1001. lua_error(state);
  1002. break;
  1003. }
  1004. }
  1005. return 0;
  1006. }
  1007. int lua_PhysicsRigidBody_isDynamic(lua_State* state)
  1008. {
  1009. // Get the number of parameters.
  1010. int paramCount = lua_gettop(state);
  1011. // Attempt to match the parameters to a valid binding.
  1012. switch (paramCount)
  1013. {
  1014. case 1:
  1015. {
  1016. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1017. {
  1018. PhysicsRigidBody* instance = getInstance(state);
  1019. bool result = instance->isDynamic();
  1020. // Push the return value onto the stack.
  1021. lua_pushboolean(state, result);
  1022. return 1;
  1023. }
  1024. else
  1025. {
  1026. lua_pushstring(state, "lua_PhysicsRigidBody_isDynamic - Failed to match the given parameters to a valid function signature.");
  1027. lua_error(state);
  1028. }
  1029. break;
  1030. }
  1031. default:
  1032. {
  1033. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1034. lua_error(state);
  1035. break;
  1036. }
  1037. }
  1038. return 0;
  1039. }
  1040. int lua_PhysicsRigidBody_isEnabled(lua_State* state)
  1041. {
  1042. // Get the number of parameters.
  1043. int paramCount = lua_gettop(state);
  1044. // Attempt to match the parameters to a valid binding.
  1045. switch (paramCount)
  1046. {
  1047. case 1:
  1048. {
  1049. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1050. {
  1051. PhysicsRigidBody* instance = getInstance(state);
  1052. bool result = instance->isEnabled();
  1053. // Push the return value onto the stack.
  1054. lua_pushboolean(state, result);
  1055. return 1;
  1056. }
  1057. else
  1058. {
  1059. lua_pushstring(state, "lua_PhysicsRigidBody_isEnabled - Failed to match the given parameters to a valid function signature.");
  1060. lua_error(state);
  1061. }
  1062. break;
  1063. }
  1064. default:
  1065. {
  1066. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1067. lua_error(state);
  1068. break;
  1069. }
  1070. }
  1071. return 0;
  1072. }
  1073. int lua_PhysicsRigidBody_isKinematic(lua_State* state)
  1074. {
  1075. // Get the number of parameters.
  1076. int paramCount = lua_gettop(state);
  1077. // Attempt to match the parameters to a valid binding.
  1078. switch (paramCount)
  1079. {
  1080. case 1:
  1081. {
  1082. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1083. {
  1084. PhysicsRigidBody* instance = getInstance(state);
  1085. bool result = instance->isKinematic();
  1086. // Push the return value onto the stack.
  1087. lua_pushboolean(state, result);
  1088. return 1;
  1089. }
  1090. else
  1091. {
  1092. lua_pushstring(state, "lua_PhysicsRigidBody_isKinematic - Failed to match the given parameters to a valid function signature.");
  1093. lua_error(state);
  1094. }
  1095. break;
  1096. }
  1097. default:
  1098. {
  1099. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1100. lua_error(state);
  1101. break;
  1102. }
  1103. }
  1104. return 0;
  1105. }
  1106. int lua_PhysicsRigidBody_isStatic(lua_State* state)
  1107. {
  1108. // Get the number of parameters.
  1109. int paramCount = lua_gettop(state);
  1110. // Attempt to match the parameters to a valid binding.
  1111. switch (paramCount)
  1112. {
  1113. case 1:
  1114. {
  1115. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1116. {
  1117. PhysicsRigidBody* instance = getInstance(state);
  1118. bool result = instance->isStatic();
  1119. // Push the return value onto the stack.
  1120. lua_pushboolean(state, result);
  1121. return 1;
  1122. }
  1123. else
  1124. {
  1125. lua_pushstring(state, "lua_PhysicsRigidBody_isStatic - Failed to match the given parameters to a valid function signature.");
  1126. lua_error(state);
  1127. }
  1128. break;
  1129. }
  1130. default:
  1131. {
  1132. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1133. lua_error(state);
  1134. break;
  1135. }
  1136. }
  1137. return 0;
  1138. }
  1139. int lua_PhysicsRigidBody_removeCollisionListener(lua_State* state)
  1140. {
  1141. // Get the number of parameters.
  1142. int paramCount = lua_gettop(state);
  1143. // Attempt to match the parameters to a valid binding.
  1144. switch (paramCount)
  1145. {
  1146. case 2:
  1147. {
  1148. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1149. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  1150. {
  1151. // Get parameter 1 off the stack.
  1152. ScriptUtil::LuaArray<PhysicsCollisionObject::CollisionListener> param1 = ScriptUtil::getObjectPointer<PhysicsCollisionObject::CollisionListener>(2, "PhysicsCollisionObjectCollisionListener", false);
  1153. PhysicsRigidBody* instance = getInstance(state);
  1154. instance->removeCollisionListener(param1);
  1155. return 0;
  1156. }
  1157. else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1158. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  1159. {
  1160. // Get parameter 1 off the stack.
  1161. ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
  1162. PhysicsRigidBody* instance = getInstance(state);
  1163. instance->removeCollisionListener(param1);
  1164. return 0;
  1165. }
  1166. else
  1167. {
  1168. lua_pushstring(state, "lua_PhysicsRigidBody_removeCollisionListener - Failed to match the given parameters to a valid function signature.");
  1169. lua_error(state);
  1170. }
  1171. break;
  1172. }
  1173. case 3:
  1174. {
  1175. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1176. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  1177. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  1178. {
  1179. // Get parameter 1 off the stack.
  1180. ScriptUtil::LuaArray<PhysicsCollisionObject::CollisionListener> param1 = ScriptUtil::getObjectPointer<PhysicsCollisionObject::CollisionListener>(2, "PhysicsCollisionObjectCollisionListener", false);
  1181. // Get parameter 2 off the stack.
  1182. ScriptUtil::LuaArray<PhysicsCollisionObject> param2 = ScriptUtil::getObjectPointer<PhysicsCollisionObject>(3, "PhysicsCollisionObject", false);
  1183. PhysicsRigidBody* instance = getInstance(state);
  1184. instance->removeCollisionListener(param1, param2);
  1185. return 0;
  1186. }
  1187. else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1188. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  1189. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  1190. {
  1191. // Get parameter 1 off the stack.
  1192. ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
  1193. // Get parameter 2 off the stack.
  1194. ScriptUtil::LuaArray<PhysicsCollisionObject> param2 = ScriptUtil::getObjectPointer<PhysicsCollisionObject>(3, "PhysicsCollisionObject", false);
  1195. PhysicsRigidBody* instance = getInstance(state);
  1196. instance->removeCollisionListener(param1, param2);
  1197. return 0;
  1198. }
  1199. else
  1200. {
  1201. lua_pushstring(state, "lua_PhysicsRigidBody_removeCollisionListener - Failed to match the given parameters to a valid function signature.");
  1202. lua_error(state);
  1203. }
  1204. break;
  1205. }
  1206. default:
  1207. {
  1208. lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
  1209. lua_error(state);
  1210. break;
  1211. }
  1212. }
  1213. return 0;
  1214. }
  1215. int lua_PhysicsRigidBody_setAngularFactor(lua_State* state)
  1216. {
  1217. // Get the number of parameters.
  1218. int paramCount = lua_gettop(state);
  1219. // Attempt to match the parameters to a valid binding.
  1220. switch (paramCount)
  1221. {
  1222. case 2:
  1223. {
  1224. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1225. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  1226. {
  1227. // Get parameter 1 off the stack.
  1228. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  1229. PhysicsRigidBody* instance = getInstance(state);
  1230. instance->setAngularFactor(*param1);
  1231. return 0;
  1232. }
  1233. else
  1234. {
  1235. lua_pushstring(state, "lua_PhysicsRigidBody_setAngularFactor - Failed to match the given parameters to a valid function signature.");
  1236. lua_error(state);
  1237. }
  1238. break;
  1239. }
  1240. case 4:
  1241. {
  1242. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1243. lua_type(state, 2) == LUA_TNUMBER &&
  1244. lua_type(state, 3) == LUA_TNUMBER &&
  1245. lua_type(state, 4) == LUA_TNUMBER)
  1246. {
  1247. // Get parameter 1 off the stack.
  1248. float param1 = (float)luaL_checknumber(state, 2);
  1249. // Get parameter 2 off the stack.
  1250. float param2 = (float)luaL_checknumber(state, 3);
  1251. // Get parameter 3 off the stack.
  1252. float param3 = (float)luaL_checknumber(state, 4);
  1253. PhysicsRigidBody* instance = getInstance(state);
  1254. instance->setAngularFactor(param1, param2, param3);
  1255. return 0;
  1256. }
  1257. else
  1258. {
  1259. lua_pushstring(state, "lua_PhysicsRigidBody_setAngularFactor - Failed to match the given parameters to a valid function signature.");
  1260. lua_error(state);
  1261. }
  1262. break;
  1263. }
  1264. default:
  1265. {
  1266. lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
  1267. lua_error(state);
  1268. break;
  1269. }
  1270. }
  1271. return 0;
  1272. }
  1273. int lua_PhysicsRigidBody_setAngularVelocity(lua_State* state)
  1274. {
  1275. // Get the number of parameters.
  1276. int paramCount = lua_gettop(state);
  1277. // Attempt to match the parameters to a valid binding.
  1278. switch (paramCount)
  1279. {
  1280. case 2:
  1281. {
  1282. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1283. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  1284. {
  1285. // Get parameter 1 off the stack.
  1286. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  1287. PhysicsRigidBody* instance = getInstance(state);
  1288. instance->setAngularVelocity(*param1);
  1289. return 0;
  1290. }
  1291. else
  1292. {
  1293. lua_pushstring(state, "lua_PhysicsRigidBody_setAngularVelocity - Failed to match the given parameters to a valid function signature.");
  1294. lua_error(state);
  1295. }
  1296. break;
  1297. }
  1298. case 4:
  1299. {
  1300. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1301. lua_type(state, 2) == LUA_TNUMBER &&
  1302. lua_type(state, 3) == LUA_TNUMBER &&
  1303. lua_type(state, 4) == LUA_TNUMBER)
  1304. {
  1305. // Get parameter 1 off the stack.
  1306. float param1 = (float)luaL_checknumber(state, 2);
  1307. // Get parameter 2 off the stack.
  1308. float param2 = (float)luaL_checknumber(state, 3);
  1309. // Get parameter 3 off the stack.
  1310. float param3 = (float)luaL_checknumber(state, 4);
  1311. PhysicsRigidBody* instance = getInstance(state);
  1312. instance->setAngularVelocity(param1, param2, param3);
  1313. return 0;
  1314. }
  1315. else
  1316. {
  1317. lua_pushstring(state, "lua_PhysicsRigidBody_setAngularVelocity - Failed to match the given parameters to a valid function signature.");
  1318. lua_error(state);
  1319. }
  1320. break;
  1321. }
  1322. default:
  1323. {
  1324. lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
  1325. lua_error(state);
  1326. break;
  1327. }
  1328. }
  1329. return 0;
  1330. }
  1331. int lua_PhysicsRigidBody_setAnisotropicFriction(lua_State* state)
  1332. {
  1333. // Get the number of parameters.
  1334. int paramCount = lua_gettop(state);
  1335. // Attempt to match the parameters to a valid binding.
  1336. switch (paramCount)
  1337. {
  1338. case 2:
  1339. {
  1340. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1341. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  1342. {
  1343. // Get parameter 1 off the stack.
  1344. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  1345. PhysicsRigidBody* instance = getInstance(state);
  1346. instance->setAnisotropicFriction(*param1);
  1347. return 0;
  1348. }
  1349. else
  1350. {
  1351. lua_pushstring(state, "lua_PhysicsRigidBody_setAnisotropicFriction - Failed to match the given parameters to a valid function signature.");
  1352. lua_error(state);
  1353. }
  1354. break;
  1355. }
  1356. case 4:
  1357. {
  1358. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1359. lua_type(state, 2) == LUA_TNUMBER &&
  1360. lua_type(state, 3) == LUA_TNUMBER &&
  1361. lua_type(state, 4) == LUA_TNUMBER)
  1362. {
  1363. // Get parameter 1 off the stack.
  1364. float param1 = (float)luaL_checknumber(state, 2);
  1365. // Get parameter 2 off the stack.
  1366. float param2 = (float)luaL_checknumber(state, 3);
  1367. // Get parameter 3 off the stack.
  1368. float param3 = (float)luaL_checknumber(state, 4);
  1369. PhysicsRigidBody* instance = getInstance(state);
  1370. instance->setAnisotropicFriction(param1, param2, param3);
  1371. return 0;
  1372. }
  1373. else
  1374. {
  1375. lua_pushstring(state, "lua_PhysicsRigidBody_setAnisotropicFriction - Failed to match the given parameters to a valid function signature.");
  1376. lua_error(state);
  1377. }
  1378. break;
  1379. }
  1380. default:
  1381. {
  1382. lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
  1383. lua_error(state);
  1384. break;
  1385. }
  1386. }
  1387. return 0;
  1388. }
  1389. int lua_PhysicsRigidBody_setDamping(lua_State* state)
  1390. {
  1391. // Get the number of parameters.
  1392. int paramCount = lua_gettop(state);
  1393. // Attempt to match the parameters to a valid binding.
  1394. switch (paramCount)
  1395. {
  1396. case 3:
  1397. {
  1398. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1399. lua_type(state, 2) == LUA_TNUMBER &&
  1400. lua_type(state, 3) == LUA_TNUMBER)
  1401. {
  1402. // Get parameter 1 off the stack.
  1403. float param1 = (float)luaL_checknumber(state, 2);
  1404. // Get parameter 2 off the stack.
  1405. float param2 = (float)luaL_checknumber(state, 3);
  1406. PhysicsRigidBody* instance = getInstance(state);
  1407. instance->setDamping(param1, param2);
  1408. return 0;
  1409. }
  1410. else
  1411. {
  1412. lua_pushstring(state, "lua_PhysicsRigidBody_setDamping - Failed to match the given parameters to a valid function signature.");
  1413. lua_error(state);
  1414. }
  1415. break;
  1416. }
  1417. default:
  1418. {
  1419. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  1420. lua_error(state);
  1421. break;
  1422. }
  1423. }
  1424. return 0;
  1425. }
  1426. int lua_PhysicsRigidBody_setEnabled(lua_State* state)
  1427. {
  1428. // Get the number of parameters.
  1429. int paramCount = lua_gettop(state);
  1430. // Attempt to match the parameters to a valid binding.
  1431. switch (paramCount)
  1432. {
  1433. case 2:
  1434. {
  1435. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1436. lua_type(state, 2) == LUA_TBOOLEAN)
  1437. {
  1438. // Get parameter 1 off the stack.
  1439. bool param1 = ScriptUtil::luaCheckBool(state, 2);
  1440. PhysicsRigidBody* instance = getInstance(state);
  1441. instance->setEnabled(param1);
  1442. return 0;
  1443. }
  1444. else
  1445. {
  1446. lua_pushstring(state, "lua_PhysicsRigidBody_setEnabled - Failed to match the given parameters to a valid function signature.");
  1447. lua_error(state);
  1448. }
  1449. break;
  1450. }
  1451. default:
  1452. {
  1453. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1454. lua_error(state);
  1455. break;
  1456. }
  1457. }
  1458. return 0;
  1459. }
  1460. int lua_PhysicsRigidBody_setFriction(lua_State* state)
  1461. {
  1462. // Get the number of parameters.
  1463. int paramCount = lua_gettop(state);
  1464. // Attempt to match the parameters to a valid binding.
  1465. switch (paramCount)
  1466. {
  1467. case 2:
  1468. {
  1469. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1470. lua_type(state, 2) == LUA_TNUMBER)
  1471. {
  1472. // Get parameter 1 off the stack.
  1473. float param1 = (float)luaL_checknumber(state, 2);
  1474. PhysicsRigidBody* instance = getInstance(state);
  1475. instance->setFriction(param1);
  1476. return 0;
  1477. }
  1478. else
  1479. {
  1480. lua_pushstring(state, "lua_PhysicsRigidBody_setFriction - Failed to match the given parameters to a valid function signature.");
  1481. lua_error(state);
  1482. }
  1483. break;
  1484. }
  1485. default:
  1486. {
  1487. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1488. lua_error(state);
  1489. break;
  1490. }
  1491. }
  1492. return 0;
  1493. }
  1494. int lua_PhysicsRigidBody_setGravity(lua_State* state)
  1495. {
  1496. // Get the number of parameters.
  1497. int paramCount = lua_gettop(state);
  1498. // Attempt to match the parameters to a valid binding.
  1499. switch (paramCount)
  1500. {
  1501. case 2:
  1502. {
  1503. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1504. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  1505. {
  1506. // Get parameter 1 off the stack.
  1507. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  1508. PhysicsRigidBody* instance = getInstance(state);
  1509. instance->setGravity(*param1);
  1510. return 0;
  1511. }
  1512. else
  1513. {
  1514. lua_pushstring(state, "lua_PhysicsRigidBody_setGravity - Failed to match the given parameters to a valid function signature.");
  1515. lua_error(state);
  1516. }
  1517. break;
  1518. }
  1519. case 4:
  1520. {
  1521. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1522. lua_type(state, 2) == LUA_TNUMBER &&
  1523. lua_type(state, 3) == LUA_TNUMBER &&
  1524. lua_type(state, 4) == LUA_TNUMBER)
  1525. {
  1526. // Get parameter 1 off the stack.
  1527. float param1 = (float)luaL_checknumber(state, 2);
  1528. // Get parameter 2 off the stack.
  1529. float param2 = (float)luaL_checknumber(state, 3);
  1530. // Get parameter 3 off the stack.
  1531. float param3 = (float)luaL_checknumber(state, 4);
  1532. PhysicsRigidBody* instance = getInstance(state);
  1533. instance->setGravity(param1, param2, param3);
  1534. return 0;
  1535. }
  1536. else
  1537. {
  1538. lua_pushstring(state, "lua_PhysicsRigidBody_setGravity - Failed to match the given parameters to a valid function signature.");
  1539. lua_error(state);
  1540. }
  1541. break;
  1542. }
  1543. default:
  1544. {
  1545. lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
  1546. lua_error(state);
  1547. break;
  1548. }
  1549. }
  1550. return 0;
  1551. }
  1552. int lua_PhysicsRigidBody_setKinematic(lua_State* state)
  1553. {
  1554. // Get the number of parameters.
  1555. int paramCount = lua_gettop(state);
  1556. // Attempt to match the parameters to a valid binding.
  1557. switch (paramCount)
  1558. {
  1559. case 2:
  1560. {
  1561. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1562. lua_type(state, 2) == LUA_TBOOLEAN)
  1563. {
  1564. // Get parameter 1 off the stack.
  1565. bool param1 = ScriptUtil::luaCheckBool(state, 2);
  1566. PhysicsRigidBody* instance = getInstance(state);
  1567. instance->setKinematic(param1);
  1568. return 0;
  1569. }
  1570. else
  1571. {
  1572. lua_pushstring(state, "lua_PhysicsRigidBody_setKinematic - Failed to match the given parameters to a valid function signature.");
  1573. lua_error(state);
  1574. }
  1575. break;
  1576. }
  1577. default:
  1578. {
  1579. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1580. lua_error(state);
  1581. break;
  1582. }
  1583. }
  1584. return 0;
  1585. }
  1586. int lua_PhysicsRigidBody_setLinearFactor(lua_State* state)
  1587. {
  1588. // Get the number of parameters.
  1589. int paramCount = lua_gettop(state);
  1590. // Attempt to match the parameters to a valid binding.
  1591. switch (paramCount)
  1592. {
  1593. case 2:
  1594. {
  1595. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1596. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  1597. {
  1598. // Get parameter 1 off the stack.
  1599. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  1600. PhysicsRigidBody* instance = getInstance(state);
  1601. instance->setLinearFactor(*param1);
  1602. return 0;
  1603. }
  1604. else
  1605. {
  1606. lua_pushstring(state, "lua_PhysicsRigidBody_setLinearFactor - Failed to match the given parameters to a valid function signature.");
  1607. lua_error(state);
  1608. }
  1609. break;
  1610. }
  1611. case 4:
  1612. {
  1613. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1614. lua_type(state, 2) == LUA_TNUMBER &&
  1615. lua_type(state, 3) == LUA_TNUMBER &&
  1616. lua_type(state, 4) == LUA_TNUMBER)
  1617. {
  1618. // Get parameter 1 off the stack.
  1619. float param1 = (float)luaL_checknumber(state, 2);
  1620. // Get parameter 2 off the stack.
  1621. float param2 = (float)luaL_checknumber(state, 3);
  1622. // Get parameter 3 off the stack.
  1623. float param3 = (float)luaL_checknumber(state, 4);
  1624. PhysicsRigidBody* instance = getInstance(state);
  1625. instance->setLinearFactor(param1, param2, param3);
  1626. return 0;
  1627. }
  1628. else
  1629. {
  1630. lua_pushstring(state, "lua_PhysicsRigidBody_setLinearFactor - Failed to match the given parameters to a valid function signature.");
  1631. lua_error(state);
  1632. }
  1633. break;
  1634. }
  1635. default:
  1636. {
  1637. lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
  1638. lua_error(state);
  1639. break;
  1640. }
  1641. }
  1642. return 0;
  1643. }
  1644. int lua_PhysicsRigidBody_setLinearVelocity(lua_State* state)
  1645. {
  1646. // Get the number of parameters.
  1647. int paramCount = lua_gettop(state);
  1648. // Attempt to match the parameters to a valid binding.
  1649. switch (paramCount)
  1650. {
  1651. case 2:
  1652. {
  1653. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1654. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  1655. {
  1656. // Get parameter 1 off the stack.
  1657. ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  1658. PhysicsRigidBody* instance = getInstance(state);
  1659. instance->setLinearVelocity(*param1);
  1660. return 0;
  1661. }
  1662. else
  1663. {
  1664. lua_pushstring(state, "lua_PhysicsRigidBody_setLinearVelocity - Failed to match the given parameters to a valid function signature.");
  1665. lua_error(state);
  1666. }
  1667. break;
  1668. }
  1669. case 4:
  1670. {
  1671. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1672. lua_type(state, 2) == LUA_TNUMBER &&
  1673. lua_type(state, 3) == LUA_TNUMBER &&
  1674. lua_type(state, 4) == LUA_TNUMBER)
  1675. {
  1676. // Get parameter 1 off the stack.
  1677. float param1 = (float)luaL_checknumber(state, 2);
  1678. // Get parameter 2 off the stack.
  1679. float param2 = (float)luaL_checknumber(state, 3);
  1680. // Get parameter 3 off the stack.
  1681. float param3 = (float)luaL_checknumber(state, 4);
  1682. PhysicsRigidBody* instance = getInstance(state);
  1683. instance->setLinearVelocity(param1, param2, param3);
  1684. return 0;
  1685. }
  1686. else
  1687. {
  1688. lua_pushstring(state, "lua_PhysicsRigidBody_setLinearVelocity - Failed to match the given parameters to a valid function signature.");
  1689. lua_error(state);
  1690. }
  1691. break;
  1692. }
  1693. default:
  1694. {
  1695. lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
  1696. lua_error(state);
  1697. break;
  1698. }
  1699. }
  1700. return 0;
  1701. }
  1702. int lua_PhysicsRigidBody_setRestitution(lua_State* state)
  1703. {
  1704. // Get the number of parameters.
  1705. int paramCount = lua_gettop(state);
  1706. // Attempt to match the parameters to a valid binding.
  1707. switch (paramCount)
  1708. {
  1709. case 2:
  1710. {
  1711. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1712. lua_type(state, 2) == LUA_TNUMBER)
  1713. {
  1714. // Get parameter 1 off the stack.
  1715. float param1 = (float)luaL_checknumber(state, 2);
  1716. PhysicsRigidBody* instance = getInstance(state);
  1717. instance->setRestitution(param1);
  1718. return 0;
  1719. }
  1720. else
  1721. {
  1722. lua_pushstring(state, "lua_PhysicsRigidBody_setRestitution - Failed to match the given parameters to a valid function signature.");
  1723. lua_error(state);
  1724. }
  1725. break;
  1726. }
  1727. default:
  1728. {
  1729. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1730. lua_error(state);
  1731. break;
  1732. }
  1733. }
  1734. return 0;
  1735. }
  1736. }