lua_PhysicsRigidBody.cpp 76 KB

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