lua_PhysicsCharacter.cpp 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547
  1. #include "Base.h"
  2. #include "ScriptController.h"
  3. #include "lua_PhysicsCharacter.h"
  4. #include "Animation.h"
  5. #include "AnimationTarget.h"
  6. #include "Base.h"
  7. #include "Game.h"
  8. #include "Node.h"
  9. #include "PhysicsCharacter.h"
  10. #include "PhysicsCollisionObject.h"
  11. #include "PhysicsController.h"
  12. #include "PhysicsGhostObject.h"
  13. #include "PhysicsRigidBody.h"
  14. #include "PhysicsVehicle.h"
  15. #include "PhysicsVehicleWheel.h"
  16. #include "Scene.h"
  17. #include "ScriptController.h"
  18. #include "ScriptTarget.h"
  19. #include "Transform.h"
  20. #include "lua_CurveInterpolationType.h"
  21. #include "lua_PhysicsCollisionObjectCollisionListenerEventType.h"
  22. #include "lua_PhysicsCollisionObjectType.h"
  23. #include "lua_PhysicsCollisionShapeType.h"
  24. namespace gameplay
  25. {
  26. void luaRegister_PhysicsCharacter()
  27. {
  28. const luaL_Reg lua_members[] =
  29. {
  30. {"addCollisionListener", lua_PhysicsCharacter_addCollisionListener},
  31. {"asCharacter", lua_PhysicsCharacter_asCharacter},
  32. {"asGhostObject", lua_PhysicsCharacter_asGhostObject},
  33. {"asRigidBody", lua_PhysicsCharacter_asRigidBody},
  34. {"asVehicle", lua_PhysicsCharacter_asVehicle},
  35. {"asVehicleWheel", lua_PhysicsCharacter_asVehicleWheel},
  36. {"collidesWith", lua_PhysicsCharacter_collidesWith},
  37. {"getCollisionShape", lua_PhysicsCharacter_getCollisionShape},
  38. {"getCurrentVelocity", lua_PhysicsCharacter_getCurrentVelocity},
  39. {"getMaxSlopeAngle", lua_PhysicsCharacter_getMaxSlopeAngle},
  40. {"getMaxStepHeight", lua_PhysicsCharacter_getMaxStepHeight},
  41. {"getNode", lua_PhysicsCharacter_getNode},
  42. {"getShapeType", lua_PhysicsCharacter_getShapeType},
  43. {"getType", lua_PhysicsCharacter_getType},
  44. {"isDynamic", lua_PhysicsCharacter_isDynamic},
  45. {"isEnabled", lua_PhysicsCharacter_isEnabled},
  46. {"isKinematic", lua_PhysicsCharacter_isKinematic},
  47. {"isPhysicsEnabled", lua_PhysicsCharacter_isPhysicsEnabled},
  48. {"isStatic", lua_PhysicsCharacter_isStatic},
  49. {"jump", lua_PhysicsCharacter_jump},
  50. {"removeCollisionListener", lua_PhysicsCharacter_removeCollisionListener},
  51. {"rotate", lua_PhysicsCharacter_rotate},
  52. {"setEnabled", lua_PhysicsCharacter_setEnabled},
  53. {"setForwardVelocity", lua_PhysicsCharacter_setForwardVelocity},
  54. {"setMaxSlopeAngle", lua_PhysicsCharacter_setMaxSlopeAngle},
  55. {"setMaxStepHeight", lua_PhysicsCharacter_setMaxStepHeight},
  56. {"setPhysicsEnabled", lua_PhysicsCharacter_setPhysicsEnabled},
  57. {"setRightVelocity", lua_PhysicsCharacter_setRightVelocity},
  58. {"setRotation", lua_PhysicsCharacter_setRotation},
  59. {"setVelocity", lua_PhysicsCharacter_setVelocity},
  60. {"transformChanged", lua_PhysicsCharacter_transformChanged},
  61. {NULL, NULL}
  62. };
  63. const luaL_Reg* lua_statics = NULL;
  64. std::vector<std::string> scopePath;
  65. gameplay::ScriptUtil::registerClass("PhysicsCharacter", lua_members, NULL, NULL, lua_statics, scopePath);
  66. }
  67. static PhysicsCharacter* getInstance(lua_State* state)
  68. {
  69. void* userdata = luaL_checkudata(state, 1, "PhysicsCharacter");
  70. luaL_argcheck(state, userdata != NULL, 1, "'PhysicsCharacter' expected.");
  71. return (PhysicsCharacter*)((gameplay::ScriptUtil::LuaObject*)userdata)->instance;
  72. }
  73. int lua_PhysicsCharacter_addCollisionListener(lua_State* state)
  74. {
  75. // Get the number of parameters.
  76. int paramCount = lua_gettop(state);
  77. // Attempt to match the parameters to a valid binding.
  78. switch (paramCount)
  79. {
  80. case 2:
  81. {
  82. do
  83. {
  84. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  85. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  86. {
  87. // Get parameter 1 off the stack.
  88. bool param1Valid;
  89. gameplay::ScriptUtil::LuaArray<PhysicsCollisionObject::CollisionListener> param1 = gameplay::ScriptUtil::getObjectPointer<PhysicsCollisionObject::CollisionListener>(2, "PhysicsCollisionObjectCollisionListener", false, &param1Valid);
  90. if (!param1Valid)
  91. break;
  92. PhysicsCharacter* instance = getInstance(state);
  93. instance->addCollisionListener(param1);
  94. return 0;
  95. }
  96. } while (0);
  97. do
  98. {
  99. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  100. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  101. {
  102. // Get parameter 1 off the stack.
  103. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  104. PhysicsCharacter* instance = getInstance(state);
  105. instance->addCollisionListener(param1);
  106. return 0;
  107. }
  108. } while (0);
  109. lua_pushstring(state, "lua_PhysicsCharacter_addCollisionListener - Failed to match the given parameters to a valid function signature.");
  110. lua_error(state);
  111. break;
  112. }
  113. case 3:
  114. {
  115. do
  116. {
  117. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  118. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  119. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  120. {
  121. // Get parameter 1 off the stack.
  122. bool param1Valid;
  123. gameplay::ScriptUtil::LuaArray<PhysicsCollisionObject::CollisionListener> param1 = gameplay::ScriptUtil::getObjectPointer<PhysicsCollisionObject::CollisionListener>(2, "PhysicsCollisionObjectCollisionListener", false, &param1Valid);
  124. if (!param1Valid)
  125. break;
  126. // Get parameter 2 off the stack.
  127. bool param2Valid;
  128. gameplay::ScriptUtil::LuaArray<PhysicsCollisionObject> param2 = gameplay::ScriptUtil::getObjectPointer<PhysicsCollisionObject>(3, "PhysicsCollisionObject", false, &param2Valid);
  129. if (!param2Valid)
  130. break;
  131. PhysicsCharacter* instance = getInstance(state);
  132. instance->addCollisionListener(param1, param2);
  133. return 0;
  134. }
  135. } while (0);
  136. do
  137. {
  138. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  139. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  140. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  141. {
  142. // Get parameter 1 off the stack.
  143. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  144. // Get parameter 2 off the stack.
  145. bool param2Valid;
  146. gameplay::ScriptUtil::LuaArray<PhysicsCollisionObject> param2 = gameplay::ScriptUtil::getObjectPointer<PhysicsCollisionObject>(3, "PhysicsCollisionObject", false, &param2Valid);
  147. if (!param2Valid)
  148. break;
  149. PhysicsCharacter* instance = getInstance(state);
  150. instance->addCollisionListener(param1, param2);
  151. return 0;
  152. }
  153. } while (0);
  154. lua_pushstring(state, "lua_PhysicsCharacter_addCollisionListener - Failed to match the given parameters to a valid function signature.");
  155. lua_error(state);
  156. break;
  157. }
  158. default:
  159. {
  160. lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
  161. lua_error(state);
  162. break;
  163. }
  164. }
  165. return 0;
  166. }
  167. int lua_PhysicsCharacter_asCharacter(lua_State* state)
  168. {
  169. // Get the number of parameters.
  170. int paramCount = lua_gettop(state);
  171. // Attempt to match the parameters to a valid binding.
  172. switch (paramCount)
  173. {
  174. case 1:
  175. {
  176. if ((lua_type(state, 1) == LUA_TUSERDATA))
  177. {
  178. PhysicsCharacter* instance = getInstance(state);
  179. void* returnPtr = (void*)instance->asCharacter();
  180. if (returnPtr)
  181. {
  182. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  183. object->instance = returnPtr;
  184. object->owns = false;
  185. luaL_getmetatable(state, "PhysicsCharacter");
  186. lua_setmetatable(state, -2);
  187. }
  188. else
  189. {
  190. lua_pushnil(state);
  191. }
  192. return 1;
  193. }
  194. lua_pushstring(state, "lua_PhysicsCharacter_asCharacter - Failed to match the given parameters to a valid function signature.");
  195. lua_error(state);
  196. break;
  197. }
  198. default:
  199. {
  200. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  201. lua_error(state);
  202. break;
  203. }
  204. }
  205. return 0;
  206. }
  207. int lua_PhysicsCharacter_asGhostObject(lua_State* state)
  208. {
  209. // Get the number of parameters.
  210. int paramCount = lua_gettop(state);
  211. // Attempt to match the parameters to a valid binding.
  212. switch (paramCount)
  213. {
  214. case 1:
  215. {
  216. if ((lua_type(state, 1) == LUA_TUSERDATA))
  217. {
  218. PhysicsCharacter* instance = getInstance(state);
  219. void* returnPtr = (void*)instance->asGhostObject();
  220. if (returnPtr)
  221. {
  222. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  223. object->instance = returnPtr;
  224. object->owns = false;
  225. luaL_getmetatable(state, "PhysicsGhostObject");
  226. lua_setmetatable(state, -2);
  227. }
  228. else
  229. {
  230. lua_pushnil(state);
  231. }
  232. return 1;
  233. }
  234. lua_pushstring(state, "lua_PhysicsCharacter_asGhostObject - Failed to match the given parameters to a valid function signature.");
  235. lua_error(state);
  236. break;
  237. }
  238. default:
  239. {
  240. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  241. lua_error(state);
  242. break;
  243. }
  244. }
  245. return 0;
  246. }
  247. int lua_PhysicsCharacter_asRigidBody(lua_State* state)
  248. {
  249. // Get the number of parameters.
  250. int paramCount = lua_gettop(state);
  251. // Attempt to match the parameters to a valid binding.
  252. switch (paramCount)
  253. {
  254. case 1:
  255. {
  256. if ((lua_type(state, 1) == LUA_TUSERDATA))
  257. {
  258. PhysicsCharacter* instance = getInstance(state);
  259. void* returnPtr = (void*)instance->asRigidBody();
  260. if (returnPtr)
  261. {
  262. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  263. object->instance = returnPtr;
  264. object->owns = false;
  265. luaL_getmetatable(state, "PhysicsRigidBody");
  266. lua_setmetatable(state, -2);
  267. }
  268. else
  269. {
  270. lua_pushnil(state);
  271. }
  272. return 1;
  273. }
  274. lua_pushstring(state, "lua_PhysicsCharacter_asRigidBody - Failed to match the given parameters to a valid function signature.");
  275. lua_error(state);
  276. break;
  277. }
  278. default:
  279. {
  280. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  281. lua_error(state);
  282. break;
  283. }
  284. }
  285. return 0;
  286. }
  287. int lua_PhysicsCharacter_asVehicle(lua_State* state)
  288. {
  289. // Get the number of parameters.
  290. int paramCount = lua_gettop(state);
  291. // Attempt to match the parameters to a valid binding.
  292. switch (paramCount)
  293. {
  294. case 1:
  295. {
  296. if ((lua_type(state, 1) == LUA_TUSERDATA))
  297. {
  298. PhysicsCharacter* instance = getInstance(state);
  299. void* returnPtr = (void*)instance->asVehicle();
  300. if (returnPtr)
  301. {
  302. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  303. object->instance = returnPtr;
  304. object->owns = false;
  305. luaL_getmetatable(state, "PhysicsVehicle");
  306. lua_setmetatable(state, -2);
  307. }
  308. else
  309. {
  310. lua_pushnil(state);
  311. }
  312. return 1;
  313. }
  314. lua_pushstring(state, "lua_PhysicsCharacter_asVehicle - Failed to match the given parameters to a valid function signature.");
  315. lua_error(state);
  316. break;
  317. }
  318. default:
  319. {
  320. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  321. lua_error(state);
  322. break;
  323. }
  324. }
  325. return 0;
  326. }
  327. int lua_PhysicsCharacter_asVehicleWheel(lua_State* state)
  328. {
  329. // Get the number of parameters.
  330. int paramCount = lua_gettop(state);
  331. // Attempt to match the parameters to a valid binding.
  332. switch (paramCount)
  333. {
  334. case 1:
  335. {
  336. if ((lua_type(state, 1) == LUA_TUSERDATA))
  337. {
  338. PhysicsCharacter* instance = getInstance(state);
  339. void* returnPtr = (void*)instance->asVehicleWheel();
  340. if (returnPtr)
  341. {
  342. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  343. object->instance = returnPtr;
  344. object->owns = false;
  345. luaL_getmetatable(state, "PhysicsVehicleWheel");
  346. lua_setmetatable(state, -2);
  347. }
  348. else
  349. {
  350. lua_pushnil(state);
  351. }
  352. return 1;
  353. }
  354. lua_pushstring(state, "lua_PhysicsCharacter_asVehicleWheel - Failed to match the given parameters to a valid function signature.");
  355. lua_error(state);
  356. break;
  357. }
  358. default:
  359. {
  360. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  361. lua_error(state);
  362. break;
  363. }
  364. }
  365. return 0;
  366. }
  367. int lua_PhysicsCharacter_collidesWith(lua_State* state)
  368. {
  369. // Get the number of parameters.
  370. int paramCount = lua_gettop(state);
  371. // Attempt to match the parameters to a valid binding.
  372. switch (paramCount)
  373. {
  374. case 2:
  375. {
  376. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  377. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  378. {
  379. // Get parameter 1 off the stack.
  380. bool param1Valid;
  381. gameplay::ScriptUtil::LuaArray<PhysicsCollisionObject> param1 = gameplay::ScriptUtil::getObjectPointer<PhysicsCollisionObject>(2, "PhysicsCollisionObject", false, &param1Valid);
  382. if (!param1Valid)
  383. {
  384. lua_pushstring(state, "Failed to convert parameter 1 to type 'PhysicsCollisionObject'.");
  385. lua_error(state);
  386. }
  387. PhysicsCharacter* instance = getInstance(state);
  388. bool result = instance->collidesWith(param1);
  389. // Push the return value onto the stack.
  390. lua_pushboolean(state, result);
  391. return 1;
  392. }
  393. lua_pushstring(state, "lua_PhysicsCharacter_collidesWith - Failed to match the given parameters to a valid function signature.");
  394. lua_error(state);
  395. break;
  396. }
  397. default:
  398. {
  399. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  400. lua_error(state);
  401. break;
  402. }
  403. }
  404. return 0;
  405. }
  406. int lua_PhysicsCharacter_getCollisionShape(lua_State* state)
  407. {
  408. // Get the number of parameters.
  409. int paramCount = lua_gettop(state);
  410. // Attempt to match the parameters to a valid binding.
  411. switch (paramCount)
  412. {
  413. case 1:
  414. {
  415. if ((lua_type(state, 1) == LUA_TUSERDATA))
  416. {
  417. PhysicsCharacter* instance = getInstance(state);
  418. void* returnPtr = (void*)instance->getCollisionShape();
  419. if (returnPtr)
  420. {
  421. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  422. object->instance = returnPtr;
  423. object->owns = false;
  424. luaL_getmetatable(state, "PhysicsCollisionShape");
  425. lua_setmetatable(state, -2);
  426. }
  427. else
  428. {
  429. lua_pushnil(state);
  430. }
  431. return 1;
  432. }
  433. lua_pushstring(state, "lua_PhysicsCharacter_getCollisionShape - Failed to match the given parameters to a valid function signature.");
  434. lua_error(state);
  435. break;
  436. }
  437. default:
  438. {
  439. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  440. lua_error(state);
  441. break;
  442. }
  443. }
  444. return 0;
  445. }
  446. int lua_PhysicsCharacter_getCurrentVelocity(lua_State* state)
  447. {
  448. // Get the number of parameters.
  449. int paramCount = lua_gettop(state);
  450. // Attempt to match the parameters to a valid binding.
  451. switch (paramCount)
  452. {
  453. case 1:
  454. {
  455. if ((lua_type(state, 1) == LUA_TUSERDATA))
  456. {
  457. PhysicsCharacter* instance = getInstance(state);
  458. void* returnPtr = (void*)new Vector3(instance->getCurrentVelocity());
  459. if (returnPtr)
  460. {
  461. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  462. object->instance = returnPtr;
  463. object->owns = true;
  464. luaL_getmetatable(state, "Vector3");
  465. lua_setmetatable(state, -2);
  466. }
  467. else
  468. {
  469. lua_pushnil(state);
  470. }
  471. return 1;
  472. }
  473. lua_pushstring(state, "lua_PhysicsCharacter_getCurrentVelocity - Failed to match the given parameters to a valid function signature.");
  474. lua_error(state);
  475. break;
  476. }
  477. default:
  478. {
  479. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  480. lua_error(state);
  481. break;
  482. }
  483. }
  484. return 0;
  485. }
  486. int lua_PhysicsCharacter_getMaxSlopeAngle(lua_State* state)
  487. {
  488. // Get the number of parameters.
  489. int paramCount = lua_gettop(state);
  490. // Attempt to match the parameters to a valid binding.
  491. switch (paramCount)
  492. {
  493. case 1:
  494. {
  495. if ((lua_type(state, 1) == LUA_TUSERDATA))
  496. {
  497. PhysicsCharacter* instance = getInstance(state);
  498. float result = instance->getMaxSlopeAngle();
  499. // Push the return value onto the stack.
  500. lua_pushnumber(state, result);
  501. return 1;
  502. }
  503. lua_pushstring(state, "lua_PhysicsCharacter_getMaxSlopeAngle - Failed to match the given parameters to a valid function signature.");
  504. lua_error(state);
  505. break;
  506. }
  507. default:
  508. {
  509. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  510. lua_error(state);
  511. break;
  512. }
  513. }
  514. return 0;
  515. }
  516. int lua_PhysicsCharacter_getMaxStepHeight(lua_State* state)
  517. {
  518. // Get the number of parameters.
  519. int paramCount = lua_gettop(state);
  520. // Attempt to match the parameters to a valid binding.
  521. switch (paramCount)
  522. {
  523. case 1:
  524. {
  525. if ((lua_type(state, 1) == LUA_TUSERDATA))
  526. {
  527. PhysicsCharacter* instance = getInstance(state);
  528. float result = instance->getMaxStepHeight();
  529. // Push the return value onto the stack.
  530. lua_pushnumber(state, result);
  531. return 1;
  532. }
  533. lua_pushstring(state, "lua_PhysicsCharacter_getMaxStepHeight - Failed to match the given parameters to a valid function signature.");
  534. lua_error(state);
  535. break;
  536. }
  537. default:
  538. {
  539. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  540. lua_error(state);
  541. break;
  542. }
  543. }
  544. return 0;
  545. }
  546. int lua_PhysicsCharacter_getNode(lua_State* state)
  547. {
  548. // Get the number of parameters.
  549. int paramCount = lua_gettop(state);
  550. // Attempt to match the parameters to a valid binding.
  551. switch (paramCount)
  552. {
  553. case 1:
  554. {
  555. if ((lua_type(state, 1) == LUA_TUSERDATA))
  556. {
  557. PhysicsCharacter* instance = getInstance(state);
  558. void* returnPtr = (void*)instance->getNode();
  559. if (returnPtr)
  560. {
  561. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  562. object->instance = returnPtr;
  563. object->owns = false;
  564. luaL_getmetatable(state, "Node");
  565. lua_setmetatable(state, -2);
  566. }
  567. else
  568. {
  569. lua_pushnil(state);
  570. }
  571. return 1;
  572. }
  573. lua_pushstring(state, "lua_PhysicsCharacter_getNode - Failed to match the given parameters to a valid function signature.");
  574. lua_error(state);
  575. break;
  576. }
  577. default:
  578. {
  579. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  580. lua_error(state);
  581. break;
  582. }
  583. }
  584. return 0;
  585. }
  586. int lua_PhysicsCharacter_getShapeType(lua_State* state)
  587. {
  588. // Get the number of parameters.
  589. int paramCount = lua_gettop(state);
  590. // Attempt to match the parameters to a valid binding.
  591. switch (paramCount)
  592. {
  593. case 1:
  594. {
  595. if ((lua_type(state, 1) == LUA_TUSERDATA))
  596. {
  597. PhysicsCharacter* instance = getInstance(state);
  598. PhysicsCollisionShape::Type result = instance->getShapeType();
  599. // Push the return value onto the stack.
  600. lua_pushstring(state, lua_stringFromEnum_PhysicsCollisionShapeType(result));
  601. return 1;
  602. }
  603. lua_pushstring(state, "lua_PhysicsCharacter_getShapeType - Failed to match the given parameters to a valid function signature.");
  604. lua_error(state);
  605. break;
  606. }
  607. default:
  608. {
  609. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  610. lua_error(state);
  611. break;
  612. }
  613. }
  614. return 0;
  615. }
  616. int lua_PhysicsCharacter_getType(lua_State* state)
  617. {
  618. // Get the number of parameters.
  619. int paramCount = lua_gettop(state);
  620. // Attempt to match the parameters to a valid binding.
  621. switch (paramCount)
  622. {
  623. case 1:
  624. {
  625. if ((lua_type(state, 1) == LUA_TUSERDATA))
  626. {
  627. PhysicsCharacter* instance = getInstance(state);
  628. PhysicsCollisionObject::Type result = instance->getType();
  629. // Push the return value onto the stack.
  630. lua_pushstring(state, lua_stringFromEnum_PhysicsCollisionObjectType(result));
  631. return 1;
  632. }
  633. lua_pushstring(state, "lua_PhysicsCharacter_getType - Failed to match the given parameters to a valid function signature.");
  634. lua_error(state);
  635. break;
  636. }
  637. default:
  638. {
  639. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  640. lua_error(state);
  641. break;
  642. }
  643. }
  644. return 0;
  645. }
  646. int lua_PhysicsCharacter_isDynamic(lua_State* state)
  647. {
  648. // Get the number of parameters.
  649. int paramCount = lua_gettop(state);
  650. // Attempt to match the parameters to a valid binding.
  651. switch (paramCount)
  652. {
  653. case 1:
  654. {
  655. if ((lua_type(state, 1) == LUA_TUSERDATA))
  656. {
  657. PhysicsCharacter* instance = getInstance(state);
  658. bool result = instance->isDynamic();
  659. // Push the return value onto the stack.
  660. lua_pushboolean(state, result);
  661. return 1;
  662. }
  663. lua_pushstring(state, "lua_PhysicsCharacter_isDynamic - Failed to match the given parameters to a valid function signature.");
  664. lua_error(state);
  665. break;
  666. }
  667. default:
  668. {
  669. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  670. lua_error(state);
  671. break;
  672. }
  673. }
  674. return 0;
  675. }
  676. int lua_PhysicsCharacter_isEnabled(lua_State* state)
  677. {
  678. // Get the number of parameters.
  679. int paramCount = lua_gettop(state);
  680. // Attempt to match the parameters to a valid binding.
  681. switch (paramCount)
  682. {
  683. case 1:
  684. {
  685. if ((lua_type(state, 1) == LUA_TUSERDATA))
  686. {
  687. PhysicsCharacter* instance = getInstance(state);
  688. bool result = instance->isEnabled();
  689. // Push the return value onto the stack.
  690. lua_pushboolean(state, result);
  691. return 1;
  692. }
  693. lua_pushstring(state, "lua_PhysicsCharacter_isEnabled - Failed to match the given parameters to a valid function signature.");
  694. lua_error(state);
  695. break;
  696. }
  697. default:
  698. {
  699. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  700. lua_error(state);
  701. break;
  702. }
  703. }
  704. return 0;
  705. }
  706. int lua_PhysicsCharacter_isKinematic(lua_State* state)
  707. {
  708. // Get the number of parameters.
  709. int paramCount = lua_gettop(state);
  710. // Attempt to match the parameters to a valid binding.
  711. switch (paramCount)
  712. {
  713. case 1:
  714. {
  715. if ((lua_type(state, 1) == LUA_TUSERDATA))
  716. {
  717. PhysicsCharacter* instance = getInstance(state);
  718. bool result = instance->isKinematic();
  719. // Push the return value onto the stack.
  720. lua_pushboolean(state, result);
  721. return 1;
  722. }
  723. lua_pushstring(state, "lua_PhysicsCharacter_isKinematic - Failed to match the given parameters to a valid function signature.");
  724. lua_error(state);
  725. break;
  726. }
  727. default:
  728. {
  729. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  730. lua_error(state);
  731. break;
  732. }
  733. }
  734. return 0;
  735. }
  736. int lua_PhysicsCharacter_isPhysicsEnabled(lua_State* state)
  737. {
  738. // Get the number of parameters.
  739. int paramCount = lua_gettop(state);
  740. // Attempt to match the parameters to a valid binding.
  741. switch (paramCount)
  742. {
  743. case 1:
  744. {
  745. if ((lua_type(state, 1) == LUA_TUSERDATA))
  746. {
  747. PhysicsCharacter* instance = getInstance(state);
  748. bool result = instance->isPhysicsEnabled();
  749. // Push the return value onto the stack.
  750. lua_pushboolean(state, result);
  751. return 1;
  752. }
  753. lua_pushstring(state, "lua_PhysicsCharacter_isPhysicsEnabled - Failed to match the given parameters to a valid function signature.");
  754. lua_error(state);
  755. break;
  756. }
  757. default:
  758. {
  759. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  760. lua_error(state);
  761. break;
  762. }
  763. }
  764. return 0;
  765. }
  766. int lua_PhysicsCharacter_isStatic(lua_State* state)
  767. {
  768. // Get the number of parameters.
  769. int paramCount = lua_gettop(state);
  770. // Attempt to match the parameters to a valid binding.
  771. switch (paramCount)
  772. {
  773. case 1:
  774. {
  775. if ((lua_type(state, 1) == LUA_TUSERDATA))
  776. {
  777. PhysicsCharacter* instance = getInstance(state);
  778. bool result = instance->isStatic();
  779. // Push the return value onto the stack.
  780. lua_pushboolean(state, result);
  781. return 1;
  782. }
  783. lua_pushstring(state, "lua_PhysicsCharacter_isStatic - Failed to match the given parameters to a valid function signature.");
  784. lua_error(state);
  785. break;
  786. }
  787. default:
  788. {
  789. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  790. lua_error(state);
  791. break;
  792. }
  793. }
  794. return 0;
  795. }
  796. int lua_PhysicsCharacter_jump(lua_State* state)
  797. {
  798. // Get the number of parameters.
  799. int paramCount = lua_gettop(state);
  800. // Attempt to match the parameters to a valid binding.
  801. switch (paramCount)
  802. {
  803. case 2:
  804. {
  805. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  806. lua_type(state, 2) == LUA_TNUMBER)
  807. {
  808. // Get parameter 1 off the stack.
  809. float param1 = (float)luaL_checknumber(state, 2);
  810. PhysicsCharacter* instance = getInstance(state);
  811. instance->jump(param1);
  812. return 0;
  813. }
  814. lua_pushstring(state, "lua_PhysicsCharacter_jump - Failed to match the given parameters to a valid function signature.");
  815. lua_error(state);
  816. break;
  817. }
  818. default:
  819. {
  820. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  821. lua_error(state);
  822. break;
  823. }
  824. }
  825. return 0;
  826. }
  827. int lua_PhysicsCharacter_removeCollisionListener(lua_State* state)
  828. {
  829. // Get the number of parameters.
  830. int paramCount = lua_gettop(state);
  831. // Attempt to match the parameters to a valid binding.
  832. switch (paramCount)
  833. {
  834. case 2:
  835. {
  836. do
  837. {
  838. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  839. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  840. {
  841. // Get parameter 1 off the stack.
  842. bool param1Valid;
  843. gameplay::ScriptUtil::LuaArray<PhysicsCollisionObject::CollisionListener> param1 = gameplay::ScriptUtil::getObjectPointer<PhysicsCollisionObject::CollisionListener>(2, "PhysicsCollisionObjectCollisionListener", false, &param1Valid);
  844. if (!param1Valid)
  845. break;
  846. PhysicsCharacter* instance = getInstance(state);
  847. instance->removeCollisionListener(param1);
  848. return 0;
  849. }
  850. } while (0);
  851. do
  852. {
  853. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  854. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  855. {
  856. // Get parameter 1 off the stack.
  857. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  858. PhysicsCharacter* instance = getInstance(state);
  859. instance->removeCollisionListener(param1);
  860. return 0;
  861. }
  862. } while (0);
  863. lua_pushstring(state, "lua_PhysicsCharacter_removeCollisionListener - Failed to match the given parameters to a valid function signature.");
  864. lua_error(state);
  865. break;
  866. }
  867. case 3:
  868. {
  869. do
  870. {
  871. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  872. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  873. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  874. {
  875. // Get parameter 1 off the stack.
  876. bool param1Valid;
  877. gameplay::ScriptUtil::LuaArray<PhysicsCollisionObject::CollisionListener> param1 = gameplay::ScriptUtil::getObjectPointer<PhysicsCollisionObject::CollisionListener>(2, "PhysicsCollisionObjectCollisionListener", false, &param1Valid);
  878. if (!param1Valid)
  879. break;
  880. // Get parameter 2 off the stack.
  881. bool param2Valid;
  882. gameplay::ScriptUtil::LuaArray<PhysicsCollisionObject> param2 = gameplay::ScriptUtil::getObjectPointer<PhysicsCollisionObject>(3, "PhysicsCollisionObject", false, &param2Valid);
  883. if (!param2Valid)
  884. break;
  885. PhysicsCharacter* instance = getInstance(state);
  886. instance->removeCollisionListener(param1, param2);
  887. return 0;
  888. }
  889. } while (0);
  890. do
  891. {
  892. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  893. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  894. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  895. {
  896. // Get parameter 1 off the stack.
  897. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  898. // Get parameter 2 off the stack.
  899. bool param2Valid;
  900. gameplay::ScriptUtil::LuaArray<PhysicsCollisionObject> param2 = gameplay::ScriptUtil::getObjectPointer<PhysicsCollisionObject>(3, "PhysicsCollisionObject", false, &param2Valid);
  901. if (!param2Valid)
  902. break;
  903. PhysicsCharacter* instance = getInstance(state);
  904. instance->removeCollisionListener(param1, param2);
  905. return 0;
  906. }
  907. } while (0);
  908. lua_pushstring(state, "lua_PhysicsCharacter_removeCollisionListener - Failed to match the given parameters to a valid function signature.");
  909. lua_error(state);
  910. break;
  911. }
  912. default:
  913. {
  914. lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
  915. lua_error(state);
  916. break;
  917. }
  918. }
  919. return 0;
  920. }
  921. int lua_PhysicsCharacter_rotate(lua_State* state)
  922. {
  923. // Get the number of parameters.
  924. int paramCount = lua_gettop(state);
  925. // Attempt to match the parameters to a valid binding.
  926. switch (paramCount)
  927. {
  928. case 2:
  929. {
  930. do
  931. {
  932. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  933. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  934. {
  935. // Get parameter 1 off the stack.
  936. bool param1Valid;
  937. gameplay::ScriptUtil::LuaArray<Quaternion> param1 = gameplay::ScriptUtil::getObjectPointer<Quaternion>(2, "Quaternion", true, &param1Valid);
  938. if (!param1Valid)
  939. break;
  940. PhysicsCharacter* instance = getInstance(state);
  941. instance->rotate(*param1);
  942. return 0;
  943. }
  944. } while (0);
  945. lua_pushstring(state, "lua_PhysicsCharacter_rotate - Failed to match the given parameters to a valid function signature.");
  946. lua_error(state);
  947. break;
  948. }
  949. case 3:
  950. {
  951. do
  952. {
  953. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  954. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  955. lua_type(state, 3) == LUA_TNUMBER)
  956. {
  957. // Get parameter 1 off the stack.
  958. bool param1Valid;
  959. gameplay::ScriptUtil::LuaArray<Vector3> param1 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param1Valid);
  960. if (!param1Valid)
  961. break;
  962. // Get parameter 2 off the stack.
  963. float param2 = (float)luaL_checknumber(state, 3);
  964. PhysicsCharacter* instance = getInstance(state);
  965. instance->rotate(*param1, param2);
  966. return 0;
  967. }
  968. } while (0);
  969. lua_pushstring(state, "lua_PhysicsCharacter_rotate - Failed to match the given parameters to a valid function signature.");
  970. lua_error(state);
  971. break;
  972. }
  973. default:
  974. {
  975. lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
  976. lua_error(state);
  977. break;
  978. }
  979. }
  980. return 0;
  981. }
  982. int lua_PhysicsCharacter_setEnabled(lua_State* state)
  983. {
  984. // Get the number of parameters.
  985. int paramCount = lua_gettop(state);
  986. // Attempt to match the parameters to a valid binding.
  987. switch (paramCount)
  988. {
  989. case 2:
  990. {
  991. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  992. lua_type(state, 2) == LUA_TBOOLEAN)
  993. {
  994. // Get parameter 1 off the stack.
  995. bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
  996. PhysicsCharacter* instance = getInstance(state);
  997. instance->setEnabled(param1);
  998. return 0;
  999. }
  1000. lua_pushstring(state, "lua_PhysicsCharacter_setEnabled - 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 2).");
  1007. lua_error(state);
  1008. break;
  1009. }
  1010. }
  1011. return 0;
  1012. }
  1013. int lua_PhysicsCharacter_setForwardVelocity(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. PhysicsCharacter* instance = getInstance(state);
  1025. instance->setForwardVelocity();
  1026. return 0;
  1027. }
  1028. lua_pushstring(state, "lua_PhysicsCharacter_setForwardVelocity - Failed to match the given parameters to a valid function signature.");
  1029. lua_error(state);
  1030. break;
  1031. }
  1032. case 2:
  1033. {
  1034. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1035. lua_type(state, 2) == LUA_TNUMBER)
  1036. {
  1037. // Get parameter 1 off the stack.
  1038. float param1 = (float)luaL_checknumber(state, 2);
  1039. PhysicsCharacter* instance = getInstance(state);
  1040. instance->setForwardVelocity(param1);
  1041. return 0;
  1042. }
  1043. lua_pushstring(state, "lua_PhysicsCharacter_setForwardVelocity - Failed to match the given parameters to a valid function signature.");
  1044. lua_error(state);
  1045. break;
  1046. }
  1047. default:
  1048. {
  1049. lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
  1050. lua_error(state);
  1051. break;
  1052. }
  1053. }
  1054. return 0;
  1055. }
  1056. int lua_PhysicsCharacter_setMaxSlopeAngle(lua_State* state)
  1057. {
  1058. // Get the number of parameters.
  1059. int paramCount = lua_gettop(state);
  1060. // Attempt to match the parameters to a valid binding.
  1061. switch (paramCount)
  1062. {
  1063. case 2:
  1064. {
  1065. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1066. lua_type(state, 2) == LUA_TNUMBER)
  1067. {
  1068. // Get parameter 1 off the stack.
  1069. float param1 = (float)luaL_checknumber(state, 2);
  1070. PhysicsCharacter* instance = getInstance(state);
  1071. instance->setMaxSlopeAngle(param1);
  1072. return 0;
  1073. }
  1074. lua_pushstring(state, "lua_PhysicsCharacter_setMaxSlopeAngle - Failed to match the given parameters to a valid function signature.");
  1075. lua_error(state);
  1076. break;
  1077. }
  1078. default:
  1079. {
  1080. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1081. lua_error(state);
  1082. break;
  1083. }
  1084. }
  1085. return 0;
  1086. }
  1087. int lua_PhysicsCharacter_setMaxStepHeight(lua_State* state)
  1088. {
  1089. // Get the number of parameters.
  1090. int paramCount = lua_gettop(state);
  1091. // Attempt to match the parameters to a valid binding.
  1092. switch (paramCount)
  1093. {
  1094. case 2:
  1095. {
  1096. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1097. lua_type(state, 2) == LUA_TNUMBER)
  1098. {
  1099. // Get parameter 1 off the stack.
  1100. float param1 = (float)luaL_checknumber(state, 2);
  1101. PhysicsCharacter* instance = getInstance(state);
  1102. instance->setMaxStepHeight(param1);
  1103. return 0;
  1104. }
  1105. lua_pushstring(state, "lua_PhysicsCharacter_setMaxStepHeight - Failed to match the given parameters to a valid function signature.");
  1106. lua_error(state);
  1107. break;
  1108. }
  1109. default:
  1110. {
  1111. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1112. lua_error(state);
  1113. break;
  1114. }
  1115. }
  1116. return 0;
  1117. }
  1118. int lua_PhysicsCharacter_setPhysicsEnabled(lua_State* state)
  1119. {
  1120. // Get the number of parameters.
  1121. int paramCount = lua_gettop(state);
  1122. // Attempt to match the parameters to a valid binding.
  1123. switch (paramCount)
  1124. {
  1125. case 2:
  1126. {
  1127. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1128. lua_type(state, 2) == LUA_TBOOLEAN)
  1129. {
  1130. // Get parameter 1 off the stack.
  1131. bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
  1132. PhysicsCharacter* instance = getInstance(state);
  1133. instance->setPhysicsEnabled(param1);
  1134. return 0;
  1135. }
  1136. lua_pushstring(state, "lua_PhysicsCharacter_setPhysicsEnabled - Failed to match the given parameters to a valid function signature.");
  1137. lua_error(state);
  1138. break;
  1139. }
  1140. default:
  1141. {
  1142. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1143. lua_error(state);
  1144. break;
  1145. }
  1146. }
  1147. return 0;
  1148. }
  1149. int lua_PhysicsCharacter_setRightVelocity(lua_State* state)
  1150. {
  1151. // Get the number of parameters.
  1152. int paramCount = lua_gettop(state);
  1153. // Attempt to match the parameters to a valid binding.
  1154. switch (paramCount)
  1155. {
  1156. case 1:
  1157. {
  1158. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1159. {
  1160. PhysicsCharacter* instance = getInstance(state);
  1161. instance->setRightVelocity();
  1162. return 0;
  1163. }
  1164. lua_pushstring(state, "lua_PhysicsCharacter_setRightVelocity - Failed to match the given parameters to a valid function signature.");
  1165. lua_error(state);
  1166. break;
  1167. }
  1168. case 2:
  1169. {
  1170. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1171. lua_type(state, 2) == LUA_TNUMBER)
  1172. {
  1173. // Get parameter 1 off the stack.
  1174. float param1 = (float)luaL_checknumber(state, 2);
  1175. PhysicsCharacter* instance = getInstance(state);
  1176. instance->setRightVelocity(param1);
  1177. return 0;
  1178. }
  1179. lua_pushstring(state, "lua_PhysicsCharacter_setRightVelocity - Failed to match the given parameters to a valid function signature.");
  1180. lua_error(state);
  1181. break;
  1182. }
  1183. default:
  1184. {
  1185. lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
  1186. lua_error(state);
  1187. break;
  1188. }
  1189. }
  1190. return 0;
  1191. }
  1192. int lua_PhysicsCharacter_setRotation(lua_State* state)
  1193. {
  1194. // Get the number of parameters.
  1195. int paramCount = lua_gettop(state);
  1196. // Attempt to match the parameters to a valid binding.
  1197. switch (paramCount)
  1198. {
  1199. case 2:
  1200. {
  1201. do
  1202. {
  1203. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1204. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  1205. {
  1206. // Get parameter 1 off the stack.
  1207. bool param1Valid;
  1208. gameplay::ScriptUtil::LuaArray<Quaternion> param1 = gameplay::ScriptUtil::getObjectPointer<Quaternion>(2, "Quaternion", true, &param1Valid);
  1209. if (!param1Valid)
  1210. break;
  1211. PhysicsCharacter* instance = getInstance(state);
  1212. instance->setRotation(*param1);
  1213. return 0;
  1214. }
  1215. } while (0);
  1216. lua_pushstring(state, "lua_PhysicsCharacter_setRotation - Failed to match the given parameters to a valid function signature.");
  1217. lua_error(state);
  1218. break;
  1219. }
  1220. case 3:
  1221. {
  1222. do
  1223. {
  1224. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1225. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  1226. lua_type(state, 3) == LUA_TNUMBER)
  1227. {
  1228. // Get parameter 1 off the stack.
  1229. bool param1Valid;
  1230. gameplay::ScriptUtil::LuaArray<Vector3> param1 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param1Valid);
  1231. if (!param1Valid)
  1232. break;
  1233. // Get parameter 2 off the stack.
  1234. float param2 = (float)luaL_checknumber(state, 3);
  1235. PhysicsCharacter* instance = getInstance(state);
  1236. instance->setRotation(*param1, param2);
  1237. return 0;
  1238. }
  1239. } while (0);
  1240. lua_pushstring(state, "lua_PhysicsCharacter_setRotation - Failed to match the given parameters to a valid function signature.");
  1241. lua_error(state);
  1242. break;
  1243. }
  1244. default:
  1245. {
  1246. lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
  1247. lua_error(state);
  1248. break;
  1249. }
  1250. }
  1251. return 0;
  1252. }
  1253. int lua_PhysicsCharacter_setVelocity(lua_State* state)
  1254. {
  1255. // Get the number of parameters.
  1256. int paramCount = lua_gettop(state);
  1257. // Attempt to match the parameters to a valid binding.
  1258. switch (paramCount)
  1259. {
  1260. case 2:
  1261. {
  1262. do
  1263. {
  1264. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1265. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  1266. {
  1267. // Get parameter 1 off the stack.
  1268. bool param1Valid;
  1269. gameplay::ScriptUtil::LuaArray<Vector3> param1 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param1Valid);
  1270. if (!param1Valid)
  1271. break;
  1272. PhysicsCharacter* instance = getInstance(state);
  1273. instance->setVelocity(*param1);
  1274. return 0;
  1275. }
  1276. } while (0);
  1277. lua_pushstring(state, "lua_PhysicsCharacter_setVelocity - Failed to match the given parameters to a valid function signature.");
  1278. lua_error(state);
  1279. break;
  1280. }
  1281. case 4:
  1282. {
  1283. do
  1284. {
  1285. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1286. lua_type(state, 2) == LUA_TNUMBER &&
  1287. lua_type(state, 3) == LUA_TNUMBER &&
  1288. lua_type(state, 4) == LUA_TNUMBER)
  1289. {
  1290. // Get parameter 1 off the stack.
  1291. float param1 = (float)luaL_checknumber(state, 2);
  1292. // Get parameter 2 off the stack.
  1293. float param2 = (float)luaL_checknumber(state, 3);
  1294. // Get parameter 3 off the stack.
  1295. float param3 = (float)luaL_checknumber(state, 4);
  1296. PhysicsCharacter* instance = getInstance(state);
  1297. instance->setVelocity(param1, param2, param3);
  1298. return 0;
  1299. }
  1300. } while (0);
  1301. lua_pushstring(state, "lua_PhysicsCharacter_setVelocity - 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 2 or 4).");
  1308. lua_error(state);
  1309. break;
  1310. }
  1311. }
  1312. return 0;
  1313. }
  1314. int lua_PhysicsCharacter_transformChanged(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 3:
  1322. {
  1323. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1324. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  1325. lua_type(state, 3) == LUA_TNUMBER)
  1326. {
  1327. // Get parameter 1 off the stack.
  1328. bool param1Valid;
  1329. gameplay::ScriptUtil::LuaArray<Transform> param1 = gameplay::ScriptUtil::getObjectPointer<Transform>(2, "Transform", false, &param1Valid);
  1330. if (!param1Valid)
  1331. {
  1332. lua_pushstring(state, "Failed to convert parameter 1 to type 'Transform'.");
  1333. lua_error(state);
  1334. }
  1335. // Get parameter 2 off the stack.
  1336. long param2 = (long)luaL_checklong(state, 3);
  1337. PhysicsCharacter* instance = getInstance(state);
  1338. instance->transformChanged(param1, param2);
  1339. return 0;
  1340. }
  1341. lua_pushstring(state, "lua_PhysicsCharacter_transformChanged - Failed to match the given parameters to a valid function signature.");
  1342. lua_error(state);
  1343. break;
  1344. }
  1345. default:
  1346. {
  1347. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  1348. lua_error(state);
  1349. break;
  1350. }
  1351. }
  1352. return 0;
  1353. }
  1354. }