lua_PhysicsSpringConstraint.cpp 46 KB

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