lua_api.txt 30 KB

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