2
0

lua_PhysicsRigidBody.cpp 57 KB

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