lua_api.txt 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105
  1. .. contents::
  2. Math
  3. ====
  4. Vector3
  5. -------
  6. **Vector3** (x, y, z) : Vector3
  7. Returns a new vector from individual elements.
  8. **x** (v) : float
  9. Returns the x value of the vector.
  10. **y** (v) : float
  11. Returns the y value of the vector.
  12. **z** (v) : float
  13. Returns the z value of the vector.
  14. **.x** : float
  15. Returns/assigns the x value of the vector.
  16. **.y** : float
  17. Returns/assigns the y value of the vector.
  18. **.z** : float
  19. Returns/assigns the z value of the vector.
  20. **set_x** (v, x)
  21. Sets the value of the x value of the vector.
  22. **set_y** (v, y)
  23. Sets the value of the y value of the vector.
  24. **set_z** (v, z)
  25. Sets the value of the z value of the vector.
  26. **elements** (v) : float, float, float
  27. Returns the x, y and z elements of the vector.
  28. **add** (a, b) : Vector3
  29. Adds the vector *a* to *b* and returns the result.
  30. **subtract** (a, b) : Vector3
  31. Subtracts the vector *b* from *a* and returns the result.
  32. **multiply** (a, k) : Vector3
  33. Multiplies the vector *a* by the scalar *k* and returns the result.
  34. **dot** (a, b) : float
  35. Returns the dot product between the vectors *a* and *b*.
  36. **cross** (a, b) : Vector3
  37. Returns the cross product between the vectors *a* and *b*.
  38. **equal** (a, b) : bool
  39. Returns true whether the vectors *a* and *b* are equal.
  40. **length** (a) : float
  41. Returns the lenght of *a*.
  42. **length_squared** (a) : float
  43. Returns the squared length of *a*.
  44. **set_length** (a, len)
  45. Sets the lenght of *a* to *len*.
  46. **normalize** (a) : Vector3
  47. Normalizes *a* and returns the result.
  48. **distance** (a, b) : float
  49. Returns the distance between the points *a* and *b*.
  50. **distance_squared** (a, b) : float
  51. Returns the squared distance between the points *a* and *b*.
  52. **angle** (a, b) : float
  53. Returns the angle between the vectors *a* and *b*.
  54. **max** (a, b) : Vector3
  55. Returns a vector that contains the largest value for each element from *a* and *b*.
  56. **min** (a, b) : Vector3
  57. Returns a vector that contains the smallest value for each element from *a* and *b*.
  58. **lerp** (a, b, t) : Vector3
  59. Returns the linearly interpolated vector between *a* and *b* at time *t* in [0, 1].
  60. | **forward** () : Vector3
  61. | **backward** () : Vector3
  62. | **left** () : Vector3
  63. | **right** () : Vector3
  64. | **up** () : Vector3
  65. | **down** () : Vector3
  66. | Returns the corresponding semantic axis.
  67. **zero** () : Vector3
  68. Returns a vector with all values set to zero.
  69. **to_string** (v) : string
  70. Returns a string representing the vector *v*.
  71. Vector3Box
  72. ----------
  73. **Vector3Box** () : Vector3Box
  74. Returns a new Vector3Box initialized with the zero vector.
  75. **Vector3Box** (v) : Vector3Box
  76. Returns a new Vector3Box from the Vector3 *v*.
  77. **Vector3Box** (x, y, z) : Vector3Box
  78. Returns a new Vector3Box from individual elements.
  79. **store** (v)
  80. Stores the Vector3 *v* in the box.
  81. **store** (x, y, z)
  82. Stores Vector3(x, y, z) in the box.
  83. **unbox** () : Vector3
  84. Returns the stored vector from the box.
  85. Quaternion
  86. ----------
  87. **Quaternion** (axis, angle) : Quaternion
  88. Returns a new quaternion from *axis* and *angle*.
  89. **from_elements** (x, y, z, w) : Quaternion
  90. Returns a new quaternion from individual elements.
  91. **negate** (q) : Quaternion
  92. Negates the quaternion *q* and returns the result.
  93. **identity** () : Quaternion
  94. Returns the identity quaternion.
  95. **multiply** (a, b) : Quaternion
  96. Multiplies the quaternions *a* and *b*. (i.e. rotates first by *a* then by *b*).
  97. **multiply_by_scalar** (a, k) : Quaternion
  98. Multiplies the quaternion *a* by the scalar *k*.
  99. **dot** (a, b) : float
  100. Returns the dot product between quaternions *a* and *b*.
  101. **length** (q) : float
  102. Returns the length of *q*.
  103. **normalize** (q) : Quaternion
  104. Normalizes the quaternion *q* and returns the result.
  105. **conjugate** (q) : Quaternion
  106. Returns the conjugate of quaternion *q*.
  107. **inverse** (q) : Quaternion
  108. Returns the inverse of quaternion *q*.
  109. **power** (q, exp) : Quaternion
  110. Returns the quaternion *q* raised to the power of *exp*.
  111. **elements** (q) : float, float, float, float
  112. Returns the x, y, z and w elements of the quaternion.
  113. **look** (dir, [up]) : Quaternion
  114. Returns the quaternion describing the rotation needed to face towards *dir*.
  115. If *up* is not specified, Vector3.up() is used.
  116. **right** (q) : Vector3
  117. Returns the right axis of the rotation described by *q*.
  118. **up** (q) : Vector3
  119. Returns the up axis of the rotation described by *q*.
  120. **forward** (q) : Vector3
  121. Returns the forward axis of the rotation described by *q*.
  122. **lerp** (a, b, t) : Quaternion
  123. Returns the linearly interpolated quaternion between *a* and *b* at time *t* in [0, 1].
  124. It uses NLerp.
  125. **to_string** (q) : string
  126. Returns a string representing the quaternion *q*.
  127. QuaternionBox
  128. -------------
  129. **QuaternionBox** () : QuaternionBox
  130. Returns a new QuaternionBox initialized with the identity quaternion.
  131. **QuaternionBox** (q) : QuaternionBox
  132. Returns a new QuaternionBox from the Quaternion *q*.
  133. **QuaternionBox** (x, y, z, w) : QuaternionBox
  134. Returns a new QuaternionBox from individual elements.
  135. **store** (q)
  136. Stores the Quaternion *q* in the box.
  137. **store** (x, y, z, w)
  138. Stores Quaternion(x, y, z, w) in the box.
  139. **unbox** () : Quaternion
  140. Returns the stored quaternion from the box.
  141. Matrix4x4
  142. ---------
  143. **Matrix4x4** (xx, xy, xz, xw, yx, yy, yz, yw, zx, zy, zz, zw, tx, ty, tz, tw) : Matrix4x4
  144. Returns a new matrix from individual elements.
  145. **from_quaternion** (q) : Matrix4x4
  146. Returns a new matrix from *q*.
  147. **from_translation** (t) : Matrix4x4
  148. Returns a new matrix from *t*.
  149. **from_quaternion_translation** (q, t) : Matrix4x4
  150. Returns a new matrix from *q* and *t*.
  151. **from_axes** (x, y, z, t) : Matrix4x4
  152. Returns a new matrix from *x*, *y*, *z* and *t*.
  153. **copy** (m) : Matrix4x4
  154. Returns a copy of the matrix *m*.
  155. **add** (a, b) : Matrix4x4
  156. Adds the matrix *a* to *b* and returns the result.
  157. **subtract** (a, b) : Matrix4x4
  158. Subtracts the matrix *b* from *a* and returns the result.
  159. **multiply** (a, b) : Matrix4x4
  160. Multiplies the matrix *a* by *b* and returns the result. (i.e. transforms first by *a* then by *b*)
  161. **transpose** (m) : Matrix4x4
  162. Transposes the matrix *m* and returns the result.
  163. **determinant** (m) : float
  164. Returns the determinant of the matrix *m*.
  165. **invert** (m) : Matrix4x4
  166. Inverts the matrix *m* and returns the result.
  167. **x** (m) : Vector3
  168. Returns the x axis of the matrix *m*.
  169. **y** (m) : Vector3
  170. Returns the y axis of the matrix *m*.
  171. **z** (m) : Vector3
  172. Returns the z axis of the matrix *m*.
  173. **set_x** (m, x)
  174. Sets the x axis of the matrix *m*.
  175. **set_y** (m, y)
  176. Sets the y axis of the matrix *m*.
  177. **set_z** (m, z)
  178. Sets the z axis of the matrix *m*.
  179. **rotation** (m) : Quaternion
  180. Returns the rotation portion of the matrix *m*.
  181. **set_rotation** (m, r)
  182. Sets the rotation portion of the matrix *m*.
  183. **translation** (m, a) : Vector3
  184. Returns the translation portion of the matrix *m*.
  185. **set_translation** (m, t)
  186. Sets the translation portion of the matrix *m*.
  187. **identity** ()
  188. Returns the identity matrix.
  189. **transform** (m, v) : Vector3
  190. Transforms the vector *v* by the matrix *m* and returns the result.
  191. **to_string** (m) : string
  192. Returns a string representing the matrix *m*.
  193. Matrix4x4Box
  194. ------------
  195. **Matrix4x4Box** () : Matrix4x4Box
  196. Returns a new Matrix4x4Box initialized with the identity matrix.
  197. **Matrix4x4Box** (m) : Matrix4x4Box
  198. Returns a new Matrix4x4Box from the Matrix4x4 *m*.
  199. **store** (m)
  200. Stores the Matrix4x4 *m* in the box.
  201. **unbox** () : Matrix4x4
  202. Returns the stored matrix from the box.
  203. Color4
  204. ------
  205. **Color4** (r, g, b, a) : Color4
  206. Returns a new Color4 from individual elements.
  207. | **black** () : Color4
  208. | **white** () : Color4
  209. | **red** () : Color4
  210. | **green** () : Color4
  211. | **blue** () : Color4
  212. | **yellow** () : Color4
  213. | **orange** () : Color4
  214. | Returns the corresponding mnemonic color.
  215. **to_string** (c) : string
  216. Returns a string representing the color *c*.
  217. Math
  218. ----
  219. **ray_plane_intersection** (from, dir, point, normal) : float
  220. Returns the distance along ray (from, dir) to intersection point with plane defined by
  221. *point* and *normal* or -1.0 if no intersection.
  222. **ray_disc_intersection** (from, dir, center, radius, normal) : float
  223. Returns the distance along ray (from, dir) to intersection point with disc defined by
  224. *center*, *radius* and *normal* or -1.0 if no intersection.
  225. **ray_sphere_intersection** (from, dir, center, radius) : float
  226. Returns the distance along ray (from, dir) to intersection point with sphere defined by
  227. *center* and *radius* or -1.0 if no intersection.
  228. **ray_obb_intersection** (from, dir, tm, half_extents) : float
  229. Returns the distance along ray (from, dir) to intersection point with the oriented
  230. bounding box (tm, half_extents) or -1.0 if no intersection.
  231. **ray_triangle_intersection** (from, dir, v0, v1, v2) : float
  232. Returns the distance along ray (from, dir) to intersection point with the triangle
  233. (v0, v1, v2) or -1.0 if no intersection.
  234. UnitManager
  235. ===========
  236. **create** ([world]) : UnitId
  237. Creates a new empty unit. If *world* is specified, the unit will be owned by
  238. that world.
  239. **destroy** (unit)
  240. Destroys the given *unit*.
  241. **alive** (unit) : bool
  242. Returns whether the unit is alive.
  243. World
  244. =====
  245. **spawn_unit** (world, name, [position, rotation]) : UnitId
  246. Spawns a new instance of the unit *name* at the given *position* and *rotation*.
  247. **spawn_empty_unit** (world) : UnitId
  248. Spawns a new empty unit and returns its id.
  249. **destroy_unit** (world, unit)
  250. Destroys the given *unit*.
  251. **num_units** (world) : int
  252. Returns the number of units in the *world*.
  253. **units** (world) : table
  254. Returns all the the units in the world in a table.
  255. **update_animations** (world, dt)
  256. Update all animations with *dt*.
  257. **update_scene** (world, dt)
  258. Updates the scene with *dt*.
  259. **update** (world, dt)
  260. Updates the world with *dt*.
  261. **create_debug_line** (world, depth_test) : DebugLine
  262. Creates a new DebugLine. *depth_test* controls whether to
  263. enable depth test when rendering the lines.
  264. **destroy_debug_line** (world, line)
  265. Destroys the debug *line*.
  266. **scene_graph** (world) : SceneGraph
  267. Returns the scene graph.
  268. **render_world** (world) : RenderWorld
  269. Returns the render sub-world.
  270. **physics_world** (world) : PhysicsWorld
  271. Returns the physics sub-world.
  272. **sound_world** (world) : SoundWorld
  273. Returns the sound sub-world.
  274. Sound
  275. -----
  276. **play_sound** (world, name, [loop, volume, position, range]) : SoundInstanceId
  277. Plays the sound with the given *name* at the given *position*, with the given
  278. *volume* and *range*. *loop* controls whether the sound must loop or not.
  279. **stop_sound** (world, id)
  280. Stops the sound with the given *id*.
  281. **link_sound** (world, id, unit, node)
  282. Links the sound *id* to the *node* of the given *unit*.
  283. After this call, the sound *id* will follow the unit *unit*.
  284. **set_listener_pose** (world, pose)
  285. Sets the *pose* of the listener.
  286. **set_sound_position** (world, id, position)
  287. Sets the *position* of the sound *id*.
  288. **set_sound_range** (world, id, range)
  289. Sets the *range* of the sound *id*.
  290. **set_sound_volume** (world, id, volume)
  291. Sets the *volume* of the sound *id*.
  292. Level
  293. -----
  294. **load_level** (world, name, [pos, rot]) : Level
  295. Loads the level *name* into the world at the given *position* and *rotation*.
  296. SceneGraph
  297. ==========
  298. **create** (sg, unit, position, rotation, scale) : Id
  299. Creates the transform for the *unit*.
  300. **destroy** (sg, id)
  301. Destroys the transform *id*.
  302. **transform_instances** (sg, unit) : Id
  303. Returns the transform of the *unit* or nil.
  304. **local_position** (sg, id) : Vector3
  305. Returns the local position of the transform *id*.
  306. **local_rotation** (sg, id) : Quaternion
  307. Returns the local rotation of the transform *id*.
  308. **local_scale** (sg, id) : Vector3
  309. Returns the local scale of the transform *id*.
  310. **local_pose** (sg, id) : Matrix4x4
  311. Returns the local pose of the transform *id*.
  312. **world_position** (sg, id) : Vector3
  313. Returns the world position of the transform *id*.
  314. **world_rotation** (sg, id) : Quaternion
  315. Returns the world rotation of the transform *id*.
  316. **world_pose** (sg, id) : Matrix4x4
  317. Returns the world pose of the transform *id*.
  318. **set_local_position** (sg, id, position)
  319. Sets the local *position* of the transform *id*.
  320. **set_local_rotation** (sg, id, rotation)
  321. Sets the local *rotation* of the transform *id*.
  322. **set_local_scale** (sg, id, scale)
  323. Sets the local *scale* of the transform *id*.
  324. **set_local_pose** (sg, id, pose)
  325. Sets the local *pose* of the transform *id*.
  326. **link** (sg, child, parent)
  327. Links *child* transform to *parent* transform.
  328. **unlink** (sg, id)
  329. Unlinks *id* transform from its parent, if any.
  330. Material
  331. ========
  332. **set_float** (material, name, value)
  333. Sets the *value* of the variable *name*.
  334. **set_vector2** (material, name, value)
  335. Sets the *value* of the variable *name*.
  336. **set_vector3** (material, name, value)
  337. Sets the *value* of the variable *name*.
  338. Gui
  339. ===
  340. **rect** (pos, size, material_resource, color)
  341. Draws a rectangle.
  342. **image** (pos, size, material_resource, color)
  343. Draws an image.
  344. **image_uv** (pos, size, uv0, uv1, material_resource, color)
  345. Draws an image with explicit UV coordinates.
  346. **text** (pos, font_size, str, font_resource, material_resource, color)
  347. Draws text.
  348. RenderWorld
  349. ===========
  350. **enable_debug_drawing** (rw, enable)
  351. Sets whether to *enable* debug drawing.
  352. Mesh
  353. ----
  354. **create_mesh** (rw, unit, mesh_resource, geometry_name, material_resource, visible, pose) : Id
  355. Creates a new mesh instance for *unit* and returns its id.
  356. **destroy_mesh** (rw, id)
  357. Destroys the mesh *id*.
  358. **mesh_instances** (rw, unit) : table
  359. Returns all the mesh instances of the *unit*.
  360. **mesh_raycast** (rw, id, from, dir) : float
  361. Returns the distance along ray (from, dir) to intersection point with the mesh *id* or -1.0 if no intersection.
  362. Sprite
  363. ------
  364. **create_sprite** (rw, unit, sprite_resource, material_resource, visible, pose) : Id
  365. Creates a new sprite instance for *unit* and returns its id.
  366. **destroy_sprite** (rw, id)
  367. Destroys the sprite *id*.
  368. **sprite_instances** (rw, unit) : table
  369. Returns all the sprites of the *unit*.
  370. Light
  371. -----
  372. **create_light** (rw, unit, type, range, intensity, spot_angle, color, pose) : Id
  373. Creates a new light for *unit* and returns its id.
  374. Type can be either ``directional``, ``omni`` or ``spot``.
  375. **destroy_light** (rw, id)
  376. Destroys the light *id*.
  377. **light_instances** (rw, unit) : Id
  378. Returns the light of the *unit*.
  379. **light_type** (rw, id) : string
  380. Returns the type of the light *id*.
  381. It can be either ``directional``, ``omni`` or ``spot``.
  382. **light_color** (rw, id) : Color4
  383. Returns the color of the light *id*.
  384. **light_range** (rw, id) : float
  385. Returns the range of the light *id*.
  386. **light_intensity** (rw, id) : float
  387. Returns the intensity of the light *id*.
  388. **light_spot_angle** (rw, id) : float
  389. Returns the spot angle of the light *id*.
  390. **set_light_type** (rw, id, type)
  391. Sets the *type* of the light *id*.
  392. **set_light_color** (rw, id, color)
  393. Sets the *color* of the light *id*.
  394. **set_light_range** (rw, id, range)
  395. Sets the *range* of the light *id*.
  396. **set_light_intensity** (rw, id, intensity)
  397. Sets the *intensity* of the light *id*.
  398. **set_light_spot_angle** (rw, id, angle)
  399. Sets the spot *angle* of the light *id*.
  400. PhysicsWorld
  401. =============
  402. **gravity** (pw) : Vector3
  403. Returns the gravity.
  404. **set_gravity** (pw, gravity)
  405. Sets the gravity.
  406. **raycast** (pw, from, dir, length, mode) : table
  407. Returns the actors which intersects the raycast.
  408. Mode can be either ``closest`` or ``all``.
  409. **enable_debug_drawing** (pw, enable)
  410. Sets whether to *enable* debug drawing.
  411. Actor
  412. -----
  413. **actor_instances** (pw, unit) : Id
  414. Returns the actor of the *unit*.
  415. **actor_world_position** (pw, actor) : Vector3
  416. Returns the world position of the actor.
  417. **actor_world_rotation** (pw, actor) : Quaternion
  418. Returns the world rotation of the actor.
  419. **actor_world_pose** (pw, actor) : Matrix4x4
  420. Returns the world pose of the actor.
  421. **teleport_actor_world_position** (pw, actor, position)
  422. Teleports the actor to the given world position.
  423. **teleport_actor_world_rotation** (pw, actor, rotation)
  424. Teleports the actor to the given world rotation.
  425. **teleport_actor_world_pose** (pw, actor, pose)
  426. Teleports the actor to the given world pose.
  427. **actor_center_of_mass** (pw, actor) : Vector3
  428. Returns the center of mass of the actor.
  429. **enable_actor_gravity** (pw, actor)
  430. Enables gravity for the actor.
  431. **disable_actor_gravity** (pw, actor)
  432. Disables gravity for the actor.
  433. **enable_actor_collision** (pw, actor)
  434. Enables collision detection for the actor.
  435. **disable_actor_collision** (pw, actor)
  436. Disables collision detection for the actor.
  437. **set_actor_collision_filter** (pw, actor, name)
  438. Sets the collision filter of the actor.
  439. **set_actor_kinematic** (pw, actor, kinematic)
  440. Sets whether the actor is kinematic or not.
  441. Note that this call has no effect on static actors.
  442. **move_actor** (pw, actor, position)
  443. Moves the actor to *pos*
  444. Note that this call only affects nonkinematic actors.
  445. **is_static** (pw, actor) : bool
  446. Returns whether the actor is static.
  447. **is_dynamic** (pw, actor) bool
  448. Returns whether the actor is dynamic.
  449. **is_kinematic** (pw, actor) : bool
  450. Returns whether the actor is kinematic (keyframed).
  451. **is_nonkinematic** (pw, actor) : bool
  452. Returns whether the actor is nonkinematic (i.e. dynamic and not kinematic).
  453. **actor_linear_damping** (pw, actor) : float
  454. Returns the linear damping of the actor.
  455. **set_actor_linear_damping** (pw, actor, damping)
  456. Sets the linear damping of the actor.
  457. **actor_angular_damping** (pw, actor) : float
  458. Returns the angular damping of the actor.
  459. **set_actor_angular_damping** (pw, actor, rate)
  460. Sets the angular damping of the actor.
  461. **actor_linear_velocity** (pw, actor) : Vector3
  462. Returns the linear velocity of the actor.
  463. **set_actor_linear_velocity** (pw, actor, velocity)
  464. Sets the linear velocity of the actor.
  465. Note that this call only affects nonkinematic actors.
  466. **actor_angular_velocity** (pw, actor) : Vector3
  467. Returns the angular velocity of the actor.
  468. **set_actor_angular_velocity** (pw, actor, velocity)
  469. Sets the angular velocity of the actor.
  470. Note that this call only affects nonkinematic actors.
  471. **add_actor_impulse** (pw, actor, impulse)
  472. Adds a linear impulse (acting along the center of mass) to the actor.
  473. Note that this call only affects nonkinematic actors.
  474. **add_actor_impulse_at** (pw, actor, impulse, position)
  475. Adds a linear impulse (acting along the world position *pos*) to the actor.
  476. Note that this call only affects nonkinematic actors.
  477. **add_actor_torque_impulse** (pw, actor, impulse)
  478. Adds a torque impulse to the actor.
  479. **push_actor** (pw, actor, velocity, mass)
  480. Pushes the actor as if it was hit by a point object with the given *mass*
  481. travelling at the given *velocity*.
  482. Note that this call only affects nonkinematic actors.
  483. **push_actor_at** (pw, actor, velocity, mass, position)
  484. Like push() but applies the force at the world position *pos*.
  485. Note that this call only affects nonkinematic actors.
  486. **is_sleeping** (pw, actor) : bool
  487. Returns whether the actor is sleeping.
  488. **wake_up** (pw, actor)
  489. Wakes the actor up.
  490. SoundWorld
  491. ===========
  492. **stop_all** (sound_world)
  493. Stops all the sounds in the world.
  494. **pause_all** (sound_world)
  495. Pauses all the sounds in the world
  496. **resume_all** (sound_world)
  497. Resumes all previously paused sounds in the world.
  498. **is_playing** (sound_world, id) : bool
  499. Returns whether the sound *id* is playing.
  500. ResourcePackage
  501. ================
  502. **load** (package)
  503. Loads all the resources in the package.
  504. Note that the resources are not immediately available after the call is made,
  505. instead, you have to poll for completion with has_loaded().
  506. **unload** (package)
  507. Unloads all the resources in the package.
  508. **flush** (package)
  509. Waits until the package has been loaded.
  510. **has_loaded** (package) : bool
  511. Returns whether the package has been loaded.
  512. Device
  513. ======
  514. **argv** () : table
  515. Returns a table containing the command line parameters the engine was started with.
  516. **platform** () : string
  517. Returns a string identifying what platform the engine is running on.
  518. It can be either ``android``, ``linux`` or ``windows``
  519. **architecture** () : string
  520. Returns a string identifying what architecture the engine is running on.
  521. It can be either ``32-bit`` or ``64-bit``.
  522. **version** () : string
  523. Returns a string identifying the engine version.
  524. The form is "major.minor.micro".
  525. **last_delta_time** () : float
  526. Returns the time in seconds needed to render the last frame
  527. **quit** ()
  528. Quits the application.
  529. **resolution** () : float, float
  530. Returns the main window resolution (width, height).
  531. **create_world** () : World
  532. Creates a new world.
  533. **destroy_world** (world)
  534. Destroys the given *world*.
  535. **render** (world, camera)
  536. Renders *world* using *camera*.
  537. **create_resource_package** (name) : ResourcePackage
  538. Returns the resource package with the given *package_name* name.
  539. **destroy_resource_package** (package)
  540. Destroy a previously created resource *package*.
  541. Note that to unload the resources loaded by the package, you have to call
  542. ResourcePackage.unload() first.
  543. **console_send** (table)
  544. Sends the given lua *table* to clients connected to the engine.
  545. Values can be either nil, bool, number, string, table, array, Vector2, Vector3, Quaternion, Matrix4x4 or Color4.
  546. **can_get** (type, name) : bool
  547. Returns whether the resource (type, name) is loaded.
  548. When resource autoload is enabled it always returns true.
  549. **enable_resource_autoload** (enable)
  550. Sets whether resources should be automatically loaded when accessed.
  551. **temp_count** () : int, int, int
  552. Returns the number of temporary objects used by Lua.
  553. **set_temp_count** (nv, nq, nm)
  554. Sets the number of temporary objects used by Lua.
  555. DebugLine
  556. =========
  557. **add_line** (debug_line, start, end, color)
  558. Adds a line from *start* to *end* with the given *color*.
  559. **add_axes** (debug_line, tm, length)
  560. Adds lines for each axis with the given *length*.
  561. **add_circle** (debug_line, center, radius, normal, color, [segments = 36])
  562. Adds a circle at *center* with the given *radius* and *normal* vector.
  563. **add_cone** (debug_line, from, to, radius, color, [segments = 36])
  564. Adds a cone with the base centered at *from* and the tip at *to*.
  565. **add_sphere** (debug_line, center, radius, color, [segments = 36])
  566. Adds a sphere at *center* with the given *radius*.
  567. **add_obb** (debug_line, tm, half_extents, color)
  568. Adds an orientd bounding box. *tm* describes the position and orientation of
  569. the box. *half_extents* describes the size of the box along the axis.
  570. **add_unit** (debug_line, tm, name, color)
  571. Adds the meshes from the unit *name*.
  572. **reset** (debug_line)
  573. Resets all the lines.
  574. **submit** (debug_line)
  575. Submits the lines to renderer for drawing.
  576. Input
  577. =====
  578. Keyboard
  579. --------
  580. **name** () : string
  581. Returns the name of keyboard.
  582. **connected** () : bool
  583. Returns whether the keyboard is connected and functioning.
  584. **num_buttons** () : int
  585. Returns the number of buttons of the keyboard.
  586. **num_axes** () : int
  587. Returns the number of axes of the keyboard.
  588. **pressed** (id) : bool
  589. Returns whether the button *id* is pressed in the current frame.
  590. **released** (id) : bool
  591. Returns whether the button *id* is released in the current frame.
  592. **any_pressed** () : bool
  593. Returns whether any button is pressed in the current frame.
  594. **any_released** () : bool
  595. Returns whether any button is released in the current frame.
  596. **button_name** (id) : string
  597. Returns the name of the button *id*.
  598. **button_id** (name) : int
  599. Returns the *id* of the button *name*.
  600. Keyboard Button Names
  601. ~~~~~~~~~~~~~~~~~~~~~
  602. * ``tab``, ``enter``, ``escape``, ``space``, ``backspace``
  603. * ``num_lock``, ``numpad_enter``, ``numpad_.``, ``numpad_*``, ``numpad_+``, ``numpad_-``, ``numpad_/``, ``numpad_0``, ``numpad_1``, ``numpad_2``, ``numpad_3``, ``numpad_4``, ``numpad_5``, ``numpad_6``, ``numpad_7``, ``numpad_8``, ``numpad_9``
  604. * ``f1``, ``f2``, ``f3``, ``f4``, ``f5``, ``f6``, ``f7``, ``f8``, ``f9``, ``f10``, ``f11``, ``f12``
  605. * ``home``, ``left``, ``up``, ``right``, ``down``, ``page_up``, ``page_down``, ``insert``, ``delete``, ``end``
  606. * ``left_ctrl``, ``right_ctrl``, ``left_shift``, ``right_shift``, ``caps_lock``, ``left_alt``, ``right_alt``, ``left_super``, ``right_super``
  607. * ``0``, ``1``, ``2``, ``3``, ``4``, ``5``, ``6``, ``7``, ``8``, ``9``
  608. * ``a``, ``b``, ``c``, ``d``, ``e``, ``f``, ``g``, ``h``, ``i``, ``j``, ``k``, ``l``, ``m``, ``n``, ``o``, ``p``, ``q``, ``r``, ``s``, ``t``, ``u``, ``v``, ``w``, ``x``, ``y``, ``z``
  609. Keyboard Axis Names
  610. ~~~~~~~~~~~~~~~~~~~
  611. None.
  612. Mouse
  613. -----
  614. **name** () : string
  615. Returns the name of the mouse.
  616. **connected** () : bool
  617. Returns whether the mouse is connected and functioning.
  618. **num_buttons** () : int
  619. Returns the number of buttons of the mouse.
  620. **num_axes** () : int
  621. Returns the number of axes of the mouse.
  622. **pressed** (id) : bool
  623. Returns whether the button *id* is pressed in the current frame.
  624. **released** (id) : bool
  625. Returns whether the button *id* is released in the current frame.
  626. **any_pressed** () : bool
  627. Returns whether any button is pressed in the current frame.
  628. **any_released** () : bool
  629. Returns whether any button is released in the current frame.
  630. **axis** (id) : Vector3
  631. Returns the value of the axis *id*.
  632. **button_name** (id) : string
  633. Returns the name of the button *id*.
  634. **axis_name** (id) : string
  635. Returns the name of the axis *id*.
  636. **button_id** (name) : int
  637. Returns the *id* of the button *name*.
  638. **axis_id** (name) : int
  639. Returns the *id* of the axis *name*.
  640. Mouse Button Names
  641. ~~~~~~~~~~~~~~~~~~
  642. ``left``, ``middle``, ``right``, ``extra_1``, ``extra_2``
  643. Mouse Axis Names
  644. ~~~~~~~~~~~~~~~~
  645. * ``cursor``: Returns the cursor position (x, y) in screen coordinates.
  646. * ``cursor_delta``: Returns the delta of the cursor position (x, y) since last frame.
  647. * ``wheel``: Returns the movement of the mouse wheel in the y axis. Positive values of y mean upward scrolling, negative values mean downward scrolling.
  648. Touch
  649. -----
  650. **name** () : string
  651. Returns the name of the touch.
  652. **connected** () : bool
  653. Returns whether the touch is connected and functioning.
  654. **num_buttons** () : int
  655. Returns the number of buttons of the touch.
  656. **num_axes** () : int
  657. Returns the number of axes of the touch.
  658. **pressed** (id) : bool
  659. Returns whether the button *id* is pressed in the current frame.
  660. **released** (id) : bool
  661. Returns whether the button *id* is released in the current frame.
  662. **any_pressed** () : bool
  663. Returns whether any button is pressed in the current frame.
  664. **any_released** () : bool
  665. Returns whether any button is released in the current frame.
  666. **axis** (id) : Vector3
  667. Returns the value of the axis *id*.
  668. **button_name** (id) : string
  669. Returns the name of the button *id*.
  670. **axis_name** (id) : string
  671. Returns the name of the axis *id*.
  672. **button_id** (name) : int
  673. Returns the *id* of the button *name*.
  674. **axis_id** (name) : int
  675. Returns the *id* of the axis *name*.
  676. Pad1, Pad2, Pad3, Pad4
  677. ----------------------
  678. **name** () : string
  679. Returns the name of the pad.
  680. **connected** () : bool
  681. Returns whether the pad is connected and functioning.
  682. **num_buttons** () : int
  683. Returns the number of buttons of the pad.
  684. **num_axes** () : int
  685. Returns the number of axes of the pad.
  686. **pressed** (id) : bool
  687. Returns whether the button *id* is pressed in the current frame.
  688. **released** (id) : bool
  689. Returns whether the button *id* is released in the current frame.
  690. **any_pressed** () : bool
  691. Returns whether any button is pressed in the current frame.
  692. **any_released** () : bool
  693. Returns whether any button is released in the current frame.
  694. **axis** (id) : Vector3
  695. Returns the value of the axis *id*.
  696. **button_name** (id) : string
  697. Returns the name of the button *id*.
  698. **axis_name** (id) : string
  699. Returns the name of the axis *id*.
  700. **button_id** (name) : int
  701. Returns the *id* of the button *name*.
  702. **axis_id** (name) : int
  703. Returns the *id* of the axis *name*.
  704. Pad Button Names
  705. ~~~~~~~~~~~~~~~~
  706. * ``up``, ``down``, ``left``, ``right``
  707. * ``start``, ``back``, ``guide``
  708. * ``left_thumb``, ``right_thumb``
  709. * ``left_shoulder``, ``right_shoulder``
  710. * ``a``, ``b``, ``x``, ``y``
  711. Pad Axis Names
  712. ~~~~~~~~~~~~~~
  713. * ``left``, ``right``: Returns the direction (x, y) of the left or right thumbstick [-1; +1]. The z element represents the left or right trigger [0; +1].
  714. Profiler
  715. ========
  716. **enter_scope** (name)
  717. Starts a new profile scope with the given *name*.
  718. **leave_scope** ()
  719. Ends the last profile scope.
  720. **record** (name, value)
  721. Records *value* with the given *name*. Value can be either number or Vector3.
  722. Display
  723. =======
  724. **modes** () : table
  725. Returns an array of display modes. See `Display Mode`_.
  726. **set_mode** (id)
  727. Sets the display mode *id*.
  728. The initial display mode is automatically reset when the program terminates.
  729. Display Mode
  730. ------------
  731. Display mode is a lua table with 3 fields:
  732. * ``id``: The id of the display mode.
  733. * ``width``: The width of the display mode.
  734. * ``height``: The height of the display mode.
  735. Window
  736. ======
  737. **show** ()
  738. Shows the window.
  739. **hide** ()
  740. Hides the window.
  741. **resize** (width, height)
  742. Resizes the window to *width* and *height*.
  743. **move** (x, y)
  744. Moves the window to *x* and *y*.
  745. **minimize** ()
  746. Minimizes the window.
  747. **restore** ()
  748. Restores the window.
  749. **title** () : string
  750. Returns the title of the window.
  751. **set_title** (title)
  752. Sets the title of the window.
  753. **show_cursor** (show)
  754. Sets whether to *show* the cursor.