lua_PhysicsSpringConstraint.cpp 44 KB

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