lua_api.txt 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089
  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. UnitManager
  232. ===========
  233. **create** ([world]) : UnitId
  234. Creates a new empty unit. If *world* is specified, the unit will be owned by
  235. that world.
  236. **destroy** (unit)
  237. Destroys the given *unit*.
  238. **alive** (unit) : bool
  239. Returns whether the unit is alive.
  240. World
  241. =====
  242. **spawn_unit** (world, name, [position, rotation]) : UnitId
  243. Spawns a new instance of the unit *name* at the given *position* and *rotation*.
  244. **spawn_empty_unit** (world) : UnitId
  245. Spawns a new empty unit and returns its id.
  246. **destroy_unit** (world, unit)
  247. Destroys the given *unit*.
  248. **num_units** (world) : int
  249. Returns the number of units in the *world*.
  250. **units** (world) : table
  251. Returns all the the units in the world in a table.
  252. **update_animations** (world, dt)
  253. Update all animations with *dt*.
  254. **update_scene** (world, dt)
  255. Updates the scene with *dt*.
  256. **update** (world, dt)
  257. Updates the world with *dt*.
  258. **create_debug_line** (world, depth_test) : DebugLine
  259. Creates a new DebugLine. *depth_test* controls whether to
  260. enable depth test when rendering the lines.
  261. **destroy_debug_line** (world, line)
  262. Destroys the debug *line*.
  263. **scene_graph** (world) : SceneGraph
  264. Returns the scene graph.
  265. **render_world** (world) : RenderWorld
  266. Returns the render sub-world.
  267. **physics_world** (world) : PhysicsWorld
  268. Returns the physics sub-world.
  269. **sound_world** (world) : SoundWorld
  270. Returns the sound sub-world.
  271. Sound
  272. -----
  273. **play_sound** (world, name, [loop, volume, position, range]) : SoundInstanceId
  274. Plays the sound with the given *name* at the given *position*, with the given
  275. *volume* and *range*. *loop* controls whether the sound must loop or not.
  276. **stop_sound** (world, id)
  277. Stops the sound with the given *id*.
  278. **link_sound** (world, id, unit, node)
  279. Links the sound *id* to the *node* of the given *unit*.
  280. After this call, the sound *id* will follow the unit *unit*.
  281. **set_listener_pose** (world, pose)
  282. Sets the *pose* of the listener.
  283. **set_sound_position** (world, id, position)
  284. Sets the *position* of the sound *id*.
  285. **set_sound_range** (world, id, range)
  286. Sets the *range* of the sound *id*.
  287. **set_sound_volume** (world, id, volume)
  288. Sets the *volume* of the sound *id*.
  289. Level
  290. -----
  291. **load_level** (world, name, [pos, rot]) : Level
  292. Loads the level *name* into the world at the given *position* and *rotation*.
  293. SceneGraph
  294. ==========
  295. **create** (sg, unit, position, rotation, scale) : Id
  296. Creates the transform for the *unit*.
  297. **destroy** (sg, id)
  298. Destroys the transform *id*.
  299. **transform_instances** (sg, unit) : Id
  300. Returns the transform of the *unit* or nil.
  301. **local_position** (sg, id) : Vector3
  302. Returns the local position of the transform *id*.
  303. **local_rotation** (sg, id) : Quaternion
  304. Returns the local rotation of the transform *id*.
  305. **local_scale** (sg, id) : Vector3
  306. Returns the local scale of the transform *id*.
  307. **local_pose** (sg, id) : Matrix4x4
  308. Returns the local pose of the transform *id*.
  309. **world_position** (sg, id) : Vector3
  310. Returns the world position of the transform *id*.
  311. **world_rotation** (sg, id) : Quaternion
  312. Returns the world rotation of the transform *id*.
  313. **world_pose** (sg, id) : Matrix4x4
  314. Returns the world pose of the transform *id*.
  315. **set_local_position** (sg, id, position)
  316. Sets the local *position* of the transform *id*.
  317. **set_local_rotation** (sg, id, rotation)
  318. Sets the local *rotation* of the transform *id*.
  319. **set_local_scale** (sg, id, scale)
  320. Sets the local *scale* of the transform *id*.
  321. **set_local_pose** (sg, id, pose)
  322. Sets the local *pose* of the transform *id*.
  323. **link** (sg, child, parent)
  324. Links *child* transform to *parent* transform.
  325. **unlink** (sg, id)
  326. Unlinks *id* transform from its parent, if any.
  327. Material
  328. ========
  329. **set_float** (material, variable, value)
  330. Sets the material variable to the given value.
  331. **set_vector2** (material, variable, value)
  332. Sets the material variable to the given value.
  333. **set_vector3** (material, variable, value)
  334. Sets the material variable to the given value.
  335. Gui
  336. ===
  337. **rect** (pos, size, material_resource, color)
  338. Draws a rectangle.
  339. **image** (pos, size, material_resource, color)
  340. Draws an image.
  341. **image_uv** (pos, size, uv0, uv1, material_resource, color)
  342. Draws an image with explicit UV coordinates.
  343. **text** (pos, font_size, str, font_resource, material_resource, color)
  344. Draws text.
  345. RenderWorld
  346. ===========
  347. **enable_debug_drawing** (rw, enable)
  348. Sets whether to *enable* debug drawing.
  349. Mesh
  350. ----
  351. **create_mesh** (rw, unit, mesh_resource, geometry_name, material_resource, visible, pose) : Id
  352. Creates a new mesh instance for *unit* and returns its id.
  353. **destroy_mesh** (rw, id)
  354. Destroys the mesh *id*.
  355. **mesh_instances** (rw, unit) : table
  356. Returns all the mesh instances of the *unit*.
  357. Sprite
  358. ------
  359. **create_sprite** (rw, unit, sprite_resource, material_resource, visible, pose) : Id
  360. Creates a new sprite instance for *unit* and returns its id.
  361. **destroy_sprite** (rw, id)
  362. Destroys the sprite *id*.
  363. **sprite_instances** (rw, unit) : table
  364. Returns all the sprites of the *unit*.
  365. Light
  366. -----
  367. **create_light** (rw, unit, type, range, intensity, spot_angle, color, pose) : Id
  368. Creates a new light for *unit* and returns its id.
  369. Type can be either ``directional``, ``omni`` or ``spot``.
  370. **destroy_light** (rw, id)
  371. Destroys the light *id*.
  372. **light_instances** (rw, unit) : Id
  373. Returns the light of the *unit*.
  374. **light_type** (rw, id) : string
  375. Returns the type of the light *id*.
  376. It can be either ``directional``, ``omni`` or ``spot``.
  377. **light_color** (rw, id) : Color4
  378. Returns the color of the light *id*.
  379. **light_range** (rw, id) : float
  380. Returns the range of the light *id*.
  381. **light_intensity** (rw, id) : float
  382. Returns the intensity of the light *id*.
  383. **light_spot_angle** (rw, id) : float
  384. Returns the spot angle of the light *id*.
  385. **set_light_type** (rw, id, type)
  386. Sets the *type* of the light *id*.
  387. **set_light_color** (rw, id, color)
  388. Sets the *color* of the light *id*.
  389. **set_light_range** (rw, id, range)
  390. Sets the *range* of the light *id*.
  391. **set_light_intensity** (rw, id, intensity)
  392. Sets the *intensity* of the light *id*.
  393. **set_light_spot_angle** (rw, id, angle)
  394. Sets the spot *angle* of the light *id*.
  395. PhysicsWorld
  396. =============
  397. **gravity** (pw) : Vector3
  398. Returns the gravity.
  399. **set_gravity** (pw, gravity)
  400. Sets the gravity.
  401. **raycast** (pw, from, dir, length, mode) : table
  402. Returns the actors which intersects the raycast.
  403. Mode can be either ``closest`` or ``all``.
  404. **enable_debug_drawing** (pw, enable)
  405. Sets whether to *enable* debug drawing.
  406. Actor
  407. -----
  408. **actor_instances** (pw, unit) : Id
  409. Returns the actor of the *unit*.
  410. **actor_world_position** (pw, actor) : Vector3
  411. Returns the world position of the actor.
  412. **actor_world_rotation** (pw, actor) : Quaternion
  413. Returns the world rotation of the actor.
  414. **actor_world_pose** (pw, actor) : Matrix4x4
  415. Returns the world pose of the actor.
  416. **teleport_actor_world_position** (pw, actor, position)
  417. Teleports the actor to the given world position.
  418. **teleport_actor_world_rotation** (pw, actor, rotation)
  419. Teleports the actor to the given world rotation.
  420. **teleport_actor_world_pose** (pw, actor, pose)
  421. Teleports the actor to the given world pose.
  422. **actor_center_of_mass** (pw, actor) : Vector3
  423. Returns the center of mass of the actor.
  424. **enable_actor_gravity** (pw, actor)
  425. Enables gravity for the actor.
  426. **disable_actor_gravity** (pw, actor)
  427. Disables gravity for the actor.
  428. **enable_actor_collision** (pw, actor)
  429. Enables collision detection for the actor.
  430. **disable_actor_collision** (pw, actor)
  431. Disables collision detection for the actor.
  432. **set_actor_collision_filter** (pw, actor, name)
  433. Sets the collision filter of the actor.
  434. **set_actor_kinematic** (pw, actor, kinematic)
  435. Sets whether the actor is kinematic or not.
  436. Note that this call has no effect on static actors.
  437. **move_actor** (pw, actor, position)
  438. Moves the actor to *pos*
  439. Note that this call only affects nonkinematic actors.
  440. **is_static** (pw, actor) : bool
  441. Returns whether the actor is static.
  442. **is_dynamic** (pw, actor) bool
  443. Returns whether the actor is dynamic.
  444. **is_kinematic** (pw, actor) : bool
  445. Returns whether the actor is kinematic (keyframed).
  446. **is_nonkinematic** (pw, actor) : bool
  447. Returns whether the actor is nonkinematic (i.e. dynamic and not kinematic).
  448. **actor_linear_damping** (pw, actor) : float
  449. Returns the linear damping of the actor.
  450. **set_actor_linear_damping** (pw, actor, damping)
  451. Sets the linear damping of the actor.
  452. **actor_angular_damping** (pw, actor) : float
  453. Returns the angular damping of the actor.
  454. **set_actor_angular_damping** (pw, actor, rate)
  455. Sets the angular damping of the actor.
  456. **actor_linear_velocity** (pw, actor) : Vector3
  457. Returns the linear velocity of the actor.
  458. **set_actor_linear_velocity** (pw, actor, velocity)
  459. Sets the linear velocity of the actor.
  460. Note that this call only affects nonkinematic actors.
  461. **actor_angular_velocity** (pw, actor) : Vector3
  462. Returns the angular velocity of the actor.
  463. **set_actor_angular_velocity** (pw, actor, velocity)
  464. Sets the angular velocity of the actor.
  465. Note that this call only affects nonkinematic actors.
  466. **add_actor_impulse** (pw, actor, impulse)
  467. Adds a linear impulse (acting along the center of mass) to the actor.
  468. Note that this call only affects nonkinematic actors.
  469. **add_actor_impulse_at** (pw, actor, impulse, position)
  470. Adds a linear impulse (acting along the world position *pos*) to the actor.
  471. Note that this call only affects nonkinematic actors.
  472. **add_actor_torque_impulse** (pw, actor, impulse)
  473. Adds a torque impulse to the actor.
  474. **push_actor** (pw, actor, velocity, mass)
  475. Pushes the actor as if it was hit by a point object with the given *mass*
  476. travelling at the given *velocity*.
  477. Note that this call only affects nonkinematic actors.
  478. **push_actor_at** (pw, actor, velocity, mass, position)
  479. Like push() but applies the force at the world position *pos*.
  480. Note that this call only affects nonkinematic actors.
  481. **is_sleeping** (pw, actor) : bool
  482. Returns whether the actor is sleeping.
  483. **wake_up** (pw, actor)
  484. Wakes the actor up.
  485. SoundWorld
  486. ===========
  487. **stop_all** (sound_world)
  488. Stops all the sounds in the world.
  489. **pause_all** (sound_world)
  490. Pauses all the sounds in the world
  491. **resume_all** (sound_world)
  492. Resumes all previously paused sounds in the world.
  493. **is_playing** (sound_world, id) : bool
  494. Returns whether the sound *id* is playing.
  495. ResourcePackage
  496. ================
  497. **load** (package)
  498. Loads all the resources in the package.
  499. Note that the resources are not immediately available after the call is made,
  500. instead, you have to poll for completion with has_loaded().
  501. **unload** (package)
  502. Unloads all the resources in the package.
  503. **flush** (package)
  504. Waits until the package has been loaded.
  505. **has_loaded** (package) : bool
  506. Returns whether the package has been loaded.
  507. Device
  508. ======
  509. **argv** () : table
  510. Returns a table containing the command line parameters the engine was started with.
  511. **platform** () : string
  512. Returns a string identifying what platform the engine is running on.
  513. It can be either ``android``, ``linux`` or ``windows``
  514. **architecture** () : string
  515. Returns a string identifying what architecture the engine is running on.
  516. It can be either ``32-bit`` or ``64-bit``.
  517. **version** () : string
  518. Returns a string identifying the engine version.
  519. The form is "major.minor.micro".
  520. **last_delta_time** () : float
  521. Returns the time in seconds needed to render the last frame
  522. **quit** ()
  523. Quits the application.
  524. **resolution** () : float, float
  525. Returns the main window resolution (width, height).
  526. **create_world** () : World
  527. Creates a new world.
  528. **destroy_world** (world)
  529. Destroys the given *world*.
  530. **render** (world, camera)
  531. Renders *world* using *camera*.
  532. **create_resource_package** (name) : ResourcePackage
  533. Returns the resource package with the given *package_name* name.
  534. **destroy_resource_package** (package)
  535. Destroy a previously created resource *package*.
  536. Note that to unload the resources loaded by the package, you have to call
  537. ResourcePackage.unload() first.
  538. **console_send** (table)
  539. Sends the given lua *table* to clients connected to the engine.
  540. Values can be either nil, bool, number, string, Vector2, Vector3, Quaternion, Matrix4x4 or Color4.
  541. **can_get** (type, name) : bool
  542. Returns whether the resource (type, name) is loaded.
  543. When resource autoload is enabled it always returns true.
  544. **enable_resource_autoload** (enable)
  545. Sets whether resources should be automatically loaded when accessed.
  546. DebugLine
  547. =========
  548. **add_line** (debug_line, start, end, color)
  549. Adds a line from *start* to *end* with the given *color*.
  550. **add_axes** (debug_line, tm, length)
  551. Adds lines for each axis with the given *length*.
  552. **add_circle** (debug_line, center, radius, normal, color, [segments = 36])
  553. Adds a circle at *center* with the given *radius* and *normal* vector.
  554. **add_cone** (debug_line, from, to, radius, color, [segments = 36])
  555. Adds a cone with the base centered at *from* and the tip at *to*.
  556. **add_sphere** (debug_line, center, radius, color, [segments = 36])
  557. Adds a sphere at *center* with the given *radius*.
  558. **add_obb** (debug_line, tm, half_extents, color)
  559. Adds an orientd bounding box. *tm* describes the position and orientation of
  560. the box. *half_extents* describes the size of the box along the axis.
  561. **reset** (debug_line)
  562. Resets all the lines.
  563. **submit** (debug_line)
  564. Submits the lines to renderer for drawing.
  565. Input
  566. =====
  567. Keyboard
  568. --------
  569. **name** () : string
  570. Returns the name of keyboard.
  571. **connected** () : bool
  572. Returns whether the keyboard is connected and functioning.
  573. **num_buttons** () : int
  574. Returns the number of buttons of the keyboard.
  575. **num_axes** () : int
  576. Returns the number of axes of the keyboard.
  577. **pressed** (id) : bool
  578. Returns whether the button *id* is pressed in the current frame.
  579. **released** (id) : bool
  580. Returns whether the button *id* is released in the current frame.
  581. **any_pressed** () : bool
  582. Returns whether any button is pressed in the current frame.
  583. **any_released** () : bool
  584. Returns whether any button is released in the current frame.
  585. **button_name** (id) : string
  586. Returns the name of the button *id*.
  587. **button_id** (name) : int
  588. Returns the *id* of the button *name*.
  589. Keyboard Button Names
  590. ~~~~~~~~~~~~~~~~~~~~~
  591. * ``tab``, ``enter``, ``escape``, ``space``, ``backspace``
  592. * ``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``
  593. * ``f1``, ``f2``, ``f3``, ``f4``, ``f5``, ``f6``, ``f7``, ``f8``, ``f9``, ``f10``, ``f11``, ``f12``
  594. * ``home``, ``left``, ``up``, ``right``, ``down``, ``page_up``, ``page_down``, ``insert``, ``delete``, ``end``
  595. * ``left_ctrl``, ``right_ctrl``, ``left_shift``, ``right_shift``, ``caps_lock``, ``left_alt``, ``right_alt``, ``left_super``, ``right_super``
  596. * ``0``, ``1``, ``2``, ``3``, ``4``, ``5``, ``6``, ``7``, ``8``, ``9``
  597. * ``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``
  598. Keyboard Axis Names
  599. ~~~~~~~~~~~~~~~~~~~
  600. None.
  601. Mouse
  602. -----
  603. **name** () : string
  604. Returns the name of the mouse.
  605. **connected** () : bool
  606. Returns whether the mouse is connected and functioning.
  607. **num_buttons** () : int
  608. Returns the number of buttons of the mouse.
  609. **num_axes** () : int
  610. Returns the number of axes of the mouse.
  611. **pressed** (id) : bool
  612. Returns whether the button *id* is pressed in the current frame.
  613. **released** (id) : bool
  614. Returns whether the button *id* is released in the current frame.
  615. **any_pressed** () : bool
  616. Returns whether any button is pressed in the current frame.
  617. **any_released** () : bool
  618. Returns whether any button is released in the current frame.
  619. **axis** (id) : Vector3
  620. Returns the value of the axis *id*.
  621. **button_name** (id) : string
  622. Returns the name of the button *id*.
  623. **axis_name** (id) : string
  624. Returns the name of the axis *id*.
  625. **button_id** (name) : int
  626. Returns the *id* of the button *name*.
  627. **axis_id** (name) : int
  628. Returns the *id* of the axis *name*.
  629. Mouse Button Names
  630. ~~~~~~~~~~~~~~~~~~
  631. ``left``, ``middle``, ``right``, ``extra_1``, ``extra_2``
  632. Mouse Axis Names
  633. ~~~~~~~~~~~~~~~~
  634. * ``cursor``: Returns the cursor position (x, y) in screen coordinates.
  635. * ``cursor_delta``: Returns the delta of the cursor position (x, y) since last frame.
  636. * ``wheel``: Returns the movement of the mouse wheel in the y axis. Positive values of y mean upward scrolling, negative values mean downward scrolling.
  637. Touch
  638. -----
  639. **name** () : string
  640. Returns the name of the touch.
  641. **connected** () : bool
  642. Returns whether the touch is connected and functioning.
  643. **num_buttons** () : int
  644. Returns the number of buttons of the touch.
  645. **num_axes** () : int
  646. Returns the number of axes of the touch.
  647. **pressed** (id) : bool
  648. Returns whether the button *id* is pressed in the current frame.
  649. **released** (id) : bool
  650. Returns whether the button *id* is released in the current frame.
  651. **any_pressed** () : bool
  652. Returns whether any button is pressed in the current frame.
  653. **any_released** () : bool
  654. Returns whether any button is released in the current frame.
  655. **axis** (id) : Vector3
  656. Returns the value of the axis *id*.
  657. **button_name** (id) : string
  658. Returns the name of the button *id*.
  659. **axis_name** (id) : string
  660. Returns the name of the axis *id*.
  661. **button_id** (name) : int
  662. Returns the *id* of the button *name*.
  663. **axis_id** (name) : int
  664. Returns the *id* of the axis *name*.
  665. Pad1, Pad2, Pad3, Pad4
  666. ----------------------
  667. **name** () : string
  668. Returns the name of the pad.
  669. **connected** () : bool
  670. Returns whether the pad is connected and functioning.
  671. **num_buttons** () : int
  672. Returns the number of buttons of the pad.
  673. **num_axes** () : int
  674. Returns the number of axes of the pad.
  675. **pressed** (id) : bool
  676. Returns whether the button *id* is pressed in the current frame.
  677. **released** (id) : bool
  678. Returns whether the button *id* is released in the current frame.
  679. **any_pressed** () : bool
  680. Returns whether any button is pressed in the current frame.
  681. **any_released** () : bool
  682. Returns whether any button is released in the current frame.
  683. **axis** (id) : Vector3
  684. Returns the value of the axis *id*.
  685. **button_name** (id) : string
  686. Returns the name of the button *id*.
  687. **axis_name** (id) : string
  688. Returns the name of the axis *id*.
  689. **button_id** (name) : int
  690. Returns the *id* of the button *name*.
  691. **axis_id** (name) : int
  692. Returns the *id* of the axis *name*.
  693. Pad Button Names
  694. ~~~~~~~~~~~~~~~~
  695. * ``up``, ``down``, ``left``, ``right``
  696. * ``start``, ``back``, ``guide``
  697. * ``left_thumb``, ``right_thumb``
  698. * ``left_shoulder``, ``right_shoulder``
  699. * ``a``, ``b``, ``x``, ``y``
  700. Pad Axis Names
  701. ~~~~~~~~~~~~~~
  702. * ``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].
  703. Profiler
  704. ========
  705. **enter_scope** (name)
  706. Starts a new profile scope with the given *name*.
  707. **leave_scope** ()
  708. Ends the last profile scope.
  709. **record** (name, value)
  710. Records *value* with the given *name*. Value can be either number or Vector3.
  711. Display
  712. =======
  713. **modes** () : table
  714. Returns an array of display modes. See `Display Mode`_.
  715. **set_mode** (id)
  716. Sets the display mode *id*.
  717. The initial display mode is automatically reset when the program terminates.
  718. Display Mode
  719. ------------
  720. Display mode is a lua table with 3 fields:
  721. * ``id``: The id of the display mode.
  722. * ``width``: The width of the display mode.
  723. * ``height``: The height of the display mode.
  724. Window
  725. ======
  726. **show** ()
  727. Shows the window.
  728. **hide** ()
  729. Hides the window.
  730. **resize** (width, height)
  731. Resizes the window to *width* and *height*.
  732. **move** (x, y)
  733. Moves the window to *x* and *y*.
  734. **minimize** ()
  735. Minimizes the window.
  736. **restore** ()
  737. Restores the window.
  738. **title** () : string
  739. Returns the title of the window.
  740. **set_title** (title)
  741. Sets the title of the window.
  742. **show_cursor** (show)
  743. Sets whether to *show* the cursor.