lua_PhysicsRigidBody.cpp 69 KB

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