lua_PhysicsGenericConstraint.cpp 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895
  1. #include "Base.h"
  2. #include "ScriptController.h"
  3. #include "lua_PhysicsGenericConstraint.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. namespace gameplay
  11. {
  12. void luaRegister_PhysicsGenericConstraint()
  13. {
  14. const luaL_Reg lua_members[] =
  15. {
  16. {"getBreakingImpulse", lua_PhysicsGenericConstraint_getBreakingImpulse},
  17. {"getRotationOffsetA", lua_PhysicsGenericConstraint_getRotationOffsetA},
  18. {"getRotationOffsetB", lua_PhysicsGenericConstraint_getRotationOffsetB},
  19. {"getTranslationOffsetA", lua_PhysicsGenericConstraint_getTranslationOffsetA},
  20. {"getTranslationOffsetB", lua_PhysicsGenericConstraint_getTranslationOffsetB},
  21. {"isEnabled", lua_PhysicsGenericConstraint_isEnabled},
  22. {"setAngularLowerLimit", lua_PhysicsGenericConstraint_setAngularLowerLimit},
  23. {"setAngularUpperLimit", lua_PhysicsGenericConstraint_setAngularUpperLimit},
  24. {"setBreakingImpulse", lua_PhysicsGenericConstraint_setBreakingImpulse},
  25. {"setEnabled", lua_PhysicsGenericConstraint_setEnabled},
  26. {"setLinearLowerLimit", lua_PhysicsGenericConstraint_setLinearLowerLimit},
  27. {"setLinearUpperLimit", lua_PhysicsGenericConstraint_setLinearUpperLimit},
  28. {"setRotationOffsetA", lua_PhysicsGenericConstraint_setRotationOffsetA},
  29. {"setRotationOffsetB", lua_PhysicsGenericConstraint_setRotationOffsetB},
  30. {"setTranslationOffsetA", lua_PhysicsGenericConstraint_setTranslationOffsetA},
  31. {"setTranslationOffsetB", lua_PhysicsGenericConstraint_setTranslationOffsetB},
  32. {NULL, NULL}
  33. };
  34. const luaL_Reg lua_statics[] =
  35. {
  36. {"centerOfMassMidpoint", lua_PhysicsGenericConstraint_static_centerOfMassMidpoint},
  37. {"getRotationOffset", lua_PhysicsGenericConstraint_static_getRotationOffset},
  38. {"getTranslationOffset", lua_PhysicsGenericConstraint_static_getTranslationOffset},
  39. {NULL, NULL}
  40. };
  41. std::vector<std::string> scopePath;
  42. gameplay::ScriptUtil::registerClass("PhysicsGenericConstraint", lua_members, NULL, NULL, lua_statics, scopePath);
  43. }
  44. static PhysicsGenericConstraint* getInstance(lua_State* state)
  45. {
  46. void* userdata = luaL_checkudata(state, 1, "PhysicsGenericConstraint");
  47. luaL_argcheck(state, userdata != NULL, 1, "'PhysicsGenericConstraint' expected.");
  48. return (PhysicsGenericConstraint*)((gameplay::ScriptUtil::LuaObject*)userdata)->instance;
  49. }
  50. int lua_PhysicsGenericConstraint_getBreakingImpulse(lua_State* state)
  51. {
  52. // Get the number of parameters.
  53. int paramCount = lua_gettop(state);
  54. // Attempt to match the parameters to a valid binding.
  55. switch (paramCount)
  56. {
  57. case 1:
  58. {
  59. if ((lua_type(state, 1) == LUA_TUSERDATA))
  60. {
  61. PhysicsGenericConstraint* instance = getInstance(state);
  62. float result = instance->getBreakingImpulse();
  63. // Push the return value onto the stack.
  64. lua_pushnumber(state, result);
  65. return 1;
  66. }
  67. lua_pushstring(state, "lua_PhysicsGenericConstraint_getBreakingImpulse - Failed to match the given parameters to a valid function signature.");
  68. lua_error(state);
  69. break;
  70. }
  71. default:
  72. {
  73. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  74. lua_error(state);
  75. break;
  76. }
  77. }
  78. return 0;
  79. }
  80. int lua_PhysicsGenericConstraint_getRotationOffsetA(lua_State* state)
  81. {
  82. // Get the number of parameters.
  83. int paramCount = lua_gettop(state);
  84. // Attempt to match the parameters to a valid binding.
  85. switch (paramCount)
  86. {
  87. case 1:
  88. {
  89. if ((lua_type(state, 1) == LUA_TUSERDATA))
  90. {
  91. PhysicsGenericConstraint* instance = getInstance(state);
  92. void* returnPtr = (void*)&(instance->getRotationOffsetA());
  93. if (returnPtr)
  94. {
  95. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  96. object->instance = returnPtr;
  97. object->owns = false;
  98. luaL_getmetatable(state, "Quaternion");
  99. lua_setmetatable(state, -2);
  100. }
  101. else
  102. {
  103. lua_pushnil(state);
  104. }
  105. return 1;
  106. }
  107. lua_pushstring(state, "lua_PhysicsGenericConstraint_getRotationOffsetA - Failed to match the given parameters to a valid function signature.");
  108. lua_error(state);
  109. break;
  110. }
  111. default:
  112. {
  113. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  114. lua_error(state);
  115. break;
  116. }
  117. }
  118. return 0;
  119. }
  120. int lua_PhysicsGenericConstraint_getRotationOffsetB(lua_State* state)
  121. {
  122. // Get the number of parameters.
  123. int paramCount = lua_gettop(state);
  124. // Attempt to match the parameters to a valid binding.
  125. switch (paramCount)
  126. {
  127. case 1:
  128. {
  129. if ((lua_type(state, 1) == LUA_TUSERDATA))
  130. {
  131. PhysicsGenericConstraint* instance = getInstance(state);
  132. void* returnPtr = (void*)&(instance->getRotationOffsetB());
  133. if (returnPtr)
  134. {
  135. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  136. object->instance = returnPtr;
  137. object->owns = false;
  138. luaL_getmetatable(state, "Quaternion");
  139. lua_setmetatable(state, -2);
  140. }
  141. else
  142. {
  143. lua_pushnil(state);
  144. }
  145. return 1;
  146. }
  147. lua_pushstring(state, "lua_PhysicsGenericConstraint_getRotationOffsetB - Failed to match the given parameters to a valid function signature.");
  148. lua_error(state);
  149. break;
  150. }
  151. default:
  152. {
  153. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  154. lua_error(state);
  155. break;
  156. }
  157. }
  158. return 0;
  159. }
  160. int lua_PhysicsGenericConstraint_getTranslationOffsetA(lua_State* state)
  161. {
  162. // Get the number of parameters.
  163. int paramCount = lua_gettop(state);
  164. // Attempt to match the parameters to a valid binding.
  165. switch (paramCount)
  166. {
  167. case 1:
  168. {
  169. if ((lua_type(state, 1) == LUA_TUSERDATA))
  170. {
  171. PhysicsGenericConstraint* instance = getInstance(state);
  172. void* returnPtr = (void*)&(instance->getTranslationOffsetA());
  173. if (returnPtr)
  174. {
  175. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  176. object->instance = returnPtr;
  177. object->owns = false;
  178. luaL_getmetatable(state, "Vector3");
  179. lua_setmetatable(state, -2);
  180. }
  181. else
  182. {
  183. lua_pushnil(state);
  184. }
  185. return 1;
  186. }
  187. lua_pushstring(state, "lua_PhysicsGenericConstraint_getTranslationOffsetA - Failed to match the given parameters to a valid function signature.");
  188. lua_error(state);
  189. break;
  190. }
  191. default:
  192. {
  193. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  194. lua_error(state);
  195. break;
  196. }
  197. }
  198. return 0;
  199. }
  200. int lua_PhysicsGenericConstraint_getTranslationOffsetB(lua_State* state)
  201. {
  202. // Get the number of parameters.
  203. int paramCount = lua_gettop(state);
  204. // Attempt to match the parameters to a valid binding.
  205. switch (paramCount)
  206. {
  207. case 1:
  208. {
  209. if ((lua_type(state, 1) == LUA_TUSERDATA))
  210. {
  211. PhysicsGenericConstraint* instance = getInstance(state);
  212. void* returnPtr = (void*)&(instance->getTranslationOffsetB());
  213. if (returnPtr)
  214. {
  215. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  216. object->instance = returnPtr;
  217. object->owns = false;
  218. luaL_getmetatable(state, "Vector3");
  219. lua_setmetatable(state, -2);
  220. }
  221. else
  222. {
  223. lua_pushnil(state);
  224. }
  225. return 1;
  226. }
  227. lua_pushstring(state, "lua_PhysicsGenericConstraint_getTranslationOffsetB - Failed to match the given parameters to a valid function signature.");
  228. lua_error(state);
  229. break;
  230. }
  231. default:
  232. {
  233. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  234. lua_error(state);
  235. break;
  236. }
  237. }
  238. return 0;
  239. }
  240. int lua_PhysicsGenericConstraint_isEnabled(lua_State* state)
  241. {
  242. // Get the number of parameters.
  243. int paramCount = lua_gettop(state);
  244. // Attempt to match the parameters to a valid binding.
  245. switch (paramCount)
  246. {
  247. case 1:
  248. {
  249. if ((lua_type(state, 1) == LUA_TUSERDATA))
  250. {
  251. PhysicsGenericConstraint* instance = getInstance(state);
  252. bool result = instance->isEnabled();
  253. // Push the return value onto the stack.
  254. lua_pushboolean(state, result);
  255. return 1;
  256. }
  257. lua_pushstring(state, "lua_PhysicsGenericConstraint_isEnabled - Failed to match the given parameters to a valid function signature.");
  258. lua_error(state);
  259. break;
  260. }
  261. default:
  262. {
  263. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  264. lua_error(state);
  265. break;
  266. }
  267. }
  268. return 0;
  269. }
  270. int lua_PhysicsGenericConstraint_setAngularLowerLimit(lua_State* state)
  271. {
  272. // Get the number of parameters.
  273. int paramCount = lua_gettop(state);
  274. // Attempt to match the parameters to a valid binding.
  275. switch (paramCount)
  276. {
  277. case 2:
  278. {
  279. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  280. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  281. {
  282. // Get parameter 1 off the stack.
  283. bool param1Valid;
  284. gameplay::ScriptUtil::LuaArray<Vector3> param1 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param1Valid);
  285. if (!param1Valid)
  286. {
  287. lua_pushstring(state, "Failed to convert parameter 1 to type 'Vector3'.");
  288. lua_error(state);
  289. }
  290. PhysicsGenericConstraint* instance = getInstance(state);
  291. instance->setAngularLowerLimit(*param1);
  292. return 0;
  293. }
  294. lua_pushstring(state, "lua_PhysicsGenericConstraint_setAngularLowerLimit - Failed to match the given parameters to a valid function signature.");
  295. lua_error(state);
  296. break;
  297. }
  298. default:
  299. {
  300. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  301. lua_error(state);
  302. break;
  303. }
  304. }
  305. return 0;
  306. }
  307. int lua_PhysicsGenericConstraint_setAngularUpperLimit(lua_State* state)
  308. {
  309. // Get the number of parameters.
  310. int paramCount = lua_gettop(state);
  311. // Attempt to match the parameters to a valid binding.
  312. switch (paramCount)
  313. {
  314. case 2:
  315. {
  316. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  317. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  318. {
  319. // Get parameter 1 off the stack.
  320. bool param1Valid;
  321. gameplay::ScriptUtil::LuaArray<Vector3> param1 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param1Valid);
  322. if (!param1Valid)
  323. {
  324. lua_pushstring(state, "Failed to convert parameter 1 to type 'Vector3'.");
  325. lua_error(state);
  326. }
  327. PhysicsGenericConstraint* instance = getInstance(state);
  328. instance->setAngularUpperLimit(*param1);
  329. return 0;
  330. }
  331. lua_pushstring(state, "lua_PhysicsGenericConstraint_setAngularUpperLimit - Failed to match the given parameters to a valid function signature.");
  332. lua_error(state);
  333. break;
  334. }
  335. default:
  336. {
  337. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  338. lua_error(state);
  339. break;
  340. }
  341. }
  342. return 0;
  343. }
  344. int lua_PhysicsGenericConstraint_setBreakingImpulse(lua_State* state)
  345. {
  346. // Get the number of parameters.
  347. int paramCount = lua_gettop(state);
  348. // Attempt to match the parameters to a valid binding.
  349. switch (paramCount)
  350. {
  351. case 2:
  352. {
  353. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  354. lua_type(state, 2) == LUA_TNUMBER)
  355. {
  356. // Get parameter 1 off the stack.
  357. float param1 = (float)luaL_checknumber(state, 2);
  358. PhysicsGenericConstraint* instance = getInstance(state);
  359. instance->setBreakingImpulse(param1);
  360. return 0;
  361. }
  362. lua_pushstring(state, "lua_PhysicsGenericConstraint_setBreakingImpulse - Failed to match the given parameters to a valid function signature.");
  363. lua_error(state);
  364. break;
  365. }
  366. default:
  367. {
  368. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  369. lua_error(state);
  370. break;
  371. }
  372. }
  373. return 0;
  374. }
  375. int lua_PhysicsGenericConstraint_setEnabled(lua_State* state)
  376. {
  377. // Get the number of parameters.
  378. int paramCount = lua_gettop(state);
  379. // Attempt to match the parameters to a valid binding.
  380. switch (paramCount)
  381. {
  382. case 2:
  383. {
  384. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  385. lua_type(state, 2) == LUA_TBOOLEAN)
  386. {
  387. // Get parameter 1 off the stack.
  388. bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
  389. PhysicsGenericConstraint* instance = getInstance(state);
  390. instance->setEnabled(param1);
  391. return 0;
  392. }
  393. lua_pushstring(state, "lua_PhysicsGenericConstraint_setEnabled - Failed to match the given parameters to a valid function signature.");
  394. lua_error(state);
  395. break;
  396. }
  397. default:
  398. {
  399. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  400. lua_error(state);
  401. break;
  402. }
  403. }
  404. return 0;
  405. }
  406. int lua_PhysicsGenericConstraint_setLinearLowerLimit(lua_State* state)
  407. {
  408. // Get the number of parameters.
  409. int paramCount = lua_gettop(state);
  410. // Attempt to match the parameters to a valid binding.
  411. switch (paramCount)
  412. {
  413. case 2:
  414. {
  415. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  416. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  417. {
  418. // Get parameter 1 off the stack.
  419. bool param1Valid;
  420. gameplay::ScriptUtil::LuaArray<Vector3> param1 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param1Valid);
  421. if (!param1Valid)
  422. {
  423. lua_pushstring(state, "Failed to convert parameter 1 to type 'Vector3'.");
  424. lua_error(state);
  425. }
  426. PhysicsGenericConstraint* instance = getInstance(state);
  427. instance->setLinearLowerLimit(*param1);
  428. return 0;
  429. }
  430. lua_pushstring(state, "lua_PhysicsGenericConstraint_setLinearLowerLimit - Failed to match the given parameters to a valid function signature.");
  431. lua_error(state);
  432. break;
  433. }
  434. default:
  435. {
  436. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  437. lua_error(state);
  438. break;
  439. }
  440. }
  441. return 0;
  442. }
  443. int lua_PhysicsGenericConstraint_setLinearUpperLimit(lua_State* state)
  444. {
  445. // Get the number of parameters.
  446. int paramCount = lua_gettop(state);
  447. // Attempt to match the parameters to a valid binding.
  448. switch (paramCount)
  449. {
  450. case 2:
  451. {
  452. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  453. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  454. {
  455. // Get parameter 1 off the stack.
  456. bool param1Valid;
  457. gameplay::ScriptUtil::LuaArray<Vector3> param1 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param1Valid);
  458. if (!param1Valid)
  459. {
  460. lua_pushstring(state, "Failed to convert parameter 1 to type 'Vector3'.");
  461. lua_error(state);
  462. }
  463. PhysicsGenericConstraint* instance = getInstance(state);
  464. instance->setLinearUpperLimit(*param1);
  465. return 0;
  466. }
  467. lua_pushstring(state, "lua_PhysicsGenericConstraint_setLinearUpperLimit - Failed to match the given parameters to a valid function signature.");
  468. lua_error(state);
  469. break;
  470. }
  471. default:
  472. {
  473. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  474. lua_error(state);
  475. break;
  476. }
  477. }
  478. return 0;
  479. }
  480. int lua_PhysicsGenericConstraint_setRotationOffsetA(lua_State* state)
  481. {
  482. // Get the number of parameters.
  483. int paramCount = lua_gettop(state);
  484. // Attempt to match the parameters to a valid binding.
  485. switch (paramCount)
  486. {
  487. case 2:
  488. {
  489. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  490. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  491. {
  492. // Get parameter 1 off the stack.
  493. bool param1Valid;
  494. gameplay::ScriptUtil::LuaArray<Quaternion> param1 = gameplay::ScriptUtil::getObjectPointer<Quaternion>(2, "Quaternion", true, &param1Valid);
  495. if (!param1Valid)
  496. {
  497. lua_pushstring(state, "Failed to convert parameter 1 to type 'Quaternion'.");
  498. lua_error(state);
  499. }
  500. PhysicsGenericConstraint* instance = getInstance(state);
  501. instance->setRotationOffsetA(*param1);
  502. return 0;
  503. }
  504. lua_pushstring(state, "lua_PhysicsGenericConstraint_setRotationOffsetA - Failed to match the given parameters to a valid function signature.");
  505. lua_error(state);
  506. break;
  507. }
  508. default:
  509. {
  510. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  511. lua_error(state);
  512. break;
  513. }
  514. }
  515. return 0;
  516. }
  517. int lua_PhysicsGenericConstraint_setRotationOffsetB(lua_State* state)
  518. {
  519. // Get the number of parameters.
  520. int paramCount = lua_gettop(state);
  521. // Attempt to match the parameters to a valid binding.
  522. switch (paramCount)
  523. {
  524. case 2:
  525. {
  526. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  527. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  528. {
  529. // Get parameter 1 off the stack.
  530. bool param1Valid;
  531. gameplay::ScriptUtil::LuaArray<Quaternion> param1 = gameplay::ScriptUtil::getObjectPointer<Quaternion>(2, "Quaternion", true, &param1Valid);
  532. if (!param1Valid)
  533. {
  534. lua_pushstring(state, "Failed to convert parameter 1 to type 'Quaternion'.");
  535. lua_error(state);
  536. }
  537. PhysicsGenericConstraint* instance = getInstance(state);
  538. instance->setRotationOffsetB(*param1);
  539. return 0;
  540. }
  541. lua_pushstring(state, "lua_PhysicsGenericConstraint_setRotationOffsetB - Failed to match the given parameters to a valid function signature.");
  542. lua_error(state);
  543. break;
  544. }
  545. default:
  546. {
  547. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  548. lua_error(state);
  549. break;
  550. }
  551. }
  552. return 0;
  553. }
  554. int lua_PhysicsGenericConstraint_setTranslationOffsetA(lua_State* state)
  555. {
  556. // Get the number of parameters.
  557. int paramCount = lua_gettop(state);
  558. // Attempt to match the parameters to a valid binding.
  559. switch (paramCount)
  560. {
  561. case 2:
  562. {
  563. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  564. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  565. {
  566. // Get parameter 1 off the stack.
  567. bool param1Valid;
  568. gameplay::ScriptUtil::LuaArray<Vector3> param1 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param1Valid);
  569. if (!param1Valid)
  570. {
  571. lua_pushstring(state, "Failed to convert parameter 1 to type 'Vector3'.");
  572. lua_error(state);
  573. }
  574. PhysicsGenericConstraint* instance = getInstance(state);
  575. instance->setTranslationOffsetA(*param1);
  576. return 0;
  577. }
  578. lua_pushstring(state, "lua_PhysicsGenericConstraint_setTranslationOffsetA - Failed to match the given parameters to a valid function signature.");
  579. lua_error(state);
  580. break;
  581. }
  582. default:
  583. {
  584. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  585. lua_error(state);
  586. break;
  587. }
  588. }
  589. return 0;
  590. }
  591. int lua_PhysicsGenericConstraint_setTranslationOffsetB(lua_State* state)
  592. {
  593. // Get the number of parameters.
  594. int paramCount = lua_gettop(state);
  595. // Attempt to match the parameters to a valid binding.
  596. switch (paramCount)
  597. {
  598. case 2:
  599. {
  600. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  601. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  602. {
  603. // Get parameter 1 off the stack.
  604. bool param1Valid;
  605. gameplay::ScriptUtil::LuaArray<Vector3> param1 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param1Valid);
  606. if (!param1Valid)
  607. {
  608. lua_pushstring(state, "Failed to convert parameter 1 to type 'Vector3'.");
  609. lua_error(state);
  610. }
  611. PhysicsGenericConstraint* instance = getInstance(state);
  612. instance->setTranslationOffsetB(*param1);
  613. return 0;
  614. }
  615. lua_pushstring(state, "lua_PhysicsGenericConstraint_setTranslationOffsetB - Failed to match the given parameters to a valid function signature.");
  616. lua_error(state);
  617. break;
  618. }
  619. default:
  620. {
  621. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  622. lua_error(state);
  623. break;
  624. }
  625. }
  626. return 0;
  627. }
  628. int lua_PhysicsGenericConstraint_static_centerOfMassMidpoint(lua_State* state)
  629. {
  630. // Get the number of parameters.
  631. int paramCount = lua_gettop(state);
  632. // Attempt to match the parameters to a valid binding.
  633. switch (paramCount)
  634. {
  635. case 2:
  636. {
  637. if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TTABLE || lua_type(state, 1) == LUA_TNIL) &&
  638. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  639. {
  640. // Get parameter 1 off the stack.
  641. bool param1Valid;
  642. gameplay::ScriptUtil::LuaArray<Node> param1 = gameplay::ScriptUtil::getObjectPointer<Node>(1, "Node", false, &param1Valid);
  643. if (!param1Valid)
  644. {
  645. lua_pushstring(state, "Failed to convert parameter 1 to type 'Node'.");
  646. lua_error(state);
  647. }
  648. // Get parameter 2 off the stack.
  649. bool param2Valid;
  650. gameplay::ScriptUtil::LuaArray<Node> param2 = gameplay::ScriptUtil::getObjectPointer<Node>(2, "Node", false, &param2Valid);
  651. if (!param2Valid)
  652. {
  653. lua_pushstring(state, "Failed to convert parameter 2 to type 'Node'.");
  654. lua_error(state);
  655. }
  656. void* returnPtr = (void*)new Vector3(PhysicsGenericConstraint::centerOfMassMidpoint(param1, param2));
  657. if (returnPtr)
  658. {
  659. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  660. object->instance = returnPtr;
  661. object->owns = true;
  662. luaL_getmetatable(state, "Vector3");
  663. lua_setmetatable(state, -2);
  664. }
  665. else
  666. {
  667. lua_pushnil(state);
  668. }
  669. return 1;
  670. }
  671. lua_pushstring(state, "lua_PhysicsGenericConstraint_static_centerOfMassMidpoint - Failed to match the given parameters to a valid function signature.");
  672. lua_error(state);
  673. break;
  674. }
  675. default:
  676. {
  677. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  678. lua_error(state);
  679. break;
  680. }
  681. }
  682. return 0;
  683. }
  684. int lua_PhysicsGenericConstraint_static_getRotationOffset(lua_State* state)
  685. {
  686. // Get the number of parameters.
  687. int paramCount = lua_gettop(state);
  688. // Attempt to match the parameters to a valid binding.
  689. switch (paramCount)
  690. {
  691. case 2:
  692. {
  693. if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TTABLE || lua_type(state, 1) == LUA_TNIL) &&
  694. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  695. {
  696. // Get parameter 1 off the stack.
  697. bool param1Valid;
  698. gameplay::ScriptUtil::LuaArray<Node> param1 = gameplay::ScriptUtil::getObjectPointer<Node>(1, "Node", false, &param1Valid);
  699. if (!param1Valid)
  700. {
  701. lua_pushstring(state, "Failed to convert parameter 1 to type 'Node'.");
  702. lua_error(state);
  703. }
  704. // Get parameter 2 off the stack.
  705. bool param2Valid;
  706. gameplay::ScriptUtil::LuaArray<Vector3> param2 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param2Valid);
  707. if (!param2Valid)
  708. {
  709. lua_pushstring(state, "Failed to convert parameter 2 to type 'Vector3'.");
  710. lua_error(state);
  711. }
  712. void* returnPtr = (void*)new Quaternion(PhysicsGenericConstraint::getRotationOffset(param1, *param2));
  713. if (returnPtr)
  714. {
  715. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  716. object->instance = returnPtr;
  717. object->owns = true;
  718. luaL_getmetatable(state, "Quaternion");
  719. lua_setmetatable(state, -2);
  720. }
  721. else
  722. {
  723. lua_pushnil(state);
  724. }
  725. return 1;
  726. }
  727. lua_pushstring(state, "lua_PhysicsGenericConstraint_static_getRotationOffset - Failed to match the given parameters to a valid function signature.");
  728. lua_error(state);
  729. break;
  730. }
  731. default:
  732. {
  733. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  734. lua_error(state);
  735. break;
  736. }
  737. }
  738. return 0;
  739. }
  740. int lua_PhysicsGenericConstraint_static_getTranslationOffset(lua_State* state)
  741. {
  742. // Get the number of parameters.
  743. int paramCount = lua_gettop(state);
  744. // Attempt to match the parameters to a valid binding.
  745. switch (paramCount)
  746. {
  747. case 2:
  748. {
  749. if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TTABLE || lua_type(state, 1) == LUA_TNIL) &&
  750. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  751. {
  752. // Get parameter 1 off the stack.
  753. bool param1Valid;
  754. gameplay::ScriptUtil::LuaArray<Node> param1 = gameplay::ScriptUtil::getObjectPointer<Node>(1, "Node", false, &param1Valid);
  755. if (!param1Valid)
  756. {
  757. lua_pushstring(state, "Failed to convert parameter 1 to type 'Node'.");
  758. lua_error(state);
  759. }
  760. // Get parameter 2 off the stack.
  761. bool param2Valid;
  762. gameplay::ScriptUtil::LuaArray<Vector3> param2 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param2Valid);
  763. if (!param2Valid)
  764. {
  765. lua_pushstring(state, "Failed to convert parameter 2 to type 'Vector3'.");
  766. lua_error(state);
  767. }
  768. void* returnPtr = (void*)new Vector3(PhysicsGenericConstraint::getTranslationOffset(param1, *param2));
  769. if (returnPtr)
  770. {
  771. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  772. object->instance = returnPtr;
  773. object->owns = true;
  774. luaL_getmetatable(state, "Vector3");
  775. lua_setmetatable(state, -2);
  776. }
  777. else
  778. {
  779. lua_pushnil(state);
  780. }
  781. return 1;
  782. }
  783. lua_pushstring(state, "lua_PhysicsGenericConstraint_static_getTranslationOffset - Failed to match the given parameters to a valid function signature.");
  784. lua_error(state);
  785. break;
  786. }
  787. default:
  788. {
  789. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  790. lua_error(state);
  791. break;
  792. }
  793. }
  794. return 0;
  795. }
  796. }