lua_PhysicsCharacter.cpp 44 KB

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