lua_api.html 107 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452
  1. <!DOCTYPE html>
  2. <html class="writer-html4" lang="en" >
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>Lua API reference &mdash; Crown 0.53.0 Manual 0.53.0 documentation</title><link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  7. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  8. <link rel="stylesheet" href="_static/css/custom.css" type="text/css" /><link rel="shortcut icon" href="_static/crown-black-socket.svg"/>
  9. <!--[if lt IE 9]>
  10. <script src="_static/js/html5shiv.min.js"></script>
  11. <![endif]-->
  12. <script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
  13. <script type="text/javascript" src="_static/jquery.js"></script>
  14. <script type="text/javascript" src="_static/underscore.js"></script>
  15. <script type="text/javascript" src="_static/doctools.js"></script>
  16. <script type="text/javascript" src="_static/language_data.js"></script>
  17. <script src="_static/js/theme.js"></script>
  18. <link rel="index" title="Index" href="genindex.html" />
  19. <link rel="search" title="Search" href="search.html" />
  20. <link rel="copyright" title="Copyright" href="copyright.html" />
  21. <link rel="next" title="Glossary" href="glossary.html" />
  22. <link rel="prev" title="Command line" href="reference/command_line.html" />
  23. </head>
  24. <body class="wy-body-for-nav">
  25. <div class="wy-grid-for-nav">
  26. <nav data-toggle="wy-nav-shift" class="wy-nav-side">
  27. <div class="wy-side-scroll">
  28. <div class="wy-side-nav-search" >
  29. <a href="index.html"><img src="_static/crown-black-socket.svg" class="logo" alt="Logo"/>
  30. </a>
  31. <div class="version">
  32. Crown 0.53.0 Manual
  33. </div>
  34. <div role="search">
  35. <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
  36. <input type="text" name="q" placeholder="Search docs" />
  37. <input type="hidden" name="check_keywords" value="yes" />
  38. <input type="hidden" name="area" value="default" />
  39. </form>
  40. </div>
  41. </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
  42. <ul class="current">
  43. <li class="toctree-l1"><a class="reference internal" href="changelog.html">Changelog</a></li>
  44. <li class="toctree-l1"><a class="reference internal" href="introduction.html">Introduction</a></li>
  45. <li class="toctree-l1"><a class="reference internal" href="basics.html">Basic concepts</a></li>
  46. <li class="toctree-l1"><a class="reference internal" href="reference/index.html">Reference</a></li>
  47. <li class="toctree-l1 current"><a class="current reference internal" href="#">Lua API reference</a><ul>
  48. <li class="toctree-l2"><a class="reference internal" href="#animationstatemachine">AnimationStateMachine</a></li>
  49. <li class="toctree-l2"><a class="reference internal" href="#debugline">DebugLine</a></li>
  50. <li class="toctree-l2"><a class="reference internal" href="#device">Device</a></li>
  51. <li class="toctree-l2"><a class="reference internal" href="#display">Display</a><ul>
  52. <li class="toctree-l3"><a class="reference internal" href="#displaymode">DisplayMode</a></li>
  53. </ul>
  54. </li>
  55. <li class="toctree-l2"><a class="reference internal" href="#gui">Gui</a></li>
  56. <li class="toctree-l2"><a class="reference internal" href="#input">Input</a><ul>
  57. <li class="toctree-l3"><a class="reference internal" href="#inputevent">InputEvent</a></li>
  58. <li class="toctree-l3"><a class="reference internal" href="#inputeventtype">InputEventType</a></li>
  59. <li class="toctree-l3"><a class="reference internal" href="#keyboard">Keyboard</a><ul>
  60. <li class="toctree-l4"><a class="reference internal" href="#keyboard-button-names">Keyboard Button Names</a></li>
  61. <li class="toctree-l4"><a class="reference internal" href="#keyboard-axis-names">Keyboard Axis Names</a></li>
  62. </ul>
  63. </li>
  64. <li class="toctree-l3"><a class="reference internal" href="#mouse">Mouse</a><ul>
  65. <li class="toctree-l4"><a class="reference internal" href="#mouse-button-names">Mouse Button Names</a></li>
  66. <li class="toctree-l4"><a class="reference internal" href="#mouse-axis-names">Mouse Axis Names</a></li>
  67. </ul>
  68. </li>
  69. <li class="toctree-l3"><a class="reference internal" href="#touch">Touch</a></li>
  70. <li class="toctree-l3"><a class="reference internal" href="#pad1-pad2-pad3-pad4">Pad1, Pad2, Pad3, Pad4</a><ul>
  71. <li class="toctree-l4"><a class="reference internal" href="#pad-button-names">Pad Button Names</a></li>
  72. <li class="toctree-l4"><a class="reference internal" href="#pad-axis-names">Pad Axis Names</a></li>
  73. </ul>
  74. </li>
  75. </ul>
  76. </li>
  77. <li class="toctree-l2"><a class="reference internal" href="#material">Material</a></li>
  78. <li class="toctree-l2"><a class="reference internal" href="#math">Math</a><ul>
  79. <li class="toctree-l3"><a class="reference internal" href="#vector3">Vector3</a><ul>
  80. <li class="toctree-l4"><a class="reference internal" href="#constructors">Constructors</a></li>
  81. <li class="toctree-l4"><a class="reference internal" href="#functions">Functions</a></li>
  82. </ul>
  83. </li>
  84. <li class="toctree-l3"><a class="reference internal" href="#vector3box">Vector3Box</a><ul>
  85. <li class="toctree-l4"><a class="reference internal" href="#id1">Constructors</a></li>
  86. <li class="toctree-l4"><a class="reference internal" href="#id2">Functions</a></li>
  87. </ul>
  88. </li>
  89. <li class="toctree-l3"><a class="reference internal" href="#quaternion">Quaternion</a><ul>
  90. <li class="toctree-l4"><a class="reference internal" href="#id3">Constructors</a></li>
  91. <li class="toctree-l4"><a class="reference internal" href="#id4">Functions</a></li>
  92. </ul>
  93. </li>
  94. <li class="toctree-l3"><a class="reference internal" href="#quaternionbox">QuaternionBox</a><ul>
  95. <li class="toctree-l4"><a class="reference internal" href="#id5">Constructors</a></li>
  96. <li class="toctree-l4"><a class="reference internal" href="#id6">Functions</a></li>
  97. </ul>
  98. </li>
  99. <li class="toctree-l3"><a class="reference internal" href="#matrix4x4">Matrix4x4</a><ul>
  100. <li class="toctree-l4"><a class="reference internal" href="#id7">Constructors</a></li>
  101. <li class="toctree-l4"><a class="reference internal" href="#id8">Functions</a></li>
  102. </ul>
  103. </li>
  104. <li class="toctree-l3"><a class="reference internal" href="#matrix4x4box">Matrix4x4Box</a><ul>
  105. <li class="toctree-l4"><a class="reference internal" href="#id9">Constructors</a></li>
  106. <li class="toctree-l4"><a class="reference internal" href="#id10">Functions</a></li>
  107. </ul>
  108. </li>
  109. <li class="toctree-l3"><a class="reference internal" href="#color4">Color4</a><ul>
  110. <li class="toctree-l4"><a class="reference internal" href="#id11">Constructors</a></li>
  111. <li class="toctree-l4"><a class="reference internal" href="#id12">Functions</a></li>
  112. </ul>
  113. </li>
  114. <li class="toctree-l3"><a class="reference internal" href="#id13">Math</a></li>
  115. </ul>
  116. </li>
  117. <li class="toctree-l2"><a class="reference internal" href="#physicsworld">PhysicsWorld</a><ul>
  118. <li class="toctree-l3"><a class="reference internal" href="#raycasthit">RaycastHit</a></li>
  119. <li class="toctree-l3"><a class="reference internal" href="#actor">Actor</a></li>
  120. </ul>
  121. </li>
  122. <li class="toctree-l2"><a class="reference internal" href="#profiler">Profiler</a></li>
  123. <li class="toctree-l2"><a class="reference internal" href="#renderworld">RenderWorld</a><ul>
  124. <li class="toctree-l3"><a class="reference internal" href="#mesh">Mesh</a></li>
  125. <li class="toctree-l3"><a class="reference internal" href="#sprite">Sprite</a></li>
  126. <li class="toctree-l3"><a class="reference internal" href="#light">Light</a></li>
  127. </ul>
  128. </li>
  129. <li class="toctree-l2"><a class="reference internal" href="#resourcepackage">ResourcePackage</a></li>
  130. <li class="toctree-l2"><a class="reference internal" href="#scenegraph">SceneGraph</a></li>
  131. <li class="toctree-l2"><a class="reference internal" href="#soundworld">SoundWorld</a></li>
  132. <li class="toctree-l2"><a class="reference internal" href="#unitmanager">UnitManager</a></li>
  133. <li class="toctree-l2"><a class="reference internal" href="#window">Window</a></li>
  134. <li class="toctree-l2"><a class="reference internal" href="#world">World</a><ul>
  135. <li class="toctree-l3"><a class="reference internal" href="#camera">Camera</a></li>
  136. <li class="toctree-l3"><a class="reference internal" href="#sound">Sound</a></li>
  137. <li class="toctree-l3"><a class="reference internal" href="#level">Level</a></li>
  138. </ul>
  139. </li>
  140. </ul>
  141. </li>
  142. <li class="toctree-l1"><a class="reference internal" href="glossary.html">Glossary</a></li>
  143. <li class="toctree-l1"><a class="reference internal" href="copyright.html">License</a></li>
  144. <li class="toctree-l1"><a class="reference internal" href="hackers/index.html">Hackers</a></li>
  145. </ul>
  146. </div>
  147. </div>
  148. </nav>
  149. <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
  150. <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
  151. <a href="index.html">Crown 0.53.0 Manual</a>
  152. </nav>
  153. <div class="wy-nav-content">
  154. <div class="rst-content">
  155. <div role="navigation" aria-label="Page navigation">
  156. <ul class="wy-breadcrumbs">
  157. <li><a href="index.html" class="icon icon-home"></a> &raquo;</li>
  158. <li>Lua API reference</li>
  159. <li class="wy-breadcrumbs-aside">
  160. <a href="_sources/lua_api.rst.txt" rel="nofollow"> View page source</a>
  161. </li>
  162. </ul>
  163. <hr/>
  164. </div>
  165. <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
  166. <div itemprop="articleBody">
  167. <div class="section" id="lua-api-reference">
  168. <h1>Lua API reference<a class="headerlink" href="#lua-api-reference" title="Permalink to this headline">¶</a></h1>
  169. <div class="section" id="animationstatemachine">
  170. <h2>AnimationStateMachine<a class="headerlink" href="#animationstatemachine" title="Permalink to this headline">¶</a></h2>
  171. <dl class="docutils">
  172. <dt><strong>instance</strong> (asm, unit) <span class="classifier-delimiter">:</span> <span class="classifier">Id</span></dt>
  173. <dd>Returns the ID of the state machine owned by the <em>unit</em>, or <code class="docutils literal notranslate"><span class="pre">nil</span></code>.</dd>
  174. <dt><strong>variable_id</strong> (asm, state_machine, name) <span class="classifier-delimiter">:</span> <span class="classifier">Id</span></dt>
  175. <dd>Returns the ID of the variable <em>name</em> in the <em>state_machine</em>.</dd>
  176. <dt><strong>variable</strong> (asm, state_machine, variable_id) <span class="classifier-delimiter">:</span> <span class="classifier">number</span></dt>
  177. <dd>Returns the value of the <em>variable_id</em> in the <em>state_machine</em>.</dd>
  178. <dt><strong>set_variable</strong> (asm, state_machine, variable_id, value)</dt>
  179. <dd>Sets the <em>value</em> of the <em>variable_id</em> in the <em>state_machine</em>.</dd>
  180. <dt><strong>trigger</strong> (asm, state_machine, event)</dt>
  181. <dd>Triggers the <em>event</em> in the <em>state_machine</em>.</dd>
  182. </dl>
  183. </div>
  184. <div class="section" id="debugline">
  185. <h2>DebugLine<a class="headerlink" href="#debugline" title="Permalink to this headline">¶</a></h2>
  186. <dl class="docutils">
  187. <dt><strong>add_line</strong> (debug_line, start, end, color)</dt>
  188. <dd>Adds a line from <em>start</em> to <em>end</em> with the given <em>color</em>.</dd>
  189. <dt><strong>add_axes</strong> (debug_line, tm, length)</dt>
  190. <dd>Adds lines for each axis with the given <em>length</em>.</dd>
  191. <dt><strong>add_arc</strong> (debug_line, center, radius, plane_normal, midpoint_normal, color, [circle_segments = 36]);</dt>
  192. <dd>Adds an arc at <em>center</em> with the given <em>radius</em> and <em>plane_normal</em> and <em>midpoint_normal</em> vectors.</dd>
  193. <dt><strong>add_circle</strong> (debug_line, center, radius, normal, color, [segments = 36])</dt>
  194. <dd>Adds a circle at <em>center</em> with the given <em>radius</em> and <em>normal</em> vector.</dd>
  195. <dt><strong>add_cone</strong> (debug_line, from, to, radius, color, [segments = 36])</dt>
  196. <dd>Adds a cone with the base centered at <em>from</em> and the tip at <em>to</em>.</dd>
  197. <dt><strong>add_sphere</strong> (debug_line, center, radius, color, [segments = 36])</dt>
  198. <dd>Adds a sphere at <em>center</em> with the given <em>radius</em>.</dd>
  199. <dt><strong>add_obb</strong> (debug_line, tm, half_extents, color)</dt>
  200. <dd>Adds an orientd bounding box. <em>tm</em> describes the position and orientation of
  201. the box. <em>half_extents</em> describes the size of the box along the axis.</dd>
  202. <dt><strong>add_frustum</strong> (debug_line, mvp, color)</dt>
  203. <dd>Adds a frustum defined by <em>mvp</em>.</dd>
  204. <dt><strong>reset</strong> (debug_line)</dt>
  205. <dd>Resets all the lines.</dd>
  206. <dt><strong>submit</strong> (debug_line)</dt>
  207. <dd>Submits the lines to renderer for drawing.</dd>
  208. </dl>
  209. </div>
  210. <div class="section" id="device">
  211. <h2>Device<a class="headerlink" href="#device" title="Permalink to this headline">¶</a></h2>
  212. <dl class="docutils">
  213. <dt><strong>argv</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">table</span></dt>
  214. <dd>Returns a table containing the command line parameters the engine was started with.</dd>
  215. <dt><strong>platform</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
  216. <dd>Returns a string identifying what platform the engine is running on.
  217. It can be either <code class="docutils literal notranslate"><span class="pre">android</span></code>, <code class="docutils literal notranslate"><span class="pre">linux</span></code> or <code class="docutils literal notranslate"><span class="pre">windows</span></code></dd>
  218. <dt><strong>architecture</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
  219. <dd>Returns a string identifying what architecture the engine is running on.
  220. It can be either <code class="docutils literal notranslate"><span class="pre">32-bit</span></code> or <code class="docutils literal notranslate"><span class="pre">64-bit</span></code>.</dd>
  221. <dt><strong>version</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
  222. <dd>Returns a string identifying the engine version.
  223. The form is “major.minor.micro”.</dd>
  224. <dt><strong>quit</strong> ()</dt>
  225. <dd>Quits the application.</dd>
  226. <dt><strong>resolution</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">float, float</span></dt>
  227. <dd>Returns the main window resolution (width, height).</dd>
  228. <dt><strong>create_world</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">World</span></dt>
  229. <dd>Creates a new world.</dd>
  230. <dt><strong>destroy_world</strong> (world)</dt>
  231. <dd>Destroys the given <em>world</em>.</dd>
  232. <dt><strong>render</strong> (world, camera)</dt>
  233. <dd>Renders <em>world</em> using <em>camera</em>.</dd>
  234. <dt><strong>create_resource_package</strong> (name) <span class="classifier-delimiter">:</span> <span class="classifier">ResourcePackage</span></dt>
  235. <dd>Returns the resource package with the given <em>package_name</em> name.</dd>
  236. <dt><strong>destroy_resource_package</strong> (package)</dt>
  237. <dd><p class="first">Destroy a previously created resource <em>package</em>.</p>
  238. <div class="last admonition note">
  239. <p class="first admonition-title">Note</p>
  240. <p class="last">To unload the resources loaded by the package, you have to call
  241. ResourcePackage.unload() first.</p>
  242. </div>
  243. </dd>
  244. <dt><strong>screenshot</strong> (path)</dt>
  245. <dd><p class="first">Captures a screenshot of the main window’s backbuffer and saves it at <em>path</em> in PNG format.
  246. The global callback <code class="docutils literal notranslate"><span class="pre">screenshot</span> <span class="pre">(path)</span></code> will be called after the file is written to disk.</p>
  247. <div class="last admonition note">
  248. <p class="first admonition-title">Note</p>
  249. <p class="last">Only available in debug and development builds.</p>
  250. </div>
  251. </dd>
  252. <dt><strong>console_send</strong> (table)</dt>
  253. <dd>Sends the given lua <em>table</em> to clients connected to the engine.
  254. Values can be either <code class="docutils literal notranslate"><span class="pre">nil</span></code>, bool, number, string, table, array, Vector2, Vector3, Quaternion, Matrix4x4 or Color4.</dd>
  255. <dt><strong>can_get</strong> (type, name) <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  256. <dd>Returns whether the resource (type, name) is loaded.
  257. When resource autoload is enabled it always returns true.</dd>
  258. <dt><strong>enable_resource_autoload</strong> (enable)</dt>
  259. <dd>Sets whether resources should be automatically loaded when accessed.</dd>
  260. <dt><strong>temp_count</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">int, int, int</span></dt>
  261. <dd>Returns the number of temporary objects used by Lua.</dd>
  262. <dt><strong>set_temp_count</strong> (nv, nq, nm)</dt>
  263. <dd>Sets the number of temporary objects used by Lua.</dd>
  264. <dt><strong>guid</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
  265. <dd>Returns a new GUID.</dd>
  266. <dt><strong>set_timestep_policy</strong> (policy)</dt>
  267. <dd><p class="first">Sets the timestep policy:</p>
  268. <ul class="last simple">
  269. <li><code class="docutils literal notranslate"><span class="pre">variable</span></code>: the timestep is the time it took for the previous frame to simulate. This is the default;</li>
  270. <li><code class="docutils literal notranslate"><span class="pre">smoothed</span></code>: the timestep is computed as an average of the previous delta times.</li>
  271. </ul>
  272. </dd>
  273. <dt><strong>set_timestep_smoothing</strong> (num_samples, num_outliers, average_cap)</dt>
  274. <dd><p class="first">Sets the number of samples to be averaged, the outliers to be excluded and the maximum
  275. allowed deviation in percent from the previous average. Given a delta time series DTs, and
  276. a previous average AVGp:</p>
  277. <ul class="simple">
  278. <li>DTs = [ .33; .30; .32; .33; .24; .33; .25; .35; .33; .42 ]</li>
  279. <li>AVGp = 0.33</li>
  280. </ul>
  281. <p>A call to set_smoothing(10, 2, 0.1) would compute the new average like so:</p>
  282. <ol class="last arabic simple">
  283. <li>Remove the 2 minimum and maximum values in DTs;</li>
  284. <li>Compute the average for the remaining 6 values in DTs: AVG = 0.323.</li>
  285. <li>Smooth the newly computed average: AVG = lerp(AVGp, AVG, 0.1) = 0.329.</li>
  286. </ol>
  287. </dd>
  288. </dl>
  289. </div>
  290. <div class="section" id="display">
  291. <h2>Display<a class="headerlink" href="#display" title="Permalink to this headline">¶</a></h2>
  292. <dl class="docutils">
  293. <dt><strong>modes</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">table</span></dt>
  294. <dd>Returns an array of <a class="reference internal" href="#displaymode">DisplayMode</a> tables.</dd>
  295. <dt><strong>set_mode</strong> (id)</dt>
  296. <dd>Sets the display mode <em>id</em>.
  297. The initial display mode is automatically reset when the program terminates.</dd>
  298. </dl>
  299. <div class="section" id="displaymode">
  300. <h3>DisplayMode<a class="headerlink" href="#displaymode" title="Permalink to this headline">¶</a></h3>
  301. <p>DisplayMode is a lua table with 3 fields:</p>
  302. <ul class="simple">
  303. <li><code class="docutils literal notranslate"><span class="pre">id</span></code>: The id of the display mode.</li>
  304. <li><code class="docutils literal notranslate"><span class="pre">width</span></code>: The width of the display mode.</li>
  305. <li><code class="docutils literal notranslate"><span class="pre">height</span></code>: The height of the display mode.</li>
  306. </ul>
  307. </div>
  308. </div>
  309. <div class="section" id="gui">
  310. <h2>Gui<a class="headerlink" href="#gui" title="Permalink to this headline">¶</a></h2>
  311. <dl class="docutils">
  312. <dt><strong>move</strong> (gui, pos)</dt>
  313. <dd>Moves the Gui to <em>pos</em>.</dd>
  314. <dt><strong>triangle</strong> (gui, a, b, c, color [, depth])</dt>
  315. <dd>Draws a triangle defined by vertices <em>a</em>, <em>b</em> and <em>c</em>.
  316. Objects with a lower depth are drawn in front. If depth is omitted its value
  317. is set to 0.</dd>
  318. <dt><strong>triangle_3d</strong> (gui, local_pose, a, b, c, color [, depth])</dt>
  319. <dd>Draws a 3D triangle defined by vertices <em>a</em>, <em>b</em> and <em>c</em>.</dd>
  320. <dt><strong>rect</strong> (gui, pos, size, color)</dt>
  321. <dd>Draws a rectangle.
  322. If pos is a Vector3, the z element specifies the drawing depth. Objects with
  323. a lower depth are drawn in front. If pos is a Vector2, the z elements is set
  324. to 0.</dd>
  325. <dt><strong>rect_3d</strong> (gui, local_pose, pos, size, color [, depth])</dt>
  326. <dd>Draws a 3D rectangle.</dd>
  327. <dt><strong>image</strong> (gui, pos, size, material_resource, color)</dt>
  328. <dd>Draws an image.
  329. If pos is a Vector3, the z element specifies the drawing depth. Objects with
  330. a lower depth are drawn in front. If pos is a Vector2, the z elements is set
  331. to 0.</dd>
  332. <dt><strong>image_3d</strong> (gui, local_pose, pos, size, material_resource, color [, depth])</dt>
  333. <dd>Draws a 3D image.</dd>
  334. <dt><strong>image_uv</strong> (gui, pos, size, uv0, uv1, material_resource, color)</dt>
  335. <dd>Draws an image with explicit UV coordinates.
  336. If pos is a Vector3, the z element specifies the drawing depth. Objects with
  337. a lower depth are drawn in front. If pos is a Vector2, the z elements is set
  338. to 0.</dd>
  339. <dt><strong>image_3d_uv</strong> (gui, local_pose, pos, size, uv0, uv1, material_resource, color [, depth])</dt>
  340. <dd>Draws a 3D image with explicit UV coordinates.</dd>
  341. <dt><strong>text</strong> (gui, pos, font_size, str, font_resource, material_resource, color)</dt>
  342. <dd>Draws text.
  343. If pos is a Vector3, the z element specifies the drawing depth. Objects with
  344. a lower depth are drawn in front. If pos is a Vector2, the z elements is set
  345. to 0.</dd>
  346. <dt><strong>text_3d</strong> (gui, local_pose, pos, font_size, str, font_resource, material_resource, color [, depth])</dt>
  347. <dd>Draws 3D text.</dd>
  348. <dt><strong>material</strong> (material_resource) <span class="classifier-delimiter">:</span> <span class="classifier">Material</span></dt>
  349. <dd>Returns the material <em>material_resource</em>.</dd>
  350. </dl>
  351. </div>
  352. <div class="section" id="input">
  353. <h2>Input<a class="headerlink" href="#input" title="Permalink to this headline">¶</a></h2>
  354. <dl class="docutils">
  355. <dt><strong>events</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">table</span></dt>
  356. <dd>Returns an array of <a class="reference internal" href="#inputevent">InputEvent</a> tables.</dd>
  357. </dl>
  358. <div class="section" id="inputevent">
  359. <h3>InputEvent<a class="headerlink" href="#inputevent" title="Permalink to this headline">¶</a></h3>
  360. <p>InputEvent is a lua table with 4 fields:</p>
  361. <ul class="simple">
  362. <li><code class="docutils literal notranslate"><span class="pre">id</span></code>: The id of the button or axis as returned by <code class="docutils literal notranslate"><span class="pre">Keyboard.button_id()</span></code> for example.</li>
  363. <li><code class="docutils literal notranslate"><span class="pre">type</span></code>: One of the values from <a class="reference internal" href="#inputeventtype">InputEventType</a>.</li>
  364. <li><code class="docutils literal notranslate"><span class="pre">value</span></code>: The value of the axis as a Vector3 or <code class="docutils literal notranslate"><span class="pre">nil</span></code> when <code class="docutils literal notranslate"><span class="pre">type</span></code> is not an axis event.</li>
  365. <li><code class="docutils literal notranslate"><span class="pre">device</span></code>: The input device that generated the event. This is one of <code class="docutils literal notranslate"><span class="pre">Keyboard</span></code>, <code class="docutils literal notranslate"><span class="pre">Mouse</span></code>, <code class="docutils literal notranslate"><span class="pre">Pad1</span></code> etc.</li>
  366. </ul>
  367. </div>
  368. <div class="section" id="inputeventtype">
  369. <h3>InputEventType<a class="headerlink" href="#inputeventtype" title="Permalink to this headline">¶</a></h3>
  370. <ul class="simple">
  371. <li><code class="docutils literal notranslate"><span class="pre">BUTTON_PRESSED</span></code>: A button has been pressed.</li>
  372. <li><code class="docutils literal notranslate"><span class="pre">BUTTON_RELEASED</span></code>: A button has been released.</li>
  373. <li><code class="docutils literal notranslate"><span class="pre">AXIS_CHANGED</span></code>: An axis changed its value.</li>
  374. </ul>
  375. </div>
  376. <div class="section" id="keyboard">
  377. <h3>Keyboard<a class="headerlink" href="#keyboard" title="Permalink to this headline">¶</a></h3>
  378. <dl class="docutils">
  379. <dt><strong>name</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
  380. <dd>Returns the name of keyboard.</dd>
  381. <dt><strong>connected</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  382. <dd>Returns whether the keyboard is connected and functioning.</dd>
  383. <dt><strong>num_buttons</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
  384. <dd>Returns the number of buttons of the keyboard.</dd>
  385. <dt><strong>num_axes</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
  386. <dd>Returns the number of axes of the keyboard.</dd>
  387. <dt><strong>pressed</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  388. <dd>Returns whether the button <em>id</em> is pressed in the current frame.</dd>
  389. <dt><strong>released</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  390. <dd>Returns whether the button <em>id</em> is released in the current frame.</dd>
  391. <dt><strong>any_pressed</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  392. <dd>Returns the <em>id</em> of the first button that was pressed in the current frame
  393. or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no buttons were pressed at all.</dd>
  394. <dt><strong>any_released</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  395. <dd>Returns the <em>id</em> of the first button that was released in the current frame
  396. or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no buttons were released at all.</dd>
  397. <dt><strong>button</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  398. <dd>Returns the value of the button <em>id</em> in the range [0..1].</dd>
  399. <dt><strong>button_name</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
  400. <dd>Returns the name of the button <em>id</em>.</dd>
  401. <dt><strong>button_id</strong> (name) <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
  402. <dd>Returns the <em>id</em> of the button <em>name</em> or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no matching button is found.</dd>
  403. </dl>
  404. <div class="section" id="keyboard-button-names">
  405. <h4>Keyboard Button Names<a class="headerlink" href="#keyboard-button-names" title="Permalink to this headline">¶</a></h4>
  406. <ul class="simple">
  407. <li><code class="docutils literal notranslate"><span class="pre">tab</span></code>, <code class="docutils literal notranslate"><span class="pre">enter</span></code>, <code class="docutils literal notranslate"><span class="pre">escape</span></code>, <code class="docutils literal notranslate"><span class="pre">space</span></code>, <code class="docutils literal notranslate"><span class="pre">backspace</span></code></li>
  408. <li><code class="docutils literal notranslate"><span class="pre">num_lock</span></code>, <code class="docutils literal notranslate"><span class="pre">numpad_enter</span></code>, <code class="docutils literal notranslate"><span class="pre">numpad_.</span></code>, <code class="docutils literal notranslate"><span class="pre">numpad_*</span></code>, <code class="docutils literal notranslate"><span class="pre">numpad_+</span></code>, <code class="docutils literal notranslate"><span class="pre">numpad_-</span></code>, <code class="docutils literal notranslate"><span class="pre">numpad_/</span></code>, <code class="docutils literal notranslate"><span class="pre">numpad_0</span></code>, <code class="docutils literal notranslate"><span class="pre">numpad_1</span></code>, <code class="docutils literal notranslate"><span class="pre">numpad_2</span></code>, <code class="docutils literal notranslate"><span class="pre">numpad_3</span></code>, <code class="docutils literal notranslate"><span class="pre">numpad_4</span></code>, <code class="docutils literal notranslate"><span class="pre">numpad_5</span></code>, <code class="docutils literal notranslate"><span class="pre">numpad_6</span></code>, <code class="docutils literal notranslate"><span class="pre">numpad_7</span></code>, <code class="docutils literal notranslate"><span class="pre">numpad_8</span></code>, <code class="docutils literal notranslate"><span class="pre">numpad_9</span></code></li>
  409. <li><code class="docutils literal notranslate"><span class="pre">f1</span></code>, <code class="docutils literal notranslate"><span class="pre">f2</span></code>, <code class="docutils literal notranslate"><span class="pre">f3</span></code>, <code class="docutils literal notranslate"><span class="pre">f4</span></code>, <code class="docutils literal notranslate"><span class="pre">f5</span></code>, <code class="docutils literal notranslate"><span class="pre">f6</span></code>, <code class="docutils literal notranslate"><span class="pre">f7</span></code>, <code class="docutils literal notranslate"><span class="pre">f8</span></code>, <code class="docutils literal notranslate"><span class="pre">f9</span></code>, <code class="docutils literal notranslate"><span class="pre">f10</span></code>, <code class="docutils literal notranslate"><span class="pre">f11</span></code>, <code class="docutils literal notranslate"><span class="pre">f12</span></code></li>
  410. <li><code class="docutils literal notranslate"><span class="pre">home</span></code>, <code class="docutils literal notranslate"><span class="pre">left</span></code>, <code class="docutils literal notranslate"><span class="pre">up</span></code>, <code class="docutils literal notranslate"><span class="pre">right</span></code>, <code class="docutils literal notranslate"><span class="pre">down</span></code>, <code class="docutils literal notranslate"><span class="pre">page_up</span></code>, <code class="docutils literal notranslate"><span class="pre">page_down</span></code>, <code class="docutils literal notranslate"><span class="pre">ins</span></code>, <code class="docutils literal notranslate"><span class="pre">del</span></code>, <code class="docutils literal notranslate"><span class="pre">end</span></code></li>
  411. <li><code class="docutils literal notranslate"><span class="pre">ctrl_left</span></code>, <code class="docutils literal notranslate"><span class="pre">ctrl_right</span></code>, <code class="docutils literal notranslate"><span class="pre">shift_left</span></code>, <code class="docutils literal notranslate"><span class="pre">shift_right</span></code>, <code class="docutils literal notranslate"><span class="pre">caps_lock</span></code>, <code class="docutils literal notranslate"><span class="pre">alt_left</span></code>, <code class="docutils literal notranslate"><span class="pre">alt_right</span></code>, <code class="docutils literal notranslate"><span class="pre">super_left</span></code>, <code class="docutils literal notranslate"><span class="pre">super_right</span></code></li>
  412. <li><code class="docutils literal notranslate"><span class="pre">0</span></code>, <code class="docutils literal notranslate"><span class="pre">1</span></code>, <code class="docutils literal notranslate"><span class="pre">2</span></code>, <code class="docutils literal notranslate"><span class="pre">3</span></code>, <code class="docutils literal notranslate"><span class="pre">4</span></code>, <code class="docutils literal notranslate"><span class="pre">5</span></code>, <code class="docutils literal notranslate"><span class="pre">6</span></code>, <code class="docutils literal notranslate"><span class="pre">7</span></code>, <code class="docutils literal notranslate"><span class="pre">8</span></code>, <code class="docutils literal notranslate"><span class="pre">9</span></code></li>
  413. <li><code class="docutils literal notranslate"><span class="pre">a</span></code>, <code class="docutils literal notranslate"><span class="pre">b</span></code>, <code class="docutils literal notranslate"><span class="pre">c</span></code>, <code class="docutils literal notranslate"><span class="pre">d</span></code>, <code class="docutils literal notranslate"><span class="pre">e</span></code>, <code class="docutils literal notranslate"><span class="pre">f</span></code>, <code class="docutils literal notranslate"><span class="pre">g</span></code>, <code class="docutils literal notranslate"><span class="pre">h</span></code>, <code class="docutils literal notranslate"><span class="pre">i</span></code>, <code class="docutils literal notranslate"><span class="pre">j</span></code>, <code class="docutils literal notranslate"><span class="pre">k</span></code>, <code class="docutils literal notranslate"><span class="pre">l</span></code>, <code class="docutils literal notranslate"><span class="pre">m</span></code>, <code class="docutils literal notranslate"><span class="pre">n</span></code>, <code class="docutils literal notranslate"><span class="pre">o</span></code>, <code class="docutils literal notranslate"><span class="pre">p</span></code>, <code class="docutils literal notranslate"><span class="pre">q</span></code>, <code class="docutils literal notranslate"><span class="pre">r</span></code>, <code class="docutils literal notranslate"><span class="pre">s</span></code>, <code class="docutils literal notranslate"><span class="pre">t</span></code>, <code class="docutils literal notranslate"><span class="pre">u</span></code>, <code class="docutils literal notranslate"><span class="pre">v</span></code>, <code class="docutils literal notranslate"><span class="pre">w</span></code>, <code class="docutils literal notranslate"><span class="pre">x</span></code>, <code class="docutils literal notranslate"><span class="pre">y</span></code>, <code class="docutils literal notranslate"><span class="pre">z</span></code></li>
  414. </ul>
  415. </div>
  416. <div class="section" id="keyboard-axis-names">
  417. <h4>Keyboard Axis Names<a class="headerlink" href="#keyboard-axis-names" title="Permalink to this headline">¶</a></h4>
  418. <p>None.</p>
  419. </div>
  420. </div>
  421. <div class="section" id="mouse">
  422. <h3>Mouse<a class="headerlink" href="#mouse" title="Permalink to this headline">¶</a></h3>
  423. <dl class="docutils">
  424. <dt><strong>name</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
  425. <dd>Returns the name of the mouse.</dd>
  426. <dt><strong>connected</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  427. <dd>Returns whether the mouse is connected and functioning.</dd>
  428. <dt><strong>num_buttons</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
  429. <dd>Returns the number of buttons of the mouse.</dd>
  430. <dt><strong>num_axes</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
  431. <dd>Returns the number of axes of the mouse.</dd>
  432. <dt><strong>pressed</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  433. <dd>Returns whether the button <em>id</em> is pressed in the current frame.</dd>
  434. <dt><strong>released</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  435. <dd>Returns whether the button <em>id</em> is released in the current frame.</dd>
  436. <dt><strong>any_pressed</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  437. <dd>Returns the <em>id</em> of the first button that was pressed in the current frame
  438. or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no buttons were pressed at all.</dd>
  439. <dt><strong>any_released</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  440. <dd>Returns the <em>id</em> of the first button that was released in the current frame
  441. or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no buttons were released at all.</dd>
  442. <dt><strong>button</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  443. <dd>Returns the value of the button <em>id</em> in the range [0..1].</dd>
  444. <dt><strong>axis</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  445. <dd>Returns the value of the axis <em>id</em>.</dd>
  446. <dt><strong>button_name</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
  447. <dd>Returns the name of the button <em>id</em>.</dd>
  448. <dt><strong>axis_name</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
  449. <dd>Returns the name of the axis <em>id</em>.</dd>
  450. <dt><strong>button_id</strong> (name) <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
  451. <dd>Returns the <em>id</em> of the button <em>name</em> or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no matching button is found.</dd>
  452. <dt><strong>axis_id</strong> (name) <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
  453. <dd>Returns the <em>id</em> of the axis <em>name</em> or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no matching axis is found.</dd>
  454. </dl>
  455. <div class="section" id="mouse-button-names">
  456. <h4>Mouse Button Names<a class="headerlink" href="#mouse-button-names" title="Permalink to this headline">¶</a></h4>
  457. <p><code class="docutils literal notranslate"><span class="pre">left</span></code>, <code class="docutils literal notranslate"><span class="pre">middle</span></code>, <code class="docutils literal notranslate"><span class="pre">right</span></code>, <code class="docutils literal notranslate"><span class="pre">extra_1</span></code>, <code class="docutils literal notranslate"><span class="pre">extra_2</span></code></p>
  458. </div>
  459. <div class="section" id="mouse-axis-names">
  460. <h4>Mouse Axis Names<a class="headerlink" href="#mouse-axis-names" title="Permalink to this headline">¶</a></h4>
  461. <ul class="simple">
  462. <li><code class="docutils literal notranslate"><span class="pre">cursor</span></code>: Returns the cursor position (x, y) in screen coordinates.</li>
  463. <li><code class="docutils literal notranslate"><span class="pre">cursor_delta</span></code>: Returns the delta of the cursor position (x, y) since last frame.</li>
  464. <li><code class="docutils literal notranslate"><span class="pre">wheel</span></code>: Returns the movement of the mouse wheel in the y axis. Positive values of y mean upward scrolling, negative values mean downward scrolling.</li>
  465. </ul>
  466. </div>
  467. </div>
  468. <div class="section" id="touch">
  469. <h3>Touch<a class="headerlink" href="#touch" title="Permalink to this headline">¶</a></h3>
  470. <dl class="docutils">
  471. <dt><strong>name</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
  472. <dd>Returns the name of the touch.</dd>
  473. <dt><strong>connected</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  474. <dd>Returns whether the touch is connected and functioning.</dd>
  475. <dt><strong>num_buttons</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
  476. <dd>Returns the number of buttons of the touch.</dd>
  477. <dt><strong>num_axes</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
  478. <dd>Returns the number of axes of the touch.</dd>
  479. <dt><strong>pressed</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  480. <dd>Returns whether the button <em>id</em> is pressed in the current frame.</dd>
  481. <dt><strong>released</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  482. <dd>Returns whether the button <em>id</em> is released in the current frame.</dd>
  483. <dt><strong>any_pressed</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  484. <dd>Returns the <em>id</em> of the first button that was pressed in the current frame
  485. or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no buttons were pressed at all.</dd>
  486. <dt><strong>any_released</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  487. <dd>Returns the <em>id</em> of the first button that was released in the current frame
  488. or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no buttons were released at all.</dd>
  489. <dt><strong>button</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  490. <dd>Returns the value of the button <em>id</em> in the range [0..1].</dd>
  491. <dt><strong>axis</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  492. <dd>Returns the value of the axis <em>id</em>.</dd>
  493. <dt><strong>button_name</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
  494. <dd>Returns the name of the button <em>id</em>.</dd>
  495. <dt><strong>axis_name</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
  496. <dd>Returns the name of the axis <em>id</em>.</dd>
  497. <dt><strong>button_id</strong> (name) <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
  498. <dd>Returns the <em>id</em> of the button <em>name</em> or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no matching button is found.</dd>
  499. <dt><strong>axis_id</strong> (name) <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
  500. <dd>Returns the <em>id</em> of the axis <em>name</em> or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no matching axis is found.</dd>
  501. </dl>
  502. </div>
  503. <div class="section" id="pad1-pad2-pad3-pad4">
  504. <h3>Pad1, Pad2, Pad3, Pad4<a class="headerlink" href="#pad1-pad2-pad3-pad4" title="Permalink to this headline">¶</a></h3>
  505. <dl class="docutils">
  506. <dt><strong>name</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
  507. <dd>Returns the name of the pad.</dd>
  508. <dt><strong>connected</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  509. <dd>Returns whether the pad is connected and functioning.</dd>
  510. <dt><strong>num_buttons</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
  511. <dd>Returns the number of buttons of the pad.</dd>
  512. <dt><strong>num_axes</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
  513. <dd>Returns the number of axes of the pad.</dd>
  514. <dt><strong>pressed</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  515. <dd>Returns whether the button <em>id</em> is pressed in the current frame.</dd>
  516. <dt><strong>released</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  517. <dd>Returns whether the button <em>id</em> is released in the current frame.</dd>
  518. <dt><strong>any_pressed</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  519. <dd>Returns the <em>id</em> of the first button that was pressed in the current frame
  520. or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no buttons were pressed at all.</dd>
  521. <dt><strong>any_released</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  522. <dd>Returns the <em>id</em> of the first button that was released in the current frame
  523. or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no buttons were released at all.</dd>
  524. <dt><strong>button</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  525. <dd>Returns the value of the button <em>id</em> in the range [0..1].</dd>
  526. <dt><strong>axis</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  527. <dd>Returns the value of the axis <em>id</em>.</dd>
  528. <dt><strong>button_name</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
  529. <dd>Returns the name of the button <em>id</em>.</dd>
  530. <dt><strong>axis_name</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
  531. <dd>Returns the name of the axis <em>id</em>.</dd>
  532. <dt><strong>button_id</strong> (name) <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
  533. <dd>Returns the <em>id</em> of the button <em>name</em> or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no matching button is found.</dd>
  534. <dt><strong>axis_id</strong> (name) <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
  535. <dd>Returns the <em>id</em> of the axis <em>name</em> or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no matching axis is found.</dd>
  536. <dt><strong>deadzone</strong> (id) <span class="classifier-delimiter">:</span> <span class="classifier">deadzone_mode, deadzone_size</span></dt>
  537. <dd>Returns the deadzone mode and size for the axis <em>id</em>.</dd>
  538. <dt><strong>set_deadzone</strong> (id, deadzone_mode, deadzone_size)</dt>
  539. <dd>Sets the <em>deadzone_mode</em> and <em>deadzone_size</em> for the axis <em>id</em>.</dd>
  540. </dl>
  541. <div class="section" id="pad-button-names">
  542. <h4>Pad Button Names<a class="headerlink" href="#pad-button-names" title="Permalink to this headline">¶</a></h4>
  543. <ul class="simple">
  544. <li><code class="docutils literal notranslate"><span class="pre">up</span></code>, <code class="docutils literal notranslate"><span class="pre">down</span></code>, <code class="docutils literal notranslate"><span class="pre">left</span></code>, <code class="docutils literal notranslate"><span class="pre">right</span></code></li>
  545. <li><code class="docutils literal notranslate"><span class="pre">start</span></code>, <code class="docutils literal notranslate"><span class="pre">back</span></code>, <code class="docutils literal notranslate"><span class="pre">guide</span></code></li>
  546. <li><code class="docutils literal notranslate"><span class="pre">thumb_left</span></code>, <code class="docutils literal notranslate"><span class="pre">thumb_right</span></code></li>
  547. <li><code class="docutils literal notranslate"><span class="pre">shoulder_left</span></code>, <code class="docutils literal notranslate"><span class="pre">shoulder_right</span></code></li>
  548. <li><code class="docutils literal notranslate"><span class="pre">a</span></code>, <code class="docutils literal notranslate"><span class="pre">b</span></code>, <code class="docutils literal notranslate"><span class="pre">x</span></code>, <code class="docutils literal notranslate"><span class="pre">y</span></code></li>
  549. </ul>
  550. </div>
  551. <div class="section" id="pad-axis-names">
  552. <h4>Pad Axis Names<a class="headerlink" href="#pad-axis-names" title="Permalink to this headline">¶</a></h4>
  553. <ul class="simple">
  554. <li><code class="docutils literal notranslate"><span class="pre">left</span></code>, <code class="docutils literal notranslate"><span class="pre">right</span></code>: Returns the direction (x, y) of the left or right thumbstick [-1; +1].</li>
  555. <li><code class="docutils literal notranslate"><span class="pre">trigger_left</span></code>, <code class="docutils literal notranslate"><span class="pre">trigger_right</span></code>: The z element represents the left or right trigger [0; +1].</li>
  556. </ul>
  557. </div>
  558. </div>
  559. </div>
  560. <div class="section" id="material">
  561. <h2>Material<a class="headerlink" href="#material" title="Permalink to this headline">¶</a></h2>
  562. <dl class="docutils">
  563. <dt><strong>set_float</strong> (material, name, value)</dt>
  564. <dd>Sets the <em>value</em> of the variable <em>name</em>.</dd>
  565. <dt><strong>set_vector2</strong> (material, name, value)</dt>
  566. <dd>Sets the <em>value</em> of the variable <em>name</em>.</dd>
  567. <dt><strong>set_vector3</strong> (material, name, value)</dt>
  568. <dd>Sets the <em>value</em> of the variable <em>name</em>.</dd>
  569. <dt><strong>set_vector4</strong> (material, name, value)</dt>
  570. <dd>Sets the <em>value</em> of the variable <em>name</em>.</dd>
  571. <dt><strong>set_matrix4x4</strong> (material, name, value)</dt>
  572. <dd>Sets the <em>value</em> of the variable <em>name</em>.</dd>
  573. <dt><strong>set_texture</strong> (material, sampler_name, texture_name)</dt>
  574. <dd>Sets the <em>texture_resource</em> of the sampler <em>sampler_name</em>.</dd>
  575. </dl>
  576. </div>
  577. <div class="section" id="math">
  578. <h2>Math<a class="headerlink" href="#math" title="Permalink to this headline">¶</a></h2>
  579. <div class="section" id="vector3">
  580. <h3>Vector3<a class="headerlink" href="#vector3" title="Permalink to this headline">¶</a></h3>
  581. <div class="section" id="constructors">
  582. <h4>Constructors<a class="headerlink" href="#constructors" title="Permalink to this headline">¶</a></h4>
  583. <dl class="docutils">
  584. <dt><strong>Vector3</strong> (x, y, z) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  585. <dd>Returns a new vector from individual elements.</dd>
  586. </dl>
  587. </div>
  588. <div class="section" id="functions">
  589. <h4>Functions<a class="headerlink" href="#functions" title="Permalink to this headline">¶</a></h4>
  590. <dl class="docutils">
  591. <dt><strong>x</strong> (v) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  592. <dd>Returns the x value of the vector.</dd>
  593. <dt><strong>y</strong> (v) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  594. <dd>Returns the y value of the vector.</dd>
  595. <dt><strong>z</strong> (v) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  596. <dd>Returns the z value of the vector.</dd>
  597. <dt><strong>.x</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  598. <dd>Returns/assigns the x value of the vector.</dd>
  599. <dt><strong>.y</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  600. <dd>Returns/assigns the y value of the vector.</dd>
  601. <dt><strong>.z</strong> <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  602. <dd>Returns/assigns the z value of the vector.</dd>
  603. <dt><strong>set_x</strong> (v, x)</dt>
  604. <dd>Sets the value of the x value of the vector.</dd>
  605. <dt><strong>set_y</strong> (v, y)</dt>
  606. <dd>Sets the value of the y value of the vector.</dd>
  607. <dt><strong>set_z</strong> (v, z)</dt>
  608. <dd>Sets the value of the z value of the vector.</dd>
  609. <dt><strong>elements</strong> (v) <span class="classifier-delimiter">:</span> <span class="classifier">float, float, float</span></dt>
  610. <dd>Returns the x, y and z elements of the vector.</dd>
  611. <dt><strong>add</strong> (a, b) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  612. <dd>Adds the vector <em>a</em> to <em>b</em> and returns the result.</dd>
  613. <dt><strong>subtract</strong> (a, b) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  614. <dd>Subtracts the vector <em>b</em> from <em>a</em> and returns the result.</dd>
  615. <dt><strong>multiply</strong> (a, k) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  616. <dd>Multiplies the vector <em>a</em> by the scalar <em>k</em> and returns the result.</dd>
  617. <dt><strong>dot</strong> (a, b) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  618. <dd>Returns the dot product between the vectors <em>a</em> and <em>b</em>.</dd>
  619. <dt><strong>cross</strong> (a, b) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  620. <dd>Returns the cross product between the vectors <em>a</em> and <em>b</em>.</dd>
  621. <dt><strong>equal</strong> (a, b) <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  622. <dd>Returns true whether the vectors <em>a</em> and <em>b</em> are equal.</dd>
  623. <dt><strong>length</strong> (a) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  624. <dd>Returns the length of <em>a</em>.</dd>
  625. <dt><strong>length_squared</strong> (a) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  626. <dd>Returns the squared length of <em>a</em>.</dd>
  627. <dt><strong>set_length</strong> (a, len)</dt>
  628. <dd>Sets the length of <em>a</em> to <em>len</em>.</dd>
  629. <dt><strong>normalize</strong> (a) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  630. <dd>Normalizes <em>a</em> and returns the result.</dd>
  631. <dt><strong>distance</strong> (a, b) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  632. <dd>Returns the distance between the points <em>a</em> and <em>b</em>.</dd>
  633. <dt><strong>distance_squared</strong> (a, b) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  634. <dd>Returns the squared distance between the points <em>a</em> and <em>b</em>.</dd>
  635. <dt><strong>angle</strong> (a, b) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  636. <dd>Returns the angle between the vectors <em>a</em> and <em>b</em>.</dd>
  637. <dt><strong>max</strong> (a, b) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  638. <dd>Returns a vector that contains the largest value for each element from <em>a</em> and <em>b</em>.</dd>
  639. <dt><strong>min</strong> (a, b) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  640. <dd>Returns a vector that contains the smallest value for each element from <em>a</em> and <em>b</em>.</dd>
  641. <dt><strong>lerp</strong> (a, b, t) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  642. <dd>Returns the linearly interpolated vector between <em>a</em> and <em>b</em> at time <em>t</em> in [0, 1].</dd>
  643. </dl>
  644. <div class="line-block">
  645. <div class="line"><strong>forward</strong> () : Vector3</div>
  646. <div class="line"><strong>backward</strong> () : Vector3</div>
  647. <div class="line"><strong>left</strong> () : Vector3</div>
  648. <div class="line"><strong>right</strong> () : Vector3</div>
  649. <div class="line"><strong>up</strong> () : Vector3</div>
  650. <div class="line"><strong>down</strong> () : Vector3</div>
  651. <div class="line-block">
  652. <div class="line">Returns the corresponding semantic axis.</div>
  653. </div>
  654. </div>
  655. <dl class="docutils">
  656. <dt><strong>zero</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  657. <dd>Returns a vector with all values set to zero.</dd>
  658. <dt><strong>to_string</strong> (v) <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
  659. <dd>Returns a string representing the vector <em>v</em>.</dd>
  660. </dl>
  661. </div>
  662. </div>
  663. <div class="section" id="vector3box">
  664. <h3>Vector3Box<a class="headerlink" href="#vector3box" title="Permalink to this headline">¶</a></h3>
  665. <div class="section" id="id1">
  666. <h4>Constructors<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h4>
  667. <dl class="docutils">
  668. <dt><strong>Vector3Box</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">Vector3Box</span></dt>
  669. <dd>Returns a new Vector3Box initialized with the zero vector.</dd>
  670. <dt><strong>Vector3Box</strong> (v) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3Box</span></dt>
  671. <dd>Returns a new Vector3Box from the Vector3 <em>v</em>.</dd>
  672. <dt><strong>Vector3Box</strong> (x, y, z) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3Box</span></dt>
  673. <dd>Returns a new Vector3Box from individual elements.</dd>
  674. </dl>
  675. </div>
  676. <div class="section" id="id2">
  677. <h4>Functions<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h4>
  678. <dl class="docutils">
  679. <dt><strong>store</strong> (v)</dt>
  680. <dd>Stores the Vector3 <em>v</em> in the box.</dd>
  681. <dt><strong>store</strong> (x, y, z)</dt>
  682. <dd>Stores Vector3(x, y, z) in the box.</dd>
  683. <dt><strong>unbox</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  684. <dd>Returns the stored vector from the box.</dd>
  685. </dl>
  686. </div>
  687. </div>
  688. <div class="section" id="quaternion">
  689. <h3>Quaternion<a class="headerlink" href="#quaternion" title="Permalink to this headline">¶</a></h3>
  690. <div class="section" id="id3">
  691. <h4>Constructors<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h4>
  692. <dl class="docutils">
  693. <dt><strong>Quaternion</strong> (axis, angle) <span class="classifier-delimiter">:</span> <span class="classifier">Quaternion</span></dt>
  694. <dd>Returns a new quaternion from <em>axis</em> and <em>angle</em>.</dd>
  695. <dt><strong>from_elements</strong> (x, y, z, w) <span class="classifier-delimiter">:</span> <span class="classifier">Quaternion</span></dt>
  696. <dd>Returns a new quaternion from individual elements.</dd>
  697. <dt><strong>from_axis_angle</strong> (axis, angle) <span class="classifier-delimiter">:</span> <span class="classifier">Quaternion</span></dt>
  698. <dd>Returns a new quaternion from <em>axis</em> and <em>angle</em>.</dd>
  699. </dl>
  700. </div>
  701. <div class="section" id="id4">
  702. <h4>Functions<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h4>
  703. <dl class="docutils">
  704. <dt><strong>negate</strong> (q) <span class="classifier-delimiter">:</span> <span class="classifier">Quaternion</span></dt>
  705. <dd>Negates the quaternion <em>q</em> and returns the result.</dd>
  706. <dt><strong>identity</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">Quaternion</span></dt>
  707. <dd>Returns the identity quaternion.</dd>
  708. <dt><strong>multiply</strong> (a, b) <span class="classifier-delimiter">:</span> <span class="classifier">Quaternion</span></dt>
  709. <dd>Multiplies the quaternions <em>a</em> and <em>b</em>. (i.e. rotates first by <em>a</em> then by <em>b</em>).</dd>
  710. <dt><strong>multiply_by_scalar</strong> (a, k) <span class="classifier-delimiter">:</span> <span class="classifier">Quaternion</span></dt>
  711. <dd>Multiplies the quaternion <em>a</em> by the scalar <em>k</em>.</dd>
  712. <dt><strong>dot</strong> (a, b) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  713. <dd>Returns the dot product between quaternions <em>a</em> and <em>b</em>.</dd>
  714. <dt><strong>length</strong> (q) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  715. <dd>Returns the length of <em>q</em>.</dd>
  716. <dt><strong>normalize</strong> (q) <span class="classifier-delimiter">:</span> <span class="classifier">Quaternion</span></dt>
  717. <dd>Normalizes the quaternion <em>q</em> and returns the result.</dd>
  718. <dt><strong>conjugate</strong> (q) <span class="classifier-delimiter">:</span> <span class="classifier">Quaternion</span></dt>
  719. <dd>Returns the conjugate of quaternion <em>q</em>.</dd>
  720. <dt><strong>inverse</strong> (q) <span class="classifier-delimiter">:</span> <span class="classifier">Quaternion</span></dt>
  721. <dd>Returns the inverse of quaternion <em>q</em>.</dd>
  722. <dt><strong>power</strong> (q, exp) <span class="classifier-delimiter">:</span> <span class="classifier">Quaternion</span></dt>
  723. <dd>Returns the quaternion <em>q</em> raised to the power of <em>exp</em>.</dd>
  724. <dt><strong>elements</strong> (q) <span class="classifier-delimiter">:</span> <span class="classifier">float, float, float, float</span></dt>
  725. <dd>Returns the x, y, z and w elements of the quaternion.</dd>
  726. <dt><strong>look</strong> (dir, [up]) <span class="classifier-delimiter">:</span> <span class="classifier">Quaternion</span></dt>
  727. <dd>Returns the quaternion describing the rotation needed to face towards <em>dir</em>.
  728. If <em>up</em> is not specified, Vector3.up() is used.</dd>
  729. <dt><strong>right</strong> (q) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  730. <dd>Returns the right axis of the rotation described by <em>q</em>.</dd>
  731. <dt><strong>up</strong> (q) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  732. <dd>Returns the up axis of the rotation described by <em>q</em>.</dd>
  733. <dt><strong>forward</strong> (q) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  734. <dd>Returns the forward axis of the rotation described by <em>q</em>.</dd>
  735. <dt><strong>lerp</strong> (a, b, t) <span class="classifier-delimiter">:</span> <span class="classifier">Quaternion</span></dt>
  736. <dd>Returns the linearly interpolated quaternion between <em>a</em> and <em>b</em> at time <em>t</em> in [0, 1].
  737. It uses NLerp.</dd>
  738. <dt><strong>to_string</strong> (q) <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
  739. <dd>Returns a string representing the quaternion <em>q</em>.</dd>
  740. </dl>
  741. </div>
  742. </div>
  743. <div class="section" id="quaternionbox">
  744. <h3>QuaternionBox<a class="headerlink" href="#quaternionbox" title="Permalink to this headline">¶</a></h3>
  745. <div class="section" id="id5">
  746. <h4>Constructors<a class="headerlink" href="#id5" title="Permalink to this headline">¶</a></h4>
  747. <dl class="docutils">
  748. <dt><strong>QuaternionBox</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">QuaternionBox</span></dt>
  749. <dd>Returns a new QuaternionBox initialized with the identity quaternion.</dd>
  750. <dt><strong>QuaternionBox</strong> (q) <span class="classifier-delimiter">:</span> <span class="classifier">QuaternionBox</span></dt>
  751. <dd>Returns a new QuaternionBox from the Quaternion <em>q</em>.</dd>
  752. <dt><strong>QuaternionBox</strong> (x, y, z, w) <span class="classifier-delimiter">:</span> <span class="classifier">QuaternionBox</span></dt>
  753. <dd>Returns a new QuaternionBox from individual elements.</dd>
  754. </dl>
  755. </div>
  756. <div class="section" id="id6">
  757. <h4>Functions<a class="headerlink" href="#id6" title="Permalink to this headline">¶</a></h4>
  758. <dl class="docutils">
  759. <dt><strong>store</strong> (q)</dt>
  760. <dd>Stores the Quaternion <em>q</em> in the box.</dd>
  761. <dt><strong>store</strong> (x, y, z, w)</dt>
  762. <dd>Stores Quaternion(x, y, z, w) in the box.</dd>
  763. <dt><strong>unbox</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">Quaternion</span></dt>
  764. <dd>Returns the stored quaternion from the box.</dd>
  765. </dl>
  766. </div>
  767. </div>
  768. <div class="section" id="matrix4x4">
  769. <h3>Matrix4x4<a class="headerlink" href="#matrix4x4" title="Permalink to this headline">¶</a></h3>
  770. <div class="section" id="id7">
  771. <h4>Constructors<a class="headerlink" href="#id7" title="Permalink to this headline">¶</a></h4>
  772. <dl class="docutils">
  773. <dt><strong>Matrix4x4</strong> (xx, xy, xz, xw, yx, yy, yz, yw, zx, zy, zz, zw, tx, ty, tz, tw) <span class="classifier-delimiter">:</span> <span class="classifier">Matrix4x4</span></dt>
  774. <dd>Returns a new matrix from individual elements.</dd>
  775. <dt><strong>from_quaternion</strong> (q) <span class="classifier-delimiter">:</span> <span class="classifier">Matrix4x4</span></dt>
  776. <dd>Returns a new matrix from <em>q</em>.</dd>
  777. <dt><strong>from_translation</strong> (t) <span class="classifier-delimiter">:</span> <span class="classifier">Matrix4x4</span></dt>
  778. <dd>Returns a new matrix from <em>t</em>.</dd>
  779. <dt><strong>from_quaternion_translation</strong> (q, t) <span class="classifier-delimiter">:</span> <span class="classifier">Matrix4x4</span></dt>
  780. <dd>Returns a new matrix from <em>q</em> and <em>t</em>.</dd>
  781. <dt><strong>from_axes</strong> (x, y, z, t) <span class="classifier-delimiter">:</span> <span class="classifier">Matrix4x4</span></dt>
  782. <dd>Returns a new matrix from <em>x</em>, <em>y</em>, <em>z</em> and <em>t</em>.</dd>
  783. </dl>
  784. </div>
  785. <div class="section" id="id8">
  786. <h4>Functions<a class="headerlink" href="#id8" title="Permalink to this headline">¶</a></h4>
  787. <dl class="docutils">
  788. <dt><strong>copy</strong> (m) <span class="classifier-delimiter">:</span> <span class="classifier">Matrix4x4</span></dt>
  789. <dd>Returns a copy of the matrix <em>m</em>.</dd>
  790. <dt><strong>add</strong> (a, b) <span class="classifier-delimiter">:</span> <span class="classifier">Matrix4x4</span></dt>
  791. <dd>Adds the matrix <em>a</em> to <em>b</em> and returns the result.</dd>
  792. <dt><strong>subtract</strong> (a, b) <span class="classifier-delimiter">:</span> <span class="classifier">Matrix4x4</span></dt>
  793. <dd>Subtracts the matrix <em>b</em> from <em>a</em> and returns the result.</dd>
  794. <dt><strong>multiply</strong> (a, b) <span class="classifier-delimiter">:</span> <span class="classifier">Matrix4x4</span></dt>
  795. <dd>Multiplies the matrix <em>a</em> by <em>b</em> and returns the result. (i.e. transforms first by <em>a</em> then by <em>b</em>)</dd>
  796. <dt><strong>equal</strong> (a, b) <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  797. <dd>Returns true whether the matrices <em>a</em> and <em>b</em> are equal.</dd>
  798. <dt><strong>transpose</strong> (m) <span class="classifier-delimiter">:</span> <span class="classifier">Matrix4x4</span></dt>
  799. <dd>Transposes the matrix <em>m</em> and returns the result.</dd>
  800. <dt><strong>invert</strong> (m) <span class="classifier-delimiter">:</span> <span class="classifier">Matrix4x4</span></dt>
  801. <dd>Inverts the matrix <em>m</em> and returns the result.</dd>
  802. <dt><strong>x</strong> (m) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  803. <dd>Returns the x axis of the matrix <em>m</em>.</dd>
  804. <dt><strong>y</strong> (m) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  805. <dd>Returns the y axis of the matrix <em>m</em>.</dd>
  806. <dt><strong>z</strong> (m) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  807. <dd>Returns the z axis of the matrix <em>m</em>.</dd>
  808. <dt><strong>set_x</strong> (m, x)</dt>
  809. <dd>Sets the x axis of the matrix <em>m</em>.</dd>
  810. <dt><strong>set_y</strong> (m, y)</dt>
  811. <dd>Sets the y axis of the matrix <em>m</em>.</dd>
  812. <dt><strong>set_z</strong> (m, z)</dt>
  813. <dd>Sets the z axis of the matrix <em>m</em>.</dd>
  814. <dt><strong>translation</strong> (m) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  815. <dd>Returns the translation portion of the matrix <em>m</em>.</dd>
  816. <dt><strong>set_translation</strong> (m, t)</dt>
  817. <dd>Sets the translation portion of the matrix <em>m</em>.</dd>
  818. <dt><strong>rotation</strong> (m) <span class="classifier-delimiter">:</span> <span class="classifier">Quaternion</span></dt>
  819. <dd>Returns the rotation portion of the matrix <em>m</em>.</dd>
  820. <dt><strong>set_rotation</strong> (m, r)</dt>
  821. <dd>Sets the rotation portion of the matrix <em>m</em>.</dd>
  822. <dt><strong>scale</strong> (m) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  823. <dd>Returns the scale of the matrix <em>m</em>.</dd>
  824. <dt><strong>set_scale</strong> (m, r)</dt>
  825. <dd>Sets the scale of the matrix <em>m</em>.</dd>
  826. <dt><strong>identity</strong> ()</dt>
  827. <dd>Returns the identity matrix.</dd>
  828. <dt><strong>transform</strong> (m, v) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  829. <dd>Transforms the vector <em>v</em> by the matrix <em>m</em> and returns the result.</dd>
  830. <dt><strong>to_string</strong> (m) <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
  831. <dd>Returns a string representing the matrix <em>m</em>.</dd>
  832. </dl>
  833. </div>
  834. </div>
  835. <div class="section" id="matrix4x4box">
  836. <h3>Matrix4x4Box<a class="headerlink" href="#matrix4x4box" title="Permalink to this headline">¶</a></h3>
  837. <div class="section" id="id9">
  838. <h4>Constructors<a class="headerlink" href="#id9" title="Permalink to this headline">¶</a></h4>
  839. <dl class="docutils">
  840. <dt><strong>Matrix4x4Box</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">Matrix4x4Box</span></dt>
  841. <dd>Returns a new Matrix4x4Box initialized with the identity matrix.</dd>
  842. <dt><strong>Matrix4x4Box</strong> (m) <span class="classifier-delimiter">:</span> <span class="classifier">Matrix4x4Box</span></dt>
  843. <dd>Returns a new Matrix4x4Box from the Matrix4x4 <em>m</em>.</dd>
  844. </dl>
  845. </div>
  846. <div class="section" id="id10">
  847. <h4>Functions<a class="headerlink" href="#id10" title="Permalink to this headline">¶</a></h4>
  848. <dl class="docutils">
  849. <dt><strong>store</strong> (m)</dt>
  850. <dd>Stores the Matrix4x4 <em>m</em> in the box.</dd>
  851. <dt><strong>unbox</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">Matrix4x4</span></dt>
  852. <dd>Returns the stored matrix from the box.</dd>
  853. </dl>
  854. </div>
  855. </div>
  856. <div class="section" id="color4">
  857. <h3>Color4<a class="headerlink" href="#color4" title="Permalink to this headline">¶</a></h3>
  858. <div class="section" id="id11">
  859. <h4>Constructors<a class="headerlink" href="#id11" title="Permalink to this headline">¶</a></h4>
  860. <dl class="docutils">
  861. <dt><strong>Color4</strong> (r, g, b, a) <span class="classifier-delimiter">:</span> <span class="classifier">Color4</span></dt>
  862. <dd>Returns a new Color4 from individual elements.</dd>
  863. </dl>
  864. </div>
  865. <div class="section" id="id12">
  866. <h4>Functions<a class="headerlink" href="#id12" title="Permalink to this headline">¶</a></h4>
  867. <dl class="docutils">
  868. <dt><strong>lerp</strong> (a, b, t) <span class="classifier-delimiter">:</span> <span class="classifier">Color4</span></dt>
  869. <dd>Returns the linearly interpolated color between <em>a</em> and <em>b</em> at time <em>t</em> in [0, 1].</dd>
  870. </dl>
  871. <div class="line-block">
  872. <div class="line"><strong>black</strong> () : Color4</div>
  873. <div class="line"><strong>white</strong> () : Color4</div>
  874. <div class="line"><strong>red</strong> () : Color4</div>
  875. <div class="line"><strong>green</strong> () : Color4</div>
  876. <div class="line"><strong>blue</strong> () : Color4</div>
  877. <div class="line"><strong>yellow</strong> () : Color4</div>
  878. <div class="line"><strong>orange</strong> () : Color4</div>
  879. <div class="line-block">
  880. <div class="line">Returns the corresponding mnemonic color.</div>
  881. </div>
  882. </div>
  883. <dl class="docutils">
  884. <dt><strong>to_string</strong> (c) <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
  885. <dd>Returns a string representing the color <em>c</em>.</dd>
  886. </dl>
  887. </div>
  888. </div>
  889. <div class="section" id="id13">
  890. <h3>Math<a class="headerlink" href="#id13" title="Permalink to this headline">¶</a></h3>
  891. <dl class="docutils">
  892. <dt><strong>ray_plane_intersection</strong> (from, dir, point, normal) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  893. <dd>Returns the distance along ray (from, dir) to intersection point with plane defined by
  894. <em>point</em> and <em>normal</em> or -1.0 if no intersection.</dd>
  895. <dt><strong>ray_disc_intersection</strong> (from, dir, center, radius, normal) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  896. <dd>Returns the distance along ray (from, dir) to intersection point with disc defined by
  897. <em>center</em>, <em>radius</em> and <em>normal</em> or -1.0 if no intersection.</dd>
  898. <dt><strong>ray_sphere_intersection</strong> (from, dir, center, radius) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  899. <dd>Returns the distance along ray (from, dir) to intersection point with sphere defined by
  900. <em>center</em> and <em>radius</em> or -1.0 if no intersection.</dd>
  901. <dt><strong>ray_obb_intersection</strong> (from, dir, tm, half_extents) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  902. <dd>Returns the distance along ray (from, dir) to intersection point with the oriented
  903. bounding box (tm, half_extents) or -1.0 if no intersection.</dd>
  904. <dt><strong>ray_triangle_intersection</strong> (from, dir, v0, v1, v2) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  905. <dd>Returns the distance along ray (from, dir) to intersection point with the triangle
  906. (v0, v1, v2) or -1.0 if no intersection.</dd>
  907. <dt><strong>obb_intersects_frustum</strong> (obb_tm, obb_half_extents, n0, d0, n1, d1, n2, d2, n3, d3, n4, d4, n4, d5) <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  908. <dd>Returns whether the oriented bounding box (obb_tm, obb_half_extents) intersects
  909. the frustum defined by the planes ((n0, d0), (n1, d1), …, (n5, d5)). The
  910. planes be given in BRTLNF order, where B = bottom plane, R = right plane etc.</dd>
  911. <dt><strong>obb_vertices</strong> (obb_tm, obb_half_extents) <span class="classifier-delimiter">:</span> <span class="classifier">v0, v1, v2, v3, v4, v5, v6, v7</span></dt>
  912. <dd>Returns the vertices of the oriented bounding box (obb_tm, obb_half_extents).</dd>
  913. </dl>
  914. </div>
  915. </div>
  916. <div class="section" id="physicsworld">
  917. <h2>PhysicsWorld<a class="headerlink" href="#physicsworld" title="Permalink to this headline">¶</a></h2>
  918. <dl class="docutils">
  919. <dt><strong>gravity</strong> (pw) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  920. <dd>Returns the gravity.</dd>
  921. <dt><strong>set_gravity</strong> (pw, gravity)</dt>
  922. <dd>Sets the gravity.</dd>
  923. <dt><strong>cast_ray</strong> (pw, from, dir, length) <span class="classifier-delimiter">:</span> <span class="classifier">hit, collision_pos, normal, time, UnitId, Actor</span></dt>
  924. <dd>Casts a ray into the physics world and returns the closest actor it intersects with.
  925. If <em>hit</em> is true the following return values contain the <em>collision_pos</em> in
  926. world space, the <em>normal</em> of the surface that was hit, the time of impact
  927. in [0..1] and the <em>unit</em> and the <em>actor</em> that was hit.</dd>
  928. <dt><strong>cast_ray_all</strong> (pw, from, dir, length) <span class="classifier-delimiter">:</span> <span class="classifier">table</span></dt>
  929. <dd>Casts a ray into the physics world and returns all the
  930. actors it intersects with as an array of <a class="reference internal" href="#raycasthit">RaycastHit</a> tables.</dd>
  931. <dt><strong>cast_sphere</strong> (pw, from, radius, dir, length) <span class="classifier-delimiter">:</span> <span class="classifier">hit, collision_pos, normal, time, UnitId, Actor</span></dt>
  932. <dd>Casts a sphere into the physics world and returns the closest actor it intersects with.
  933. If <em>hit</em> is true the following return values contain the <em>collision_pos</em> in
  934. world space, the <em>normal</em> of the surface that was hit, the time of impact
  935. in [0..1] and the <em>unit</em> and the <em>actor</em> that was hit.</dd>
  936. <dt><strong>cast_box</strong> (pw, from, half_extents, dir, length) <span class="classifier-delimiter">:</span> <span class="classifier">hit, collision_pos, normal, time, UnitId, Actor</span></dt>
  937. <dd>Casts a box into the physics world and returns the closest actor it intersects with.
  938. If <em>hit</em> is true the following return values contain the <em>collision_pos</em> in
  939. world space, the <em>normal</em> of the surface that was hit, the time of impact
  940. in [0..1] and the <em>unit</em> and the <em>actor</em> that was hit.</dd>
  941. <dt><strong>enable_debug_drawing</strong> (pw, enable)</dt>
  942. <dd>Sets whether to <em>enable</em> debug drawing.</dd>
  943. </dl>
  944. <div class="section" id="raycasthit">
  945. <h3>RaycastHit<a class="headerlink" href="#raycasthit" title="Permalink to this headline">¶</a></h3>
  946. <p>RaycastHit is a lua table with 5 fields:</p>
  947. <ul class="simple">
  948. <li><code class="docutils literal notranslate"><span class="pre">[1]</span></code>: The collision position in world space.</li>
  949. <li><code class="docutils literal notranslate"><span class="pre">[2]</span></code>: The normal of the surface that was hit.</li>
  950. <li><code class="docutils literal notranslate"><span class="pre">[3]</span></code>: The time of impact in [0..1].</li>
  951. <li><code class="docutils literal notranslate"><span class="pre">[4]</span></code>: The unit that was hit.</li>
  952. <li><code class="docutils literal notranslate"><span class="pre">[5]</span></code>: The actor that was hit.</li>
  953. </ul>
  954. </div>
  955. <div class="section" id="actor">
  956. <h3>Actor<a class="headerlink" href="#actor" title="Permalink to this headline">¶</a></h3>
  957. <dl class="docutils">
  958. <dt><strong>actor_destroy</strong> (pw, actor)</dt>
  959. <dd>Destroys the <em>actor</em> instance.</dd>
  960. <dt><strong>actor_instance</strong> (pw, unit) <span class="classifier-delimiter">:</span> <span class="classifier">Id</span></dt>
  961. <dd>Returns the ID of the actor owned by the <em>unit</em>, or <code class="docutils literal notranslate"><span class="pre">nil</span></code>.</dd>
  962. <dt><strong>actor_world_position</strong> (pw, actor) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  963. <dd>Returns the world position of the <em>actor</em>.</dd>
  964. <dt><strong>actor_world_rotation</strong> (pw, actor) <span class="classifier-delimiter">:</span> <span class="classifier">Quaternion</span></dt>
  965. <dd>Returns the world rotation of the <em>actor</em>.</dd>
  966. <dt><strong>actor_world_pose</strong> (pw, actor) <span class="classifier-delimiter">:</span> <span class="classifier">Matrix4x4</span></dt>
  967. <dd>Returns the world pose of the <em>actor</em>.</dd>
  968. <dt><strong>actor_teleport_world_position</strong> (pw, actor, position)</dt>
  969. <dd>Teleports the <em>actor</em> to the given world <em>position</em>.</dd>
  970. <dt><strong>actor_teleport_world_rotation</strong> (pw, actor, rotation)</dt>
  971. <dd>Teleports the <em>actor</em> to the given world <em>rotation</em>.</dd>
  972. <dt><strong>actor_teleport_world_pose</strong> (pw, actor, pose)</dt>
  973. <dd>Teleports the <em>actor</em> to the given world <em>pose</em>.</dd>
  974. <dt><strong>actor_center_of_mass</strong> (pw, actor) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  975. <dd>Returns the center of mass of the <em>actor</em>.</dd>
  976. <dt><strong>actor_enable_gravity</strong> (pw, actor)</dt>
  977. <dd>Enables gravity for the <em>actor</em>.</dd>
  978. <dt><strong>actor_disable_gravity</strong> (pw, actor)</dt>
  979. <dd>Disables gravity for the <em>actor</em>.</dd>
  980. <dt><strong>actor_enable_collision</strong> (pw, actor)</dt>
  981. <dd>Enables collision detection for the <em>actor</em>.</dd>
  982. <dt><strong>actor_disable_collision</strong> (pw, actor)</dt>
  983. <dd>Disables collision detection for the <em>actor</em>.</dd>
  984. <dt><strong>actor_set_collision_filter</strong> (pw, actor, name)</dt>
  985. <dd>Sets the collision filter of the <em>actor</em>.</dd>
  986. <dt><strong>actor_set_kinematic</strong> (pw, actor, kinematic)</dt>
  987. <dd><p class="first">Sets whether the <em>actor</em> is <em>kinematic</em> or not.</p>
  988. <div class="last admonition note">
  989. <p class="first admonition-title">Note</p>
  990. <p class="last">This call has no effect on static actors.</p>
  991. </div>
  992. </dd>
  993. <dt><strong>actor_is_static</strong> (pw, actor) <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  994. <dd>Returns whether the <em>actor</em> is static.</dd>
  995. <dt><strong>actor_is_dynamic</strong> (pw, actor) bool</dt>
  996. <dd>Returns whether the <em>actor</em> is dynamic.</dd>
  997. <dt><strong>actor_is_kinematic</strong> (pw, actor) <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  998. <dd>Returns whether the <em>actor</em> is kinematic (keyframed).</dd>
  999. <dt><strong>actor_is_nonkinematic</strong> (pw, actor) <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  1000. <dd>Returns whether the <em>actor</em> is nonkinematic (i.e. dynamic and not kinematic).</dd>
  1001. <dt><strong>actor_linear_damping</strong> (pw, actor) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  1002. <dd>Returns the linear damping of the <em>actor</em>.</dd>
  1003. <dt><strong>actor_set_linear_damping</strong> (pw, actor, damping)</dt>
  1004. <dd>Sets the linear <em>damping</em> of the <em>actor</em>.</dd>
  1005. <dt><strong>actor_angular_damping</strong> (pw, actor) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  1006. <dd>Returns the angular damping rate of the <em>actor</em>.</dd>
  1007. <dt><strong>actor_set_angular_damping</strong> (pw, actor, rate)</dt>
  1008. <dd>Sets the angular damping <em>rate</em> of the <em>actor</em>.</dd>
  1009. <dt><strong>actor_linear_velocity</strong> (pw, actor) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  1010. <dd>Returns the linear velocity of the <em>actor</em>.</dd>
  1011. <dt><strong>actor_set_linear_velocity</strong> (pw, actor, velocity)</dt>
  1012. <dd><p class="first">Sets the linear <em>velocity</em> of the <em>actor</em>.</p>
  1013. <div class="last admonition note">
  1014. <p class="first admonition-title">Note</p>
  1015. <p class="last">This call only affects nonkinematic actors.</p>
  1016. </div>
  1017. </dd>
  1018. <dt><strong>actor_angular_velocity</strong> (pw, actor) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  1019. <dd>Returns the angular velocity of the <em>actor</em>.</dd>
  1020. <dt><strong>actor_set_angular_velocity</strong> (pw, actor, velocity)</dt>
  1021. <dd><p class="first">Sets the angular <em>velocity</em> of the <em>actor</em>.</p>
  1022. <div class="last admonition note">
  1023. <p class="first admonition-title">Note</p>
  1024. <p class="last">This call only affects nonkinematic actors.</p>
  1025. </div>
  1026. </dd>
  1027. <dt><strong>actor_add_impulse</strong> (pw, actor, impulse)</dt>
  1028. <dd><p class="first">Adds a linear <em>impulse</em> (acting along the center of mass) to the <em>actor</em>.</p>
  1029. <div class="last admonition note">
  1030. <p class="first admonition-title">Note</p>
  1031. <p class="last">This call only affects nonkinematic actors.</p>
  1032. </div>
  1033. </dd>
  1034. <dt><strong>actor_add_impulse_at</strong> (pw, actor, impulse, position)</dt>
  1035. <dd><p class="first">Adds a linear <em>impulse</em> (acting along the world position <em>pos</em>) to the <em>actor</em>.</p>
  1036. <div class="last admonition note">
  1037. <p class="first admonition-title">Note</p>
  1038. <p class="last">This call only affects nonkinematic actors.</p>
  1039. </div>
  1040. </dd>
  1041. <dt><strong>actor_add_torque_impulse</strong> (pw, actor, impulse)</dt>
  1042. <dd>Adds a torque <em>impulse</em> to the <em>actor</em>.</dd>
  1043. <dt><strong>actor_push</strong> (pw, actor, velocity, mass)</dt>
  1044. <dd><p class="first">Pushes the <em>actor</em> as if it was hit by a point object with the given <em>mass</em>
  1045. travelling at the given <em>velocity</em>.</p>
  1046. <div class="last admonition note">
  1047. <p class="first admonition-title">Note</p>
  1048. <p class="last">This call only affects nonkinematic actors.</p>
  1049. </div>
  1050. </dd>
  1051. <dt><strong>actor_push_at</strong> (pw, actor, velocity, mass, position)</dt>
  1052. <dd><p class="first">Like push() but applies the force at the world <em>position</em>.</p>
  1053. <div class="last admonition note">
  1054. <p class="first admonition-title">Note</p>
  1055. <p class="last">This call only affects nonkinematic actors.</p>
  1056. </div>
  1057. </dd>
  1058. <dt><strong>actor_is_sleeping</strong> (pw, actor) <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  1059. <dd>Returns whether the <em>actor</em> is sleeping.</dd>
  1060. <dt><strong>actor_wake_up</strong> (pw, actor)</dt>
  1061. <dd>Wakes the <em>actor</em> up.</dd>
  1062. </dl>
  1063. </div>
  1064. </div>
  1065. <div class="section" id="profiler">
  1066. <h2>Profiler<a class="headerlink" href="#profiler" title="Permalink to this headline">¶</a></h2>
  1067. <dl class="docutils">
  1068. <dt><strong>enter_scope</strong> (name)</dt>
  1069. <dd>Starts a new profile scope with the given <em>name</em>.</dd>
  1070. <dt><strong>leave_scope</strong> ()</dt>
  1071. <dd>Ends the last profile scope.</dd>
  1072. <dt><strong>record</strong> (name, value)</dt>
  1073. <dd>Records <em>value</em> with the given <em>name</em>. Value can be either number or Vector3.</dd>
  1074. </dl>
  1075. </div>
  1076. <div class="section" id="renderworld">
  1077. <h2>RenderWorld<a class="headerlink" href="#renderworld" title="Permalink to this headline">¶</a></h2>
  1078. <dl class="docutils">
  1079. <dt><strong>enable_debug_drawing</strong> (rw, enable)</dt>
  1080. <dd>Sets whether to <em>enable</em> debug drawing.</dd>
  1081. </dl>
  1082. <div class="section" id="mesh">
  1083. <h3>Mesh<a class="headerlink" href="#mesh" title="Permalink to this headline">¶</a></h3>
  1084. <dl class="docutils">
  1085. <dt><strong>mesh_create</strong> (rw, unit, mesh_resource, geometry_name, material_resource, visible, pose) <span class="classifier-delimiter">:</span> <span class="classifier">Id</span></dt>
  1086. <dd>Creates a new mesh instance for <em>unit</em> and returns its id.</dd>
  1087. <dt><strong>mesh_destroy</strong> (rw, mesh)</dt>
  1088. <dd>Destroys the <em>mesh</em> instance.</dd>
  1089. <dt><strong>mesh_instance</strong> (rw, unit) <span class="classifier-delimiter">:</span> <span class="classifier">Id</span></dt>
  1090. <dd>Returns the ID of the mesh owned by the <em>unit</em>, or <code class="docutils literal notranslate"><span class="pre">nil</span></code>.</dd>
  1091. <dt><strong>mesh_material</strong> (rw, mesh) <span class="classifier-delimiter">:</span> <span class="classifier">Material</span></dt>
  1092. <dd>Returns the material of the <em>mesh</em>.</dd>
  1093. <dt><strong>mesh_set_material</strong> (rw, mesh, material)</dt>
  1094. <dd>Sets the <em>material</em> of the <em>mesh</em>.</dd>
  1095. <dt><strong>mesh_set_visible</strong> (rw, mesh, visible)</dt>
  1096. <dd>Sets whether the <em>mesh</em> is <em>visible</em>.</dd>
  1097. <dt><strong>mesh_obb</strong> (rw, mesh) <span class="classifier-delimiter">:</span> <span class="classifier">Matrix4x4, Vector3</span></dt>
  1098. <dd>Returns the Oriented-Bounding-Box of the <em>mesh</em> as (pose, half_extents).</dd>
  1099. <dt><strong>mesh_cast_ray</strong> (rw, mesh, from, dir) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  1100. <dd>Returns the distance along ray (from, dir) to intersection point with the <em>mesh</em> or -1.0 if no intersection.</dd>
  1101. </dl>
  1102. </div>
  1103. <div class="section" id="sprite">
  1104. <h3>Sprite<a class="headerlink" href="#sprite" title="Permalink to this headline">¶</a></h3>
  1105. <dl class="docutils">
  1106. <dt><strong>sprite_create</strong> (rw, unit, sprite_resource, material_resource, visible, pose) <span class="classifier-delimiter">:</span> <span class="classifier">Id</span></dt>
  1107. <dd>Creates a new sprite instance for the <em>unit</em> and returns its id.</dd>
  1108. <dt><strong>sprite_destroy</strong> (rw, sprite)</dt>
  1109. <dd>Destroys the <em>sprite</em> instance.</dd>
  1110. <dt><strong>sprite_instance</strong> (rw, unit) <span class="classifier-delimiter">:</span> <span class="classifier">Id</span></dt>
  1111. <dd>Returns the ID of the sprite owned by the <em>unit</em>, or <code class="docutils literal notranslate"><span class="pre">nil</span></code>.</dd>
  1112. <dt><strong>sprite_material</strong> (rw, sprite) <span class="classifier-delimiter">:</span> <span class="classifier">Material</span></dt>
  1113. <dd>Returns the material of the <em>sprite</em>.</dd>
  1114. <dt><strong>sprite_set_material</strong> (rw, sprite, material)</dt>
  1115. <dd>Sets the <em>material</em> of the <em>sprite</em>.</dd>
  1116. <dt><strong>sprite_set_frame</strong> (rw, sprite, index)</dt>
  1117. <dd>Sets the frame <em>index</em> of the <em>sprite</em>.
  1118. The <em>index</em> automatically wraps if it greater than the total number of
  1119. frames in the sprite.</dd>
  1120. <dt><strong>sprite_set_visible</strong> (rw, sprite, visible)</dt>
  1121. <dd>Sets whether the <em>sprite</em> is <em>visible</em>.</dd>
  1122. <dt><strong>sprite_flip_x</strong> (rw, sprite, flip)</dt>
  1123. <dd>Sets whether to flip the <em>sprite</em> on the x-axis.</dd>
  1124. <dt><strong>sprite_flip_y</strong> (rw, sprite, flip)</dt>
  1125. <dd>Sets whether to flip the <em>sprite</em> on the y-axis.</dd>
  1126. <dt><strong>sprite_set_layer</strong> (rw, sprite, layer)</dt>
  1127. <dd>Sets the rendering <em>layer</em> of the <em>sprite</em>.</dd>
  1128. <dt><strong>sprite_set_depth</strong> (rw, sprite, depth)</dt>
  1129. <dd>Sets the rendering <em>depth</em> of the <em>sprite</em>.</dd>
  1130. <dt><strong>sprite_obb</strong> (rw, sprite) <span class="classifier-delimiter">:</span> <span class="classifier">Matrix4x4, Vector3</span></dt>
  1131. <dd>Returns the Oriented-Bounding-Box of the <em>sprite</em> as (pose, half_extents).</dd>
  1132. <dt><strong>sprite_cast_ray</strong> (rw, sprite, from, dir) <span class="classifier-delimiter">:</span> <span class="classifier">float, int, int</span></dt>
  1133. <dd>Returns (t, layer, depth), where <em>t</em> is the distance along ray (from, dir) to
  1134. intersection point with the <em>sprite</em> or -1.0 if no intersection.</dd>
  1135. </dl>
  1136. </div>
  1137. <div class="section" id="light">
  1138. <h3>Light<a class="headerlink" href="#light" title="Permalink to this headline">¶</a></h3>
  1139. <dl class="docutils">
  1140. <dt><strong>light_create</strong> (rw, unit, type, range, intensity, spot_angle, color, pose) <span class="classifier-delimiter">:</span> <span class="classifier">Id</span></dt>
  1141. <dd>Creates a new light for the <em>unit</em> and returns its id.
  1142. Type can be either <code class="docutils literal notranslate"><span class="pre">directional</span></code>, <code class="docutils literal notranslate"><span class="pre">omni</span></code> or <code class="docutils literal notranslate"><span class="pre">spot</span></code>.</dd>
  1143. <dt><strong>light_destroy</strong> (rw, light)</dt>
  1144. <dd>Destroys the <em>light</em> instance.</dd>
  1145. <dt><strong>light_instance</strong> (rw, unit) <span class="classifier-delimiter">:</span> <span class="classifier">Id</span></dt>
  1146. <dd>Returns the ID of the light owned by the <em>unit</em>, or <code class="docutils literal notranslate"><span class="pre">nil</span></code>.</dd>
  1147. <dt><strong>light_type</strong> (rw, light) <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
  1148. <dd>Returns the type of the <em>light</em>.
  1149. It can be either <code class="docutils literal notranslate"><span class="pre">directional</span></code>, <code class="docutils literal notranslate"><span class="pre">omni</span></code> or <code class="docutils literal notranslate"><span class="pre">spot</span></code>.</dd>
  1150. <dt><strong>light_color</strong> (rw, light) <span class="classifier-delimiter">:</span> <span class="classifier">Color4</span></dt>
  1151. <dd>Returns the color of the <em>light</em>.</dd>
  1152. <dt><strong>light_range</strong> (rw, light) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  1153. <dd>Returns the range of the <em>light</em>.</dd>
  1154. <dt><strong>light_intensity</strong> (rw, light) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  1155. <dd>Returns the intensity of the <em>light</em>.</dd>
  1156. <dt><strong>light_spot_angle</strong> (rw, light) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  1157. <dd>Returns the spot angle of the <em>light</em>.</dd>
  1158. <dt><strong>light_set_type</strong> (rw, light, type)</dt>
  1159. <dd>Sets the <em>type</em> of the <em>light</em>.</dd>
  1160. <dt><strong>light_set_color</strong> (rw, light, color)</dt>
  1161. <dd>Sets the <em>color</em> of the <em>light</em>.</dd>
  1162. <dt><strong>light_set_range</strong> (rw, light, range)</dt>
  1163. <dd>Sets the <em>range</em> of the <em>light</em>.</dd>
  1164. <dt><strong>light_set_intensity</strong> (rw, light, intensity)</dt>
  1165. <dd>Sets the <em>intensity</em> of the <em>light</em>.</dd>
  1166. <dt><strong>light_set_spot_angle</strong> (rw, light, angle)</dt>
  1167. <dd>Sets the spot <em>angle</em> of the <em>light</em>.</dd>
  1168. <dt><strong>light_debug_draw</strong> (rw, light, debug_line)</dt>
  1169. <dd>Fills <em>debug_line</em> with debug lines from the <em>light</em>.</dd>
  1170. </dl>
  1171. </div>
  1172. </div>
  1173. <div class="section" id="resourcepackage">
  1174. <h2>ResourcePackage<a class="headerlink" href="#resourcepackage" title="Permalink to this headline">¶</a></h2>
  1175. <dl class="docutils">
  1176. <dt><strong>load</strong> (package)</dt>
  1177. <dd><p class="first">Loads all the resources in the <em>package</em>.</p>
  1178. <div class="last admonition note">
  1179. <p class="first admonition-title">Note</p>
  1180. <p class="last">The resources are not immediately available after the call is made,
  1181. instead, you have to poll for completion with has_loaded().</p>
  1182. </div>
  1183. </dd>
  1184. <dt><strong>unload</strong> (package)</dt>
  1185. <dd>Unloads all the resources in the <em>package</em>.</dd>
  1186. <dt><strong>flush</strong> (package)</dt>
  1187. <dd>Waits until the <em>package</em> has been loaded.</dd>
  1188. <dt><strong>has_loaded</strong> (package) <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  1189. <dd>Returns whether the <em>package</em> has been loaded.</dd>
  1190. </dl>
  1191. </div>
  1192. <div class="section" id="scenegraph">
  1193. <h2>SceneGraph<a class="headerlink" href="#scenegraph" title="Permalink to this headline">¶</a></h2>
  1194. <dl class="docutils">
  1195. <dt><strong>create</strong> (sg, unit, position, rotation, scale) <span class="classifier-delimiter">:</span> <span class="classifier">Id</span></dt>
  1196. <dd>Creates the transform for the <em>unit</em> and returns its ID.</dd>
  1197. <dt><strong>destroy</strong> (sg, transform)</dt>
  1198. <dd>Destroys the <em>transform</em> instance.</dd>
  1199. <dt><strong>instance</strong> (sg, unit) <span class="classifier-delimiter">:</span> <span class="classifier">Id</span></dt>
  1200. <dd>Returns the ID of the transform owned by the <em>unit</em>, or <code class="docutils literal notranslate"><span class="pre">nil</span></code>.</dd>
  1201. <dt><strong>local_position</strong> (sg, transform) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  1202. <dd>Returns the local position of the <em>transform</em>.</dd>
  1203. <dt><strong>local_rotation</strong> (sg, transform) <span class="classifier-delimiter">:</span> <span class="classifier">Quaternion</span></dt>
  1204. <dd>Returns the local rotation of the <em>transform</em>.</dd>
  1205. <dt><strong>local_scale</strong> (sg, transform) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  1206. <dd>Returns the local scale of the <em>transform</em>.</dd>
  1207. <dt><strong>local_pose</strong> (sg, transform) <span class="classifier-delimiter">:</span> <span class="classifier">Matrix4x4</span></dt>
  1208. <dd>Returns the local pose of the <em>transform</em>.</dd>
  1209. <dt><strong>world_position</strong> (sg, transform) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  1210. <dd>Returns the world position of the <em>transform</em>.</dd>
  1211. <dt><strong>world_rotation</strong> (sg, transform) <span class="classifier-delimiter">:</span> <span class="classifier">Quaternion</span></dt>
  1212. <dd>Returns the world rotation of the <em>transform</em>.</dd>
  1213. <dt><strong>world_pose</strong> (sg, transform) <span class="classifier-delimiter">:</span> <span class="classifier">Matrix4x4</span></dt>
  1214. <dd>Returns the world pose of the <em>transform</em>.</dd>
  1215. <dt><strong>set_local_position</strong> (sg, transform, position)</dt>
  1216. <dd>Sets the local <em>position</em> of the <em>transform</em>.</dd>
  1217. <dt><strong>set_local_rotation</strong> (sg, transform, rotation)</dt>
  1218. <dd>Sets the local <em>rotation</em> of the <em>transform</em>.</dd>
  1219. <dt><strong>set_local_scale</strong> (sg, transform, scale)</dt>
  1220. <dd>Sets the local <em>scale</em> of the <em>transform</em>.</dd>
  1221. <dt><strong>set_local_pose</strong> (sg, transform, pose)</dt>
  1222. <dd>Sets the local <em>pose</em> of the <em>transform</em>.</dd>
  1223. <dt><strong>link</strong> (sg, parent, child, child_local_position, child_local_rotation, child_local_scale)</dt>
  1224. <dd>Links <cite>child</cite> to <cite>parent</cite>. After linking the child will follow its
  1225. parent. Set child_local_* to modify the child position after it has been
  1226. linked to the parent, otherwise che child will be positioned at the
  1227. location of its parent.</dd>
  1228. <dt><strong>unlink</strong> (sg, child)</dt>
  1229. <dd>Unlinks <cite>child</cite> from its parent if it has any. After unlinking, the local
  1230. pose of the &#64;a child is set to its previous world pose.</dd>
  1231. </dl>
  1232. </div>
  1233. <div class="section" id="soundworld">
  1234. <h2>SoundWorld<a class="headerlink" href="#soundworld" title="Permalink to this headline">¶</a></h2>
  1235. <dl class="docutils">
  1236. <dt><strong>stop_all</strong> (sound_world)</dt>
  1237. <dd>Stops all the sounds in the world.</dd>
  1238. <dt><strong>pause_all</strong> (sound_world)</dt>
  1239. <dd>Pauses all the sounds in the world</dd>
  1240. <dt><strong>resume_all</strong> (sound_world)</dt>
  1241. <dd>Resumes all previously paused sounds in the world.</dd>
  1242. <dt><strong>is_playing</strong> (sound_world, id) <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  1243. <dd>Returns whether the sound <em>id</em> is playing.</dd>
  1244. </dl>
  1245. </div>
  1246. <div class="section" id="unitmanager">
  1247. <h2>UnitManager<a class="headerlink" href="#unitmanager" title="Permalink to this headline">¶</a></h2>
  1248. <dl class="docutils">
  1249. <dt><strong>create</strong> ([world]) <span class="classifier-delimiter">:</span> <span class="classifier">UnitId</span></dt>
  1250. <dd>Creates a new empty unit. If <em>world</em> is specified, the unit will be owned by
  1251. that world.</dd>
  1252. <dt><strong>destroy</strong> (unit)</dt>
  1253. <dd>Destroys the given <em>unit</em>.</dd>
  1254. <dt><strong>alive</strong> (unit) <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
  1255. <dd>Returns whether the unit is alive.</dd>
  1256. </dl>
  1257. </div>
  1258. <div class="section" id="window">
  1259. <h2>Window<a class="headerlink" href="#window" title="Permalink to this headline">¶</a></h2>
  1260. <dl class="docutils">
  1261. <dt><strong>show</strong> ()</dt>
  1262. <dd>Shows the window.</dd>
  1263. <dt><strong>hide</strong> ()</dt>
  1264. <dd>Hides the window.</dd>
  1265. <dt><strong>resize</strong> (width, height)</dt>
  1266. <dd>Resizes the window to <em>width</em> and <em>height</em>.</dd>
  1267. <dt><strong>move</strong> (x, y)</dt>
  1268. <dd>Moves the window to <em>x</em> and <em>y</em>.</dd>
  1269. <dt><strong>minimize</strong> ()</dt>
  1270. <dd>Minimizes the window.</dd>
  1271. <dt><strong>maximize</strong> ()</dt>
  1272. <dd>Maximizes the window.</dd>
  1273. <dt><strong>restore</strong> ()</dt>
  1274. <dd>Restores the window.</dd>
  1275. <dt><strong>title</strong> () <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
  1276. <dd>Returns the title of the window.</dd>
  1277. <dt><strong>set_title</strong> (title)</dt>
  1278. <dd>Sets the title of the window.</dd>
  1279. <dt><strong>show_cursor</strong> (show)</dt>
  1280. <dd>Sets whether to <em>show</em> the cursor.</dd>
  1281. <dt><strong>set_fullscreen</strong> (fullscreen)</dt>
  1282. <dd>Sets whether the window is <em>fullscreen</em>.</dd>
  1283. <dt><strong>set_cursor</strong> (cursor)</dt>
  1284. <dd>Sets the mouse <em>cursor</em> on this window. Cursor can be any of <code class="docutils literal notranslate"><span class="pre">arrow</span></code>, <code class="docutils literal notranslate"><span class="pre">hand</span></code>,
  1285. <code class="docutils literal notranslate"><span class="pre">text_input</span></code>, <code class="docutils literal notranslate"><span class="pre">corner_top_left</span></code>, <code class="docutils literal notranslate"><span class="pre">corner_top_right</span></code>, <code class="docutils literal notranslate"><span class="pre">corner_bottom_left</span></code>,
  1286. <code class="docutils literal notranslate"><span class="pre">corner_bottom_right</span></code>, <code class="docutils literal notranslate"><span class="pre">size_horizontal</span></code>, <code class="docutils literal notranslate"><span class="pre">size_vertical</span></code> or <code class="docutils literal notranslate"><span class="pre">wait</span></code>.</dd>
  1287. <dt><strong>set_cursor_mode</strong> (cursor, mode)</dt>
  1288. <dd>Sets the mouse cursor <em>mode</em> on this window. Mode can be either <code class="docutils literal notranslate"><span class="pre">normal</span></code> or <code class="docutils literal notranslate"><span class="pre">disabled</span></code>.
  1289. Setting the mode to <code class="docutils literal notranslate"><span class="pre">disabled</span></code> hides the cursor and automatically re-centers it every time it
  1290. is moved.</dd>
  1291. </dl>
  1292. </div>
  1293. <div class="section" id="world">
  1294. <h2>World<a class="headerlink" href="#world" title="Permalink to this headline">¶</a></h2>
  1295. <dl class="docutils">
  1296. <dt><strong>spawn_unit</strong> (world, name, [position, rotation, scale]) <span class="classifier-delimiter">:</span> <span class="classifier">UnitId</span></dt>
  1297. <dd>Spawns a new instance of the unit <em>name</em> at the given <em>position</em>, <em>rotation</em> and <em>scale</em>.</dd>
  1298. <dt><strong>spawn_empty_unit</strong> (world) <span class="classifier-delimiter">:</span> <span class="classifier">UnitId</span></dt>
  1299. <dd>Spawns a new empty unit and returns its id.</dd>
  1300. <dt><strong>destroy_unit</strong> (world, unit)</dt>
  1301. <dd>Destroys the given <em>unit</em>.</dd>
  1302. <dt><strong>num_units</strong> (world) <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
  1303. <dd>Returns the number of units in the <em>world</em>.</dd>
  1304. <dt><strong>units</strong> (world) <span class="classifier-delimiter">:</span> <span class="classifier">table</span></dt>
  1305. <dd>Returns all the the units in the world in a table.</dd>
  1306. <dt><strong>unit_by_name</strong> (world, name) <span class="classifier-delimiter">:</span> <span class="classifier">UnitId</span></dt>
  1307. <dd>Returns the unit with the given Level Editor <em>name</em> or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no such unit is found.
  1308. If there are multiple units with the same name, a random one will be returned.</dd>
  1309. <dt><strong>update_animations</strong> (world, dt)</dt>
  1310. <dd>Update all animations with <em>dt</em>.</dd>
  1311. <dt><strong>update_scene</strong> (world, dt)</dt>
  1312. <dd>Updates the scene with <em>dt</em>.</dd>
  1313. <dt><strong>update</strong> (world, dt)</dt>
  1314. <dd>Updates the world with <em>dt</em>.</dd>
  1315. <dt><strong>create_debug_line</strong> (world, depth_test) <span class="classifier-delimiter">:</span> <span class="classifier">DebugLine</span></dt>
  1316. <dd>Creates a new DebugLine. <em>depth_test</em> controls whether to
  1317. enable depth test when rendering the lines.</dd>
  1318. <dt><strong>destroy_debug_line</strong> (world, line)</dt>
  1319. <dd>Destroys the debug <em>line</em>.</dd>
  1320. <dt><strong>create_screen_gui</strong> (world) <span class="classifier-delimiter">:</span> <span class="classifier">Gui</span></dt>
  1321. <dd>Creates a new Gui for 2D drawing.</dd>
  1322. <dt><strong>create_world_gui</strong> (world) <span class="classifier-delimiter">:</span> <span class="classifier">Gui</span></dt>
  1323. <dd>Creates a new Gui for 3D drawing.</dd>
  1324. <dt><strong>destroy_gui</strong> (world, gui)</dt>
  1325. <dd>Destroys the <em>gui</em>.</dd>
  1326. <dt><strong>scene_graph</strong> (world) <span class="classifier-delimiter">:</span> <span class="classifier">SceneGraph</span></dt>
  1327. <dd>Returns the scene graph.</dd>
  1328. <dt><strong>render_world</strong> (world) <span class="classifier-delimiter">:</span> <span class="classifier">RenderWorld</span></dt>
  1329. <dd>Returns the render sub-world.</dd>
  1330. <dt><strong>physics_world</strong> (world) <span class="classifier-delimiter">:</span> <span class="classifier">PhysicsWorld</span></dt>
  1331. <dd>Returns the physics sub-world.</dd>
  1332. <dt><strong>sound_world</strong> (world) <span class="classifier-delimiter">:</span> <span class="classifier">SoundWorld</span></dt>
  1333. <dd>Returns the sound sub-world.</dd>
  1334. <dt><strong>animation_state_machine</strong> (world) <span class="classifier-delimiter">:</span> <span class="classifier">AnimationStateMachine</span></dt>
  1335. <dd>Returns the animation state machine.</dd>
  1336. </dl>
  1337. <div class="section" id="camera">
  1338. <h3>Camera<a class="headerlink" href="#camera" title="Permalink to this headline">¶</a></h3>
  1339. <dl class="docutils">
  1340. <dt><strong>camera_create</strong> (world, unit, projection, fov, far_range, near_range, pose) <span class="classifier-delimiter">:</span> <span class="classifier">Id</span></dt>
  1341. <dd>Creates a new camera for <em>unit</em> and returns its id.
  1342. Projection can be either <code class="docutils literal notranslate"><span class="pre">orthographic</span></code> or <code class="docutils literal notranslate"><span class="pre">perspective</span></code>.</dd>
  1343. <dt><strong>camera_destroy</strong> (world, camera)</dt>
  1344. <dd>Destroys the <em>camera</em> instance.</dd>
  1345. <dt><strong>camera_instance</strong> (world, unit) <span class="classifier-delimiter">:</span> <span class="classifier">Id</span></dt>
  1346. <dd>Returns the ID of the camera owned by the <em>unit</em>, or <code class="docutils literal notranslate"><span class="pre">nil</span></code>.</dd>
  1347. <dt><strong>camera_set_projection_type</strong> (world, camera, projection)</dt>
  1348. <dd>Sets the projection type of the <em>camera</em>.
  1349. Projection can be either <code class="docutils literal notranslate"><span class="pre">orthographic</span></code> or <code class="docutils literal notranslate"><span class="pre">perspective</span></code>.</dd>
  1350. <dt><strong>camera_projection_type</strong> (world, camera) <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
  1351. <dd>Returns the projection type of the <em>camera</em>.
  1352. It can be either <code class="docutils literal notranslate"><span class="pre">orthographic</span></code> or <code class="docutils literal notranslate"><span class="pre">perspective</span></code>.</dd>
  1353. <dt><strong>camera_fov</strong> (world, camera) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  1354. <dd>Returns the field-of-view of the <em>camera</em> in degrees.</dd>
  1355. <dt><strong>camera_set_fov</strong> (world, camera, fov)</dt>
  1356. <dd>Sets the field-of-view of the <em>camera</em> in degrees.</dd>
  1357. <dt><strong>camera_near_clip_distance</strong> (world, camera) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  1358. <dd>Returns the near clip distance of the <em>camera</em>.</dd>
  1359. <dt><strong>camera_set_near_clip_distance</strong> (world, camera, near)</dt>
  1360. <dd>Sets the near clip distance of the <em>camera</em>.</dd>
  1361. <dt><strong>camera_far_clip_distance</strong> (world, camera) <span class="classifier-delimiter">:</span> <span class="classifier">float</span></dt>
  1362. <dd>Returns the far clip distance of the <em>camera</em>.</dd>
  1363. <dt><strong>camera_set_far_clip_distance</strong> (world, camera, far)</dt>
  1364. <dd>Sets the far clip distance of the <em>camera</em>.</dd>
  1365. <dt><strong>camera_set_orthographic_size</strong> (world, camera, half_size)</dt>
  1366. <dd>Sets the vertical <em>half_size</em> of the orthographic view volume.
  1367. The horizontal size is proportional to the viewport’s aspect ratio.</dd>
  1368. <dt><strong>camera_screen_to_world</strong> (world, camera, pos) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  1369. <dd>Returns <em>pos</em> from screen-space to world-space coordinates.</dd>
  1370. <dt><strong>camera_world_to_screen</strong> (world, camera, pos) <span class="classifier-delimiter">:</span> <span class="classifier">Vector3</span></dt>
  1371. <dd>Returns <em>pos</em> from world-space to screen-space coordinates.</dd>
  1372. </dl>
  1373. </div>
  1374. <div class="section" id="sound">
  1375. <h3>Sound<a class="headerlink" href="#sound" title="Permalink to this headline">¶</a></h3>
  1376. <dl class="docutils">
  1377. <dt><strong>play_sound</strong> (world, name, [loop, volume, position, range]) <span class="classifier-delimiter">:</span> <span class="classifier">SoundInstanceId</span></dt>
  1378. <dd>Plays the sound with the given <em>name</em> at the given <em>position</em>, with the given
  1379. <em>volume</em> and <em>range</em>. <em>loop</em> controls whether the sound must loop or not.</dd>
  1380. <dt><strong>stop_sound</strong> (world, id)</dt>
  1381. <dd>Stops the sound with the given <em>id</em>.</dd>
  1382. <dt><strong>link_sound</strong> (world, id, unit, node)</dt>
  1383. <dd>Links the sound <em>id</em> to the <em>node</em> of the given <em>unit</em>.
  1384. After this call, the sound <em>id</em> will follow the unit <em>unit</em>.</dd>
  1385. <dt><strong>set_listener_pose</strong> (world, pose)</dt>
  1386. <dd>Sets the <em>pose</em> of the listener.</dd>
  1387. <dt><strong>set_sound_position</strong> (world, id, position)</dt>
  1388. <dd>Sets the <em>position</em> of the sound <em>id</em>.</dd>
  1389. <dt><strong>set_sound_range</strong> (world, id, range)</dt>
  1390. <dd>Sets the <em>range</em> of the sound <em>id</em>.</dd>
  1391. <dt><strong>set_sound_volume</strong> (world, id, volume)</dt>
  1392. <dd>Sets the <em>volume</em> of the sound <em>id</em>.</dd>
  1393. </dl>
  1394. </div>
  1395. <div class="section" id="level">
  1396. <h3>Level<a class="headerlink" href="#level" title="Permalink to this headline">¶</a></h3>
  1397. <dl class="docutils">
  1398. <dt><strong>load_level</strong> (world, name, [pos, rot]) <span class="classifier-delimiter">:</span> <span class="classifier">Level</span></dt>
  1399. <dd>Loads the level <em>name</em> into the world at the given <em>position</em> and <em>rotation</em>.</dd>
  1400. </dl>
  1401. </div>
  1402. </div>
  1403. </div>
  1404. </div>
  1405. </div>
  1406. <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
  1407. <a href="reference/command_line.html" class="btn btn-neutral float-left" title="Command line" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
  1408. <a href="glossary.html" class="btn btn-neutral float-right" title="Glossary" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
  1409. </div>
  1410. <hr/>
  1411. <div role="contentinfo">
  1412. <p>&#169; <a href="copyright.html">Copyright</a> Except where otherwise noted, content on this page is licensed under a CC-BY-SA 4.0 Int. License.</p>
  1413. </div>
  1414. Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
  1415. <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
  1416. provided by <a href="https://readthedocs.org">Read the Docs</a>.
  1417. </footer>
  1418. </div>
  1419. </div>
  1420. </section>
  1421. </div>
  1422. <script>
  1423. jQuery(function () {
  1424. SphinxRtdTheme.Navigation.enable(true);
  1425. });
  1426. </script>
  1427. <!-- Theme Analytics -->
  1428. <script async src="https://www.googletagmanager.com/gtag/js?id=G-XNVGCMNDZH"></script>
  1429. <script>
  1430. window.dataLayer = window.dataLayer || [];
  1431. function gtag(){dataLayer.push(arguments);}
  1432. gtag('js', new Date());
  1433. gtag('config', 'G-XNVGCMNDZH', {
  1434. 'anonymize_ip': true,
  1435. });
  1436. </script>
  1437. </body>
  1438. </html>