| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576 |
- <!DOCTYPE html>
- <html class="writer-html5" lang="en" >
- <head>
- <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
- <meta property="article:modified_time" content="2025-12-14T11:11:41+00:00" /><meta property="og:title" content="Lua API reference" />
- <meta property="og:type" content="website" />
- <meta property="og:url" content="https://docs.crownengine.org/html/latest/lua_api.html" />
- <meta property="og:site_name" content="Crown 0.60.0 Manual" />
- <meta property="og:description" content="AnimationStateMachine: create(asm, unit, state_machine_resource), Id, Creates a new state machine instance for unit and returns its id.,, destroy(asm, state_machine), Destroys the state_machine instance.,, instance(asm, unit), Id, Returns the ID of the state machine owned by t..." />
- <meta name="description" content="AnimationStateMachine: create(asm, unit, state_machine_resource), Id, Creates a new state machine instance for unit and returns its id.,, destroy(asm, state_machine), Destroys the state_machine instance.,, instance(asm, unit), Id, Returns the ID of the state machine owned by t..." />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>Lua API reference — Crown 0.60.0 Manual 0.60.0 documentation</title>
- <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
- <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
- <link rel="stylesheet" href="_static/css/custom.css" type="text/css" />
- <link rel="shortcut icon" href="_static/org.crownengine.Crown.svg"/>
- <link rel="canonical" href="https://docs.crownengine.org/html/latest/lua_api.html" />
- <!--[if lt IE 9]>
- <script src="_static/js/html5shiv.min.js"></script>
- <![endif]-->
-
- <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
- <script src="_static/jquery.js"></script>
- <script src="_static/underscore.js"></script>
- <script src="_static/doctools.js"></script>
- <script src="_static/js/theme.js"></script>
- <link rel="index" title="Index" href="genindex.html" />
- <link rel="search" title="Search" href="search.html" />
- <link rel="copyright" title="Copyright" href="copyright.html" />
- <link rel="next" title="Glossary" href="glossary.html" />
- <link rel="prev" title="Command line" href="reference/command_line.html" />
- </head>
- <body class="wy-body-for-nav">
- <div class="wy-grid-for-nav">
- <nav data-toggle="wy-nav-shift" class="wy-nav-side">
- <div class="wy-side-scroll">
- <div class="wy-side-nav-search" >
- <a href="index.html">
- <img src="_static/org.crownengine.Crown.svg" class="logo" alt="Logo"/>
- </a>
- <div class="version">
- Crown 0.60.0 Manual
- </div>
- <div role="search">
- <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
- <input type="text" name="q" placeholder="Search docs" />
- <input type="hidden" name="check_keywords" value="yes" />
- <input type="hidden" name="area" value="default" />
- </form>
- </div>
- </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
- <ul class="current">
- <li class="toctree-l1"><a class="reference internal" href="changelog.html">Changelog</a></li>
- <li class="toctree-l1"><a class="reference internal" href="introduction.html">Introduction</a></li>
- <li class="toctree-l1"><a class="reference internal" href="installing_crown/index.html">Installing Crown</a></li>
- <li class="toctree-l1"><a class="reference internal" href="getting_started/index.html">Getting Started</a></li>
- <li class="toctree-l1"><a class="reference internal" href="importing_resources/index.html">Importing Resources</a></li>
- <li class="toctree-l1"><a class="reference internal" href="gameplay/index.html">Writing Gameplay</a></li>
- <li class="toctree-l1"><a class="reference internal" href="deploying/index.html">Deploying</a></li>
- <li class="toctree-l1"><a class="reference internal" href="reference/index.html">Reference</a></li>
- <li class="toctree-l1 current"><a class="current reference internal" href="#">Lua API reference</a><ul>
- <li class="toctree-l2"><a class="reference internal" href="#animationstatemachine">AnimationStateMachine</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#debugline">DebugLine</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#device">Device</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#display">Display</a><ul>
- <li class="toctree-l3"><a class="reference internal" href="#displaymode">DisplayMode</a></li>
- </ul>
- </li>
- <li class="toctree-l2"><a class="reference internal" href="#gui">Gui</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#input">Input</a><ul>
- <li class="toctree-l3"><a class="reference internal" href="#inputevent">InputEvent</a></li>
- <li class="toctree-l3"><a class="reference internal" href="#inputeventtype">InputEventType</a></li>
- <li class="toctree-l3"><a class="reference internal" href="#keyboard">Keyboard</a><ul>
- <li class="toctree-l4"><a class="reference internal" href="#keyboard-button-names">Keyboard Button Names</a></li>
- <li class="toctree-l4"><a class="reference internal" href="#keyboard-axis-names">Keyboard Axis Names</a></li>
- </ul>
- </li>
- <li class="toctree-l3"><a class="reference internal" href="#mouse">Mouse</a><ul>
- <li class="toctree-l4"><a class="reference internal" href="#mouse-button-names">Mouse Button Names</a></li>
- <li class="toctree-l4"><a class="reference internal" href="#mouse-axis-names">Mouse Axis Names</a></li>
- </ul>
- </li>
- <li class="toctree-l3"><a class="reference internal" href="#touch">Touch</a></li>
- <li class="toctree-l3"><a class="reference internal" href="#pad1-pad2-pad3-pad4">Pad1, Pad2, Pad3, Pad4</a><ul>
- <li class="toctree-l4"><a class="reference internal" href="#pad-button-names">Pad Button Names</a></li>
- <li class="toctree-l4"><a class="reference internal" href="#pad-axis-names">Pad Axis Names</a></li>
- </ul>
- </li>
- </ul>
- </li>
- <li class="toctree-l2"><a class="reference internal" href="#material">Material</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#math">Math</a><ul>
- <li class="toctree-l3"><a class="reference internal" href="#vector3">Vector3</a><ul>
- <li class="toctree-l4"><a class="reference internal" href="#constructors">Constructors</a></li>
- <li class="toctree-l4"><a class="reference internal" href="#functions">Functions</a></li>
- </ul>
- </li>
- <li class="toctree-l3"><a class="reference internal" href="#vector3box">Vector3Box</a><ul>
- <li class="toctree-l4"><a class="reference internal" href="#id1">Constructors</a></li>
- <li class="toctree-l4"><a class="reference internal" href="#id2">Functions</a></li>
- </ul>
- </li>
- <li class="toctree-l3"><a class="reference internal" href="#quaternion">Quaternion</a><ul>
- <li class="toctree-l4"><a class="reference internal" href="#id3">Constructors</a></li>
- <li class="toctree-l4"><a class="reference internal" href="#id4">Functions</a></li>
- </ul>
- </li>
- <li class="toctree-l3"><a class="reference internal" href="#quaternionbox">QuaternionBox</a><ul>
- <li class="toctree-l4"><a class="reference internal" href="#id5">Constructors</a></li>
- <li class="toctree-l4"><a class="reference internal" href="#id6">Functions</a></li>
- </ul>
- </li>
- <li class="toctree-l3"><a class="reference internal" href="#matrix4x4">Matrix4x4</a><ul>
- <li class="toctree-l4"><a class="reference internal" href="#id7">Constructors</a></li>
- <li class="toctree-l4"><a class="reference internal" href="#id8">Functions</a></li>
- </ul>
- </li>
- <li class="toctree-l3"><a class="reference internal" href="#matrix4x4box">Matrix4x4Box</a><ul>
- <li class="toctree-l4"><a class="reference internal" href="#id9">Constructors</a></li>
- <li class="toctree-l4"><a class="reference internal" href="#id10">Functions</a></li>
- </ul>
- </li>
- <li class="toctree-l3"><a class="reference internal" href="#color4">Color4</a><ul>
- <li class="toctree-l4"><a class="reference internal" href="#id11">Constructors</a></li>
- <li class="toctree-l4"><a class="reference internal" href="#id12">Functions</a></li>
- </ul>
- </li>
- <li class="toctree-l3"><a class="reference internal" href="#id13">Math</a></li>
- </ul>
- </li>
- <li class="toctree-l2"><a class="reference internal" href="#physicsworld">PhysicsWorld</a><ul>
- <li class="toctree-l3"><a class="reference internal" href="#raycasthit">RaycastHit</a></li>
- <li class="toctree-l3"><a class="reference internal" href="#actor">Actor</a></li>
- <li class="toctree-l3"><a class="reference internal" href="#mover">Mover</a></li>
- </ul>
- </li>
- <li class="toctree-l2"><a class="reference internal" href="#profiler">Profiler</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#renderworld">RenderWorld</a><ul>
- <li class="toctree-l3"><a class="reference internal" href="#mesh">Mesh</a></li>
- <li class="toctree-l3"><a class="reference internal" href="#sprite">Sprite</a></li>
- <li class="toctree-l3"><a class="reference internal" href="#light">Light</a></li>
- <li class="toctree-l3"><a class="reference internal" href="#fog">Fog</a></li>
- </ul>
- </li>
- <li class="toctree-l2"><a class="reference internal" href="#resourcepackage">ResourcePackage</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#scenegraph">SceneGraph</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#soundworld">SoundWorld</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#unitmanager">UnitManager</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#window">Window</a></li>
- <li class="toctree-l2"><a class="reference internal" href="#world">World</a><ul>
- <li class="toctree-l3"><a class="reference internal" href="#camera">Camera</a></li>
- <li class="toctree-l3"><a class="reference internal" href="#sound">Sound</a></li>
- <li class="toctree-l3"><a class="reference internal" href="#level">Level</a></li>
- </ul>
- </li>
- </ul>
- </li>
- <li class="toctree-l1"><a class="reference internal" href="glossary.html">Glossary</a></li>
- <li class="toctree-l1"><a class="reference internal" href="copyright.html">License</a></li>
- <li class="toctree-l1"><a class="reference internal" href="hackers/index.html">Hackers</a></li>
- </ul>
- </div>
- </div>
- </nav>
- <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
- <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
- <a href="index.html">Crown 0.60.0 Manual</a>
- </nav>
- <div class="wy-nav-content">
- <div class="rst-content">
- <div role="navigation" aria-label="Page navigation">
- <ul class="wy-breadcrumbs">
- <li><a href="index.html" class="icon icon-home"></a> »</li>
- <li>Lua API reference</li>
- <li class="wy-breadcrumbs-aside">
- <a href="_sources/lua_api.rst.txt" rel="nofollow"> View page source</a>
- </li>
- </ul>
- <hr/>
- </div>
- <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
- <div itemprop="articleBody">
-
- <section id="lua-api-reference">
- <h1>Lua API reference<a class="headerlink" href="#lua-api-reference" title="Permalink to this headline">¶</a></h1>
- <section id="animationstatemachine">
- <h2>AnimationStateMachine<a class="headerlink" href="#animationstatemachine" title="Permalink to this headline">¶</a></h2>
- <dl class="simple">
- <dt><strong>create</strong> (asm, unit, state_machine_resource)<span class="classifier">Id</span></dt><dd><p>Creates a new state machine instance for <em>unit</em> and returns its id.</p>
- </dd>
- <dt><strong>destroy</strong> (asm, state_machine)</dt><dd><p>Destroys the <em>state_machine</em> instance.</p>
- </dd>
- <dt><strong>instance</strong> (asm, unit)<span class="classifier">Id</span></dt><dd><p>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>.</p>
- </dd>
- <dt><strong>variable_id</strong> (asm, state_machine, name)<span class="classifier">Id</span></dt><dd><p>Returns the ID of the variable <em>name</em> in the <em>state_machine</em>, or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if
- the variable does not exist.</p>
- </dd>
- <dt><strong>variable</strong> (asm, state_machine, variable_id)<span class="classifier">number</span></dt><dd><p>Returns the value of the <em>variable_id</em> in the <em>state_machine</em>.</p>
- </dd>
- <dt><strong>set_variable</strong> (asm, state_machine, variable_id, value)</dt><dd><p>Sets the <em>value</em> of the <em>variable_id</em> in the <em>state_machine</em>.</p>
- </dd>
- <dt><strong>trigger</strong> (asm, state_machine, event)</dt><dd><p>Triggers the <em>event</em> in the <em>state_machine</em>.</p>
- </dd>
- <dt><strong>set_state_machine</strong> (asm, state_machine, state_machine_resource)</dt><dd><p>Sets the <em>state_machine_resource</em> of <em>state_machine</em>.</p>
- </dd>
- </dl>
- </section>
- <section id="debugline">
- <h2>DebugLine<a class="headerlink" href="#debugline" title="Permalink to this headline">¶</a></h2>
- <dl class="simple">
- <dt><strong>add_line</strong> (debug_line, start, end, color)</dt><dd><p>Adds a line from <em>start</em> to <em>end</em> with the given <em>color</em>.</p>
- </dd>
- <dt><strong>add_axes</strong> (debug_line, tm, length)</dt><dd><p>Adds lines for each axis with the given <em>length</em>.</p>
- </dd>
- <dt><strong>add_arc</strong> (debug_line, center, radius, plane_normal, midpoint_normal, color, [circle_segments = 36]);</dt><dd><p>Adds an arc at <em>center</em> with the given <em>radius</em> and <em>plane_normal</em> and <em>midpoint_normal</em> vectors.</p>
- </dd>
- <dt><strong>add_circle</strong> (debug_line, center, radius, normal, color, [segments = 36])</dt><dd><p>Adds a circle at <em>center</em> with the given <em>radius</em> and <em>normal</em> vector.</p>
- </dd>
- <dt><strong>add_cone</strong> (debug_line, from, to, radius, color, [segments = 36, rays = 36])</dt><dd><p>Adds a cone with the base centered at <em>from</em> and the tip at <em>to</em>.</p>
- </dd>
- <dt><strong>add_sphere</strong> (debug_line, center, radius, color, [segments = 36])</dt><dd><p>Adds a sphere at <em>center</em> with the given <em>radius</em>.</p>
- </dd>
- <dt><strong>add_obb</strong> (debug_line, tm, half_extents, color)</dt><dd><p>Adds an orientd bounding box. <em>tm</em> describes the position and orientation of
- the box. <em>half_extents</em> describes the size of the box along the axis.</p>
- </dd>
- <dt><strong>add_frustum</strong> (debug_line, mvp, color)</dt><dd><p>Adds a frustum defined by <em>mvp</em>.</p>
- </dd>
- <dt><strong>reset</strong> (debug_line)</dt><dd><p>Resets all the lines.</p>
- </dd>
- <dt><strong>submit</strong> (debug_line)</dt><dd><p>Submits the lines to renderer for drawing.</p>
- </dd>
- </dl>
- </section>
- <section id="device">
- <h2>Device<a class="headerlink" href="#device" title="Permalink to this headline">¶</a></h2>
- <dl>
- <dt><strong>argv</strong> ()<span class="classifier">table</span></dt><dd><p>Returns a table containing the command line parameters the engine was started with.</p>
- </dd>
- <dt><strong>platform</strong> ()<span class="classifier">string</span></dt><dd><p>Returns a string identifying what platform the engine is running on.
- It can be either <code class="docutils literal notranslate"><span class="pre">android</span></code>, <code class="docutils literal notranslate"><span class="pre">html5</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></p>
- </dd>
- <dt><strong>architecture</strong> ()<span class="classifier">string</span></dt><dd><p>Returns a string identifying what architecture the engine is running on.
- 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>.</p>
- </dd>
- <dt><strong>version</strong> ()<span class="classifier">string</span></dt><dd><p>Returns a string identifying the engine version.
- The form is “major.minor.micro”.</p>
- </dd>
- <dt><strong>build</strong> ()<span class="classifier">string</span></dt><dd><p>Returns a string identifying the engine build.
- It can be either <code class="docutils literal notranslate"><span class="pre">debug</span></code>, <code class="docutils literal notranslate"><span class="pre">development</span></code> or <code class="docutils literal notranslate"><span class="pre">release</span></code>.</p>
- </dd>
- <dt><strong>quit</strong> ([exit_code])</dt><dd><p>Quits the application. On platforms that support it, <em>exit_code</em> is
- returned to the system after the application exits.</p>
- </dd>
- <dt><strong>resolution</strong> ()<span class="classifier">float, float</span></dt><dd><p>Returns the main window resolution (width, height).</p>
- </dd>
- <dt><strong>create_world</strong> ()<span class="classifier">World</span></dt><dd><p>Creates a new world.</p>
- </dd>
- <dt><strong>destroy_world</strong> (world)</dt><dd><p>Destroys the given <em>world</em>.</p>
- </dd>
- <dt><strong>render</strong> (world, camera)</dt><dd><p>Renders <em>world</em> using <em>camera</em>.</p>
- </dd>
- <dt><strong>create_resource_package</strong> (name)<span class="classifier">ResourcePackage</span></dt><dd><p>Returns the resource package with the given <em>package_name</em> name.</p>
- </dd>
- <dt><strong>destroy_resource_package</strong> (package)</dt><dd><p>Destroy a previously created resource <em>package</em>.</p>
- <div class="admonition note">
- <p class="admonition-title">Note</p>
- <p>To unload the resources loaded by the package, you have to call
- ResourcePackage.unload() first.</p>
- </div>
- </dd>
- <dt><strong>screenshot</strong> (path)</dt><dd><p>Captures a screenshot of the main window’s backbuffer and saves it at <em>path</em> in PNG format.
- 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>
- <div class="admonition note">
- <p class="admonition-title">Note</p>
- <p>Only available in debug and development builds.</p>
- </div>
- </dd>
- <dt><strong>console_send</strong> (table)</dt><dd><p>Sends the given lua <em>table</em> to clients connected to the engine.
- 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.</p>
- </dd>
- <dt><strong>can_get</strong> (type, name)<span class="classifier">bool</span></dt><dd><p>Returns whether the resource (type, name) is loaded.
- When resource autoload is enabled it always returns true.</p>
- </dd>
- <dt><strong>enable_resource_autoload</strong> (enable)</dt><dd><p>Sets whether resources should be automatically loaded when accessed.</p>
- </dd>
- <dt><strong>temp_count</strong> ()<span class="classifier">int, int, int</span></dt><dd><p>Returns the number of temporary objects used by Lua.</p>
- </dd>
- <dt><strong>set_temp_count</strong> (nv, nq, nm)</dt><dd><p>Sets the number of temporary objects used by Lua.</p>
- </dd>
- <dt><strong>guid</strong> ()<span class="classifier">string</span></dt><dd><p>Returns a new GUID.</p>
- </dd>
- <dt><strong>set_timestep_policy</strong> (policy)</dt><dd><p>Sets the timestep policy:</p>
- <ul class="simple">
- <li><p><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;</p></li>
- <li><p><code class="docutils literal notranslate"><span class="pre">smoothed</span></code>: the timestep is computed as an average of the previous delta times.</p></li>
- </ul>
- </dd>
- <dt><strong>set_timestep_smoothing</strong> (num_samples, num_outliers, average_cap)</dt><dd><p>Sets the number of samples to be averaged, the outliers to be excluded and the maximum
- allowed deviation in percent from the previous average. Given a delta time series DTs, and
- a previous average AVGp:</p>
- <ul class="simple">
- <li><p>DTs = [ .33; .30; .32; .33; .24; .33; .25; .35; .33; .42 ]</p></li>
- <li><p>AVGp = 0.33</p></li>
- </ul>
- <p>A call to set_smoothing(10, 2, 0.1) would compute the new average like so:</p>
- <ol class="arabic simple">
- <li><p>Remove the 2 minimum and maximum values in DTs;</p></li>
- <li><p>Compute the average for the remaining 6 values in DTs: AVG = 0.323.</p></li>
- <li><p>Smooth the newly computed average: AVG = lerp(AVGp, AVG, 0.1) = 0.329.</p></li>
- </ol>
- </dd>
- </dl>
- </section>
- <section id="display">
- <h2>Display<a class="headerlink" href="#display" title="Permalink to this headline">¶</a></h2>
- <dl class="simple">
- <dt><strong>modes</strong> ()<span class="classifier">table</span></dt><dd><p>Returns an array of <a class="reference internal" href="#displaymode">DisplayMode</a> tables.</p>
- </dd>
- <dt><strong>set_mode</strong> (id)</dt><dd><p>Sets the display mode <em>id</em>.
- The initial display mode is automatically reset when the program terminates.</p>
- </dd>
- </dl>
- <section id="displaymode">
- <h3>DisplayMode<a class="headerlink" href="#displaymode" title="Permalink to this headline">¶</a></h3>
- <p>DisplayMode is a lua table with 3 fields:</p>
- <ul class="simple">
- <li><p><code class="docutils literal notranslate"><span class="pre">id</span></code>: The id of the display mode.</p></li>
- <li><p><code class="docutils literal notranslate"><span class="pre">width</span></code>: The width of the display mode.</p></li>
- <li><p><code class="docutils literal notranslate"><span class="pre">height</span></code>: The height of the display mode.</p></li>
- </ul>
- </section>
- </section>
- <section id="gui">
- <h2>Gui<a class="headerlink" href="#gui" title="Permalink to this headline">¶</a></h2>
- <dl class="simple">
- <dt><strong>move</strong> (gui, pos)</dt><dd><p>Moves the Gui to <em>pos</em>.</p>
- </dd>
- <dt><strong>triangle</strong> (gui, a, b, c [, color, depth])</dt><dd><p>Draws a triangle defined by vertices <em>a</em>, <em>b</em> and <em>c</em>.
- Objects with a lower depth are drawn in front. If depth is omitted its value
- is set to 0.</p>
- </dd>
- <dt><strong>triangle_3d</strong> (gui, local_pose, a, b, c [, color, depth])</dt><dd><p>Draws a 3D triangle defined by vertices <em>a</em>, <em>b</em> and <em>c</em>.</p>
- </dd>
- <dt><strong>rect</strong> (gui, pos, size [, color])</dt><dd><p>Draws a rectangle.
- If pos is a Vector3, the z element specifies the drawing depth. Objects with
- a lower depth are drawn in front. If pos is a Vector2, the z elements is set
- to 0.</p>
- </dd>
- <dt><strong>rect_3d</strong> (gui, local_pose, pos, size [, color, depth])</dt><dd><p>Draws a 3D rectangle.</p>
- </dd>
- <dt><strong>image</strong> (gui, pos, size, material_resource [, color])</dt><dd><p>Draws an image.
- If pos is a Vector3, the z element specifies the drawing depth. Objects with
- a lower depth are drawn in front. If pos is a Vector2, the z elements is set
- to 0.</p>
- </dd>
- <dt><strong>image_3d</strong> (gui, local_pose, pos, size, material_resource [, color, depth])</dt><dd><p>Draws a 3D image.</p>
- </dd>
- <dt><strong>image_uv</strong> (gui, pos, size, uv0, uv1, material_resource [, color])</dt><dd><p>Draws an image with explicit UV coordinates.
- If pos is a Vector3, the z element specifies the drawing depth. Objects with
- a lower depth are drawn in front. If pos is a Vector2, the z elements is set
- to 0.</p>
- </dd>
- <dt><strong>image_3d_uv</strong> (gui, local_pose, pos, size, uv0, uv1, material_resource [, color, depth])</dt><dd><p>Draws a 3D image with explicit UV coordinates.</p>
- </dd>
- <dt><strong>text</strong> (gui, pos, font_size, str, font_resource [, material_resource , color])</dt><dd><p>Draws text.
- If pos is a Vector3, the z element specifies the drawing depth. Objects with
- a lower depth are drawn in front. If pos is a Vector2, the z elements is set
- to 0.</p>
- </dd>
- <dt><strong>text_extents</strong> (gui, font_size, str, font_resource)<span class="classifier">Vector2</span></dt><dd><p>Returns the extents of the text <em>str</em> if drawn using <em>font_resource</em> at size
- <em>font_size</em>.</p>
- </dd>
- <dt><strong>text_3d</strong> (gui, local_pose, pos, font_size, str, font_resource [, material_resource, color, depth])</dt><dd><p>Draws 3D text.</p>
- </dd>
- <dt><strong>material</strong> (material_resource)<span class="classifier">Material</span></dt><dd><p>Returns the material <em>material_resource</em>.</p>
- </dd>
- </dl>
- </section>
- <section id="input">
- <h2>Input<a class="headerlink" href="#input" title="Permalink to this headline">¶</a></h2>
- <dl class="simple">
- <dt><strong>events</strong> ()<span class="classifier">table</span></dt><dd><p>Returns an array of <a class="reference internal" href="#inputevent">InputEvent</a> tables.</p>
- </dd>
- </dl>
- <section id="inputevent">
- <h3>InputEvent<a class="headerlink" href="#inputevent" title="Permalink to this headline">¶</a></h3>
- <p>InputEvent is a lua table with 4 fields:</p>
- <ul class="simple">
- <li><p><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.</p></li>
- <li><p><code class="docutils literal notranslate"><span class="pre">type</span></code>: One of the values from <a class="reference internal" href="#inputeventtype">InputEventType</a>.</p></li>
- <li><p><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.</p></li>
- <li><p><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.</p></li>
- </ul>
- </section>
- <section id="inputeventtype">
- <h3>InputEventType<a class="headerlink" href="#inputeventtype" title="Permalink to this headline">¶</a></h3>
- <ul class="simple">
- <li><p><code class="docutils literal notranslate"><span class="pre">BUTTON_PRESSED</span></code>: A button has been pressed.</p></li>
- <li><p><code class="docutils literal notranslate"><span class="pre">BUTTON_RELEASED</span></code>: A button has been released.</p></li>
- <li><p><code class="docutils literal notranslate"><span class="pre">AXIS_CHANGED</span></code>: An axis changed its value.</p></li>
- </ul>
- </section>
- <section id="keyboard">
- <h3>Keyboard<a class="headerlink" href="#keyboard" title="Permalink to this headline">¶</a></h3>
- <dl class="simple">
- <dt><strong>name</strong> ()<span class="classifier">string</span></dt><dd><p>Returns the name of keyboard.</p>
- </dd>
- <dt><strong>connected</strong> ()<span class="classifier">bool</span></dt><dd><p>Returns whether the keyboard is connected and functioning.</p>
- </dd>
- <dt><strong>num_buttons</strong> ()<span class="classifier">int</span></dt><dd><p>Returns the number of buttons of the keyboard.</p>
- </dd>
- <dt><strong>num_axes</strong> ()<span class="classifier">int</span></dt><dd><p>Returns the number of axes of the keyboard.</p>
- </dd>
- <dt><strong>pressed</strong> (id)<span class="classifier">bool</span></dt><dd><p>Returns whether the button <em>id</em> is pressed in the current frame.</p>
- </dd>
- <dt><strong>released</strong> (id)<span class="classifier">bool</span></dt><dd><p>Returns whether the button <em>id</em> is released in the current frame.</p>
- </dd>
- <dt><strong>any_pressed</strong> ()<span class="classifier">bool</span></dt><dd><p>Returns the <em>id</em> of the first button that was pressed in the current frame
- or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no buttons were pressed at all.</p>
- </dd>
- <dt><strong>any_released</strong> ()<span class="classifier">bool</span></dt><dd><p>Returns the <em>id</em> of the first button that was released in the current frame
- or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no buttons were released at all.</p>
- </dd>
- <dt><strong>button</strong> (id)<span class="classifier">float</span></dt><dd><p>Returns the value of the button <em>id</em> in the range [0..1].</p>
- </dd>
- <dt><strong>button_name</strong> (id)<span class="classifier">string</span></dt><dd><p>Returns the name of the button <em>id</em>.</p>
- </dd>
- <dt><strong>button_id</strong> (name)<span class="classifier">int</span></dt><dd><p>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.</p>
- </dd>
- </dl>
- <section id="keyboard-button-names">
- <h4>Keyboard Button Names<a class="headerlink" href="#keyboard-button-names" title="Permalink to this headline">¶</a></h4>
- <ul class="simple">
- <li><p><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></p></li>
- <li><p><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></p></li>
- <li><p><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></p></li>
- <li><p><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></p></li>
- <li><p><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></p></li>
- <li><p><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></p></li>
- <li><p><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></p></li>
- </ul>
- </section>
- <section id="keyboard-axis-names">
- <h4>Keyboard Axis Names<a class="headerlink" href="#keyboard-axis-names" title="Permalink to this headline">¶</a></h4>
- <p>None.</p>
- </section>
- </section>
- <section id="mouse">
- <h3>Mouse<a class="headerlink" href="#mouse" title="Permalink to this headline">¶</a></h3>
- <dl class="simple">
- <dt><strong>name</strong> ()<span class="classifier">string</span></dt><dd><p>Returns the name of the mouse.</p>
- </dd>
- <dt><strong>connected</strong> ()<span class="classifier">bool</span></dt><dd><p>Returns whether the mouse is connected and functioning.</p>
- </dd>
- <dt><strong>num_buttons</strong> ()<span class="classifier">int</span></dt><dd><p>Returns the number of buttons of the mouse.</p>
- </dd>
- <dt><strong>num_axes</strong> ()<span class="classifier">int</span></dt><dd><p>Returns the number of axes of the mouse.</p>
- </dd>
- <dt><strong>pressed</strong> (id)<span class="classifier">bool</span></dt><dd><p>Returns whether the button <em>id</em> is pressed in the current frame.</p>
- </dd>
- <dt><strong>released</strong> (id)<span class="classifier">bool</span></dt><dd><p>Returns whether the button <em>id</em> is released in the current frame.</p>
- </dd>
- <dt><strong>any_pressed</strong> ()<span class="classifier">bool</span></dt><dd><p>Returns the <em>id</em> of the first button that was pressed in the current frame
- or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no buttons were pressed at all.</p>
- </dd>
- <dt><strong>any_released</strong> ()<span class="classifier">bool</span></dt><dd><p>Returns the <em>id</em> of the first button that was released in the current frame
- or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no buttons were released at all.</p>
- </dd>
- <dt><strong>button</strong> (id)<span class="classifier">float</span></dt><dd><p>Returns the value of the button <em>id</em> in the range [0..1].</p>
- </dd>
- <dt><strong>axis</strong> (id)<span class="classifier">Vector3</span></dt><dd><p>Returns the value of the axis <em>id</em>.</p>
- </dd>
- <dt><strong>button_name</strong> (id)<span class="classifier">string</span></dt><dd><p>Returns the name of the button <em>id</em>.</p>
- </dd>
- <dt><strong>axis_name</strong> (id)<span class="classifier">string</span></dt><dd><p>Returns the name of the axis <em>id</em>.</p>
- </dd>
- <dt><strong>button_id</strong> (name)<span class="classifier">int</span></dt><dd><p>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.</p>
- </dd>
- <dt><strong>axis_id</strong> (name)<span class="classifier">int</span></dt><dd><p>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.</p>
- </dd>
- </dl>
- <section id="mouse-button-names">
- <h4>Mouse Button Names<a class="headerlink" href="#mouse-button-names" title="Permalink to this headline">¶</a></h4>
- <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>
- </section>
- <section id="mouse-axis-names">
- <h4>Mouse Axis Names<a class="headerlink" href="#mouse-axis-names" title="Permalink to this headline">¶</a></h4>
- <ul class="simple">
- <li><p><code class="docutils literal notranslate"><span class="pre">cursor</span></code>: Returns the cursor position (x, y) in screen coordinates.</p></li>
- <li><p><code class="docutils literal notranslate"><span class="pre">cursor_delta</span></code>: Returns the delta of the cursor position (x, y) since last frame.</p></li>
- <li><p><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.</p></li>
- </ul>
- </section>
- </section>
- <section id="touch">
- <h3>Touch<a class="headerlink" href="#touch" title="Permalink to this headline">¶</a></h3>
- <dl class="simple">
- <dt><strong>name</strong> ()<span class="classifier">string</span></dt><dd><p>Returns the name of the touch.</p>
- </dd>
- <dt><strong>connected</strong> ()<span class="classifier">bool</span></dt><dd><p>Returns whether the touch is connected and functioning.</p>
- </dd>
- <dt><strong>num_buttons</strong> ()<span class="classifier">int</span></dt><dd><p>Returns the number of buttons of the touch.</p>
- </dd>
- <dt><strong>num_axes</strong> ()<span class="classifier">int</span></dt><dd><p>Returns the number of axes of the touch.</p>
- </dd>
- <dt><strong>pressed</strong> (id)<span class="classifier">bool</span></dt><dd><p>Returns whether the button <em>id</em> is pressed in the current frame.</p>
- </dd>
- <dt><strong>released</strong> (id)<span class="classifier">bool</span></dt><dd><p>Returns whether the button <em>id</em> is released in the current frame.</p>
- </dd>
- <dt><strong>any_pressed</strong> ()<span class="classifier">bool</span></dt><dd><p>Returns the <em>id</em> of the first button that was pressed in the current frame
- or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no buttons were pressed at all.</p>
- </dd>
- <dt><strong>any_released</strong> ()<span class="classifier">bool</span></dt><dd><p>Returns the <em>id</em> of the first button that was released in the current frame
- or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no buttons were released at all.</p>
- </dd>
- <dt><strong>button</strong> (id)<span class="classifier">float</span></dt><dd><p>Returns the value of the button <em>id</em> in the range [0..1].</p>
- </dd>
- <dt><strong>axis</strong> (id)<span class="classifier">Vector3</span></dt><dd><p>Returns the value of the axis <em>id</em>.</p>
- </dd>
- <dt><strong>button_name</strong> (id)<span class="classifier">string</span></dt><dd><p>Returns the name of the button <em>id</em>.</p>
- </dd>
- <dt><strong>axis_name</strong> (id)<span class="classifier">string</span></dt><dd><p>Returns the name of the axis <em>id</em>.</p>
- </dd>
- <dt><strong>button_id</strong> (name)<span class="classifier">int</span></dt><dd><p>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.</p>
- </dd>
- <dt><strong>axis_id</strong> (name)<span class="classifier">int</span></dt><dd><p>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.</p>
- </dd>
- </dl>
- </section>
- <section id="pad1-pad2-pad3-pad4">
- <h3>Pad1, Pad2, Pad3, Pad4<a class="headerlink" href="#pad1-pad2-pad3-pad4" title="Permalink to this headline">¶</a></h3>
- <dl class="simple">
- <dt><strong>name</strong> ()<span class="classifier">string</span></dt><dd><p>Returns the name of the pad.</p>
- </dd>
- <dt><strong>connected</strong> ()<span class="classifier">bool</span></dt><dd><p>Returns whether the pad is connected and functioning.</p>
- </dd>
- <dt><strong>num_buttons</strong> ()<span class="classifier">int</span></dt><dd><p>Returns the number of buttons of the pad.</p>
- </dd>
- <dt><strong>num_axes</strong> ()<span class="classifier">int</span></dt><dd><p>Returns the number of axes of the pad.</p>
- </dd>
- <dt><strong>pressed</strong> (id)<span class="classifier">bool</span></dt><dd><p>Returns whether the button <em>id</em> is pressed in the current frame.</p>
- </dd>
- <dt><strong>released</strong> (id)<span class="classifier">bool</span></dt><dd><p>Returns whether the button <em>id</em> is released in the current frame.</p>
- </dd>
- <dt><strong>any_pressed</strong> ()<span class="classifier">bool</span></dt><dd><p>Returns the <em>id</em> of the first button that was pressed in the current frame
- or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no buttons were pressed at all.</p>
- </dd>
- <dt><strong>any_released</strong> ()<span class="classifier">bool</span></dt><dd><p>Returns the <em>id</em> of the first button that was released in the current frame
- or <code class="docutils literal notranslate"><span class="pre">nil</span></code> if no buttons were released at all.</p>
- </dd>
- <dt><strong>button</strong> (id)<span class="classifier">float</span></dt><dd><p>Returns the value of the button <em>id</em> in the range [0..1].</p>
- </dd>
- <dt><strong>axis</strong> (id)<span class="classifier">Vector3</span></dt><dd><p>Returns the value of the axis <em>id</em>.</p>
- </dd>
- <dt><strong>button_name</strong> (id)<span class="classifier">string</span></dt><dd><p>Returns the name of the button <em>id</em>.</p>
- </dd>
- <dt><strong>axis_name</strong> (id)<span class="classifier">string</span></dt><dd><p>Returns the name of the axis <em>id</em>.</p>
- </dd>
- <dt><strong>button_id</strong> (name)<span class="classifier">int</span></dt><dd><p>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.</p>
- </dd>
- <dt><strong>axis_id</strong> (name)<span class="classifier">int</span></dt><dd><p>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.</p>
- </dd>
- <dt><strong>deadzone</strong> (id)<span class="classifier">deadzone_mode, deadzone_size</span></dt><dd><p>Returns the deadzone mode and size for the axis <em>id</em>.</p>
- </dd>
- <dt><strong>set_deadzone</strong> (id, deadzone_mode, deadzone_size)</dt><dd><p>Sets the <em>deadzone_mode</em> and <em>deadzone_size</em> for the axis <em>id</em>.</p>
- </dd>
- </dl>
- <section id="pad-button-names">
- <h4>Pad Button Names<a class="headerlink" href="#pad-button-names" title="Permalink to this headline">¶</a></h4>
- <ul class="simple">
- <li><p><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></p></li>
- <li><p><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></p></li>
- <li><p><code class="docutils literal notranslate"><span class="pre">thumb_left</span></code>, <code class="docutils literal notranslate"><span class="pre">thumb_right</span></code></p></li>
- <li><p><code class="docutils literal notranslate"><span class="pre">shoulder_left</span></code>, <code class="docutils literal notranslate"><span class="pre">shoulder_right</span></code></p></li>
- <li><p><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></p></li>
- </ul>
- </section>
- <section id="pad-axis-names">
- <h4>Pad Axis Names<a class="headerlink" href="#pad-axis-names" title="Permalink to this headline">¶</a></h4>
- <ul class="simple">
- <li><p><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].</p></li>
- <li><p><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].</p></li>
- </ul>
- </section>
- </section>
- </section>
- <section id="material">
- <h2>Material<a class="headerlink" href="#material" title="Permalink to this headline">¶</a></h2>
- <dl class="simple">
- <dt><strong>set_float</strong> (material, name, value)</dt><dd><p>Sets the <em>value</em> of the variable <em>name</em>.</p>
- </dd>
- <dt><strong>set_vector2</strong> (material, name, value)</dt><dd><p>Sets the <em>value</em> of the variable <em>name</em>.</p>
- </dd>
- <dt><strong>set_vector3</strong> (material, name, value)</dt><dd><p>Sets the <em>value</em> of the variable <em>name</em>.</p>
- </dd>
- <dt><strong>set_vector4</strong> (material, name, value)</dt><dd><p>Sets the <em>value</em> of the variable <em>name</em>.</p>
- </dd>
- <dt><strong>set_matrix4x4</strong> (material, name, value)</dt><dd><p>Sets the <em>value</em> of the variable <em>name</em>.</p>
- </dd>
- <dt><strong>set_texture</strong> (material, sampler_name, texture_name)</dt><dd><p>Sets the <em>texture_resource</em> of the sampler <em>sampler_name</em>.</p>
- </dd>
- </dl>
- </section>
- <section id="math">
- <h2>Math<a class="headerlink" href="#math" title="Permalink to this headline">¶</a></h2>
- <section id="vector3">
- <h3>Vector3<a class="headerlink" href="#vector3" title="Permalink to this headline">¶</a></h3>
- <section id="constructors">
- <h4>Constructors<a class="headerlink" href="#constructors" title="Permalink to this headline">¶</a></h4>
- <dl class="simple">
- <dt><strong>Vector3</strong> (x, y, z)<span class="classifier">Vector3</span></dt><dd><p>Returns a new vector from individual elements.</p>
- </dd>
- </dl>
- </section>
- <section id="functions">
- <h4>Functions<a class="headerlink" href="#functions" title="Permalink to this headline">¶</a></h4>
- <dl class="simple">
- <dt><strong>x</strong> (v)<span class="classifier">float</span></dt><dd><p>Returns the x value of the vector.</p>
- </dd>
- <dt><strong>y</strong> (v)<span class="classifier">float</span></dt><dd><p>Returns the y value of the vector.</p>
- </dd>
- <dt><strong>z</strong> (v)<span class="classifier">float</span></dt><dd><p>Returns the z value of the vector.</p>
- </dd>
- <dt><strong>.x</strong><span class="classifier">float</span></dt><dd><p>Returns/assigns the x value of the vector.</p>
- </dd>
- <dt><strong>.y</strong><span class="classifier">float</span></dt><dd><p>Returns/assigns the y value of the vector.</p>
- </dd>
- <dt><strong>.z</strong><span class="classifier">float</span></dt><dd><p>Returns/assigns the z value of the vector.</p>
- </dd>
- <dt><strong>set_x</strong> (v, x)</dt><dd><p>Sets the value of the x value of the vector.</p>
- </dd>
- <dt><strong>set_y</strong> (v, y)</dt><dd><p>Sets the value of the y value of the vector.</p>
- </dd>
- <dt><strong>set_z</strong> (v, z)</dt><dd><p>Sets the value of the z value of the vector.</p>
- </dd>
- <dt><strong>elements</strong> (v)<span class="classifier">float, float, float</span></dt><dd><p>Returns the x, y and z elements of the vector.</p>
- </dd>
- <dt><strong>add</strong> (a, b)<span class="classifier">Vector3</span></dt><dd><p>Adds the vector <em>a</em> to <em>b</em> and returns the result.</p>
- </dd>
- <dt><strong>subtract</strong> (a, b)<span class="classifier">Vector3</span></dt><dd><p>Subtracts the vector <em>b</em> from <em>a</em> and returns the result.</p>
- </dd>
- <dt><strong>multiply</strong> (a, k)<span class="classifier">Vector3</span></dt><dd><p>Multiplies the vector <em>a</em> by the scalar <em>k</em> and returns the result.</p>
- </dd>
- <dt><strong>dot</strong> (a, b)<span class="classifier">float</span></dt><dd><p>Returns the dot product between the vectors <em>a</em> and <em>b</em>.</p>
- </dd>
- <dt><strong>cross</strong> (a, b)<span class="classifier">Vector3</span></dt><dd><p>Returns the cross product between the vectors <em>a</em> and <em>b</em>.</p>
- </dd>
- <dt><strong>equal</strong> (a, b)<span class="classifier">bool</span></dt><dd><p>Returns true whether the vectors <em>a</em> and <em>b</em> are equal.</p>
- </dd>
- <dt><strong>length</strong> (a)<span class="classifier">float</span></dt><dd><p>Returns the length of <em>a</em>.</p>
- </dd>
- <dt><strong>length_squared</strong> (a)<span class="classifier">float</span></dt><dd><p>Returns the squared length of <em>a</em>.</p>
- </dd>
- <dt><strong>set_length</strong> (a, len)</dt><dd><p>Sets the length of <em>a</em> to <em>len</em>.</p>
- </dd>
- <dt><strong>normalize</strong> (a)<span class="classifier">Vector3</span></dt><dd><p>Normalizes <em>a</em> and returns the result.</p>
- </dd>
- <dt><strong>distance</strong> (a, b)<span class="classifier">float</span></dt><dd><p>Returns the distance between the points <em>a</em> and <em>b</em>.</p>
- </dd>
- <dt><strong>distance_squared</strong> (a, b)<span class="classifier">float</span></dt><dd><p>Returns the squared distance between the points <em>a</em> and <em>b</em>.</p>
- </dd>
- <dt><strong>angle</strong> (a, b)<span class="classifier">float</span></dt><dd><p>Returns the angle between the vectors <em>a</em> and <em>b</em>.</p>
- </dd>
- <dt><strong>max</strong> (a, b)<span class="classifier">Vector3</span></dt><dd><p>Returns a vector that contains the largest value for each element from <em>a</em> and <em>b</em>.</p>
- </dd>
- <dt><strong>min</strong> (a, b)<span class="classifier">Vector3</span></dt><dd><p>Returns a vector that contains the smallest value for each element from <em>a</em> and <em>b</em>.</p>
- </dd>
- <dt><strong>lerp</strong> (a, b, t)<span class="classifier">Vector3</span></dt><dd><p>Returns the linearly interpolated vector between <em>a</em> and <em>b</em> at time <em>t</em> in [0, 1].</p>
- </dd>
- </dl>
- <div class="line-block">
- <div class="line"><strong>forward</strong> () : Vector3</div>
- <div class="line"><strong>backward</strong> () : Vector3</div>
- <div class="line"><strong>left</strong> () : Vector3</div>
- <div class="line"><strong>right</strong> () : Vector3</div>
- <div class="line"><strong>up</strong> () : Vector3</div>
- <div class="line"><strong>down</strong> () : Vector3</div>
- <div class="line-block">
- <div class="line">Returns the corresponding semantic axis.</div>
- </div>
- </div>
- <dl class="simple">
- <dt><strong>zero</strong> ()<span class="classifier">Vector3</span></dt><dd><p>Returns a vector with all values set to zero.</p>
- </dd>
- <dt><strong>to_string</strong> (v)<span class="classifier">string</span></dt><dd><p>Returns a string representing the vector <em>v</em>.</p>
- </dd>
- </dl>
- </section>
- </section>
- <section id="vector3box">
- <h3>Vector3Box<a class="headerlink" href="#vector3box" title="Permalink to this headline">¶</a></h3>
- <section id="id1">
- <h4>Constructors<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h4>
- <dl class="simple">
- <dt><strong>Vector3Box</strong> ()<span class="classifier">Vector3Box</span></dt><dd><p>Returns a new Vector3Box initialized with the zero vector.</p>
- </dd>
- <dt><strong>Vector3Box</strong> (v)<span class="classifier">Vector3Box</span></dt><dd><p>Returns a new Vector3Box from the Vector3 <em>v</em>.</p>
- </dd>
- <dt><strong>Vector3Box</strong> (x, y, z)<span class="classifier">Vector3Box</span></dt><dd><p>Returns a new Vector3Box from individual elements.</p>
- </dd>
- </dl>
- </section>
- <section id="id2">
- <h4>Functions<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h4>
- <dl class="simple">
- <dt><strong>store</strong> (v)</dt><dd><p>Stores the Vector3 <em>v</em> in the box.</p>
- </dd>
- <dt><strong>store</strong> (x, y, z)</dt><dd><p>Stores Vector3(x, y, z) in the box.</p>
- </dd>
- <dt><strong>unbox</strong> ()<span class="classifier">Vector3</span></dt><dd><p>Returns the stored vector from the box.</p>
- </dd>
- </dl>
- </section>
- </section>
- <section id="quaternion">
- <h3>Quaternion<a class="headerlink" href="#quaternion" title="Permalink to this headline">¶</a></h3>
- <section id="id3">
- <h4>Constructors<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h4>
- <dl class="simple">
- <dt><strong>Quaternion</strong> (axis, angle)<span class="classifier">Quaternion</span></dt><dd><p>Returns a new quaternion from <em>axis</em> and <em>angle</em>.</p>
- </dd>
- <dt><strong>from_elements</strong> (x, y, z, w)<span class="classifier">Quaternion</span></dt><dd><p>Returns a new quaternion from individual elements.</p>
- </dd>
- <dt><strong>from_axis_angle</strong> (axis, angle)<span class="classifier">Quaternion</span></dt><dd><p>Returns a new quaternion from <em>axis</em> and <em>angle</em>.</p>
- </dd>
- </dl>
- </section>
- <section id="id4">
- <h4>Functions<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h4>
- <dl class="simple">
- <dt><strong>negate</strong> (q)<span class="classifier">Quaternion</span></dt><dd><p>Negates the quaternion <em>q</em> and returns the result.</p>
- </dd>
- <dt><strong>identity</strong> ()<span class="classifier">Quaternion</span></dt><dd><p>Returns the identity quaternion.</p>
- </dd>
- <dt><strong>multiply</strong> (a, b)<span class="classifier">Quaternion</span></dt><dd><p>Multiplies the quaternions <em>a</em> and <em>b</em>. (i.e. rotates first by <em>a</em> then by <em>b</em>).</p>
- </dd>
- <dt><strong>multiply_by_scalar</strong> (a, k)<span class="classifier">Quaternion</span></dt><dd><p>Multiplies the quaternion <em>a</em> by the scalar <em>k</em>.</p>
- </dd>
- <dt><strong>dot</strong> (a, b)<span class="classifier">float</span></dt><dd><p>Returns the dot product between quaternions <em>a</em> and <em>b</em>.</p>
- </dd>
- <dt><strong>length</strong> (q)<span class="classifier">float</span></dt><dd><p>Returns the length of <em>q</em>.</p>
- </dd>
- <dt><strong>normalize</strong> (q)<span class="classifier">Quaternion</span></dt><dd><p>Normalizes the quaternion <em>q</em> and returns the result.</p>
- </dd>
- <dt><strong>conjugate</strong> (q)<span class="classifier">Quaternion</span></dt><dd><p>Returns the conjugate of quaternion <em>q</em>.</p>
- </dd>
- <dt><strong>inverse</strong> (q)<span class="classifier">Quaternion</span></dt><dd><p>Returns the inverse of quaternion <em>q</em>.</p>
- </dd>
- <dt><strong>power</strong> (q, exp)<span class="classifier">Quaternion</span></dt><dd><p>Returns the quaternion <em>q</em> raised to the power of <em>exp</em>.</p>
- </dd>
- <dt><strong>elements</strong> (q)<span class="classifier">float, float, float, float</span></dt><dd><p>Returns the x, y, z and w elements of the quaternion.</p>
- </dd>
- <dt><strong>look</strong> (dir, [up])<span class="classifier">Quaternion</span></dt><dd><p>Returns the quaternion describing the rotation needed to face towards <em>dir</em>.
- If <em>up</em> is not specified, Vector3.up() is used.</p>
- </dd>
- <dt><strong>right</strong> (q)<span class="classifier">Vector3</span></dt><dd><p>Returns the right axis of the rotation described by <em>q</em>.</p>
- </dd>
- <dt><strong>up</strong> (q)<span class="classifier">Vector3</span></dt><dd><p>Returns the up axis of the rotation described by <em>q</em>.</p>
- </dd>
- <dt><strong>forward</strong> (q)<span class="classifier">Vector3</span></dt><dd><p>Returns the forward axis of the rotation described by <em>q</em>.</p>
- </dd>
- <dt><strong>lerp</strong> (a, b, t)<span class="classifier">Quaternion</span></dt><dd><p>Returns the linearly interpolated quaternion between <em>a</em> and <em>b</em> at time <em>t</em> in [0, 1].
- It uses NLerp.</p>
- </dd>
- <dt><strong>to_string</strong> (q)<span class="classifier">string</span></dt><dd><p>Returns a string representing the quaternion <em>q</em>.</p>
- </dd>
- </dl>
- </section>
- </section>
- <section id="quaternionbox">
- <h3>QuaternionBox<a class="headerlink" href="#quaternionbox" title="Permalink to this headline">¶</a></h3>
- <section id="id5">
- <h4>Constructors<a class="headerlink" href="#id5" title="Permalink to this headline">¶</a></h4>
- <dl class="simple">
- <dt><strong>QuaternionBox</strong> ()<span class="classifier">QuaternionBox</span></dt><dd><p>Returns a new QuaternionBox initialized with the identity quaternion.</p>
- </dd>
- <dt><strong>QuaternionBox</strong> (q)<span class="classifier">QuaternionBox</span></dt><dd><p>Returns a new QuaternionBox from the Quaternion <em>q</em>.</p>
- </dd>
- <dt><strong>QuaternionBox</strong> (x, y, z, w)<span class="classifier">QuaternionBox</span></dt><dd><p>Returns a new QuaternionBox from individual elements.</p>
- </dd>
- </dl>
- </section>
- <section id="id6">
- <h4>Functions<a class="headerlink" href="#id6" title="Permalink to this headline">¶</a></h4>
- <dl class="simple">
- <dt><strong>store</strong> (q)</dt><dd><p>Stores the Quaternion <em>q</em> in the box.</p>
- </dd>
- <dt><strong>store</strong> (x, y, z, w)</dt><dd><p>Stores Quaternion(x, y, z, w) in the box.</p>
- </dd>
- <dt><strong>unbox</strong> ()<span class="classifier">Quaternion</span></dt><dd><p>Returns the stored quaternion from the box.</p>
- </dd>
- </dl>
- </section>
- </section>
- <section id="matrix4x4">
- <h3>Matrix4x4<a class="headerlink" href="#matrix4x4" title="Permalink to this headline">¶</a></h3>
- <section id="id7">
- <h4>Constructors<a class="headerlink" href="#id7" title="Permalink to this headline">¶</a></h4>
- <dl class="simple">
- <dt><strong>Matrix4x4</strong> (xx, xy, xz, xw, yx, yy, yz, yw, zx, zy, zz, zw, tx, ty, tz, tw)<span class="classifier">Matrix4x4</span></dt><dd><p>Returns a new matrix from individual elements.</p>
- </dd>
- <dt><strong>from_quaternion</strong> (q)<span class="classifier">Matrix4x4</span></dt><dd><p>Returns a new matrix from <em>q</em>.</p>
- </dd>
- <dt><strong>from_translation</strong> (t)<span class="classifier">Matrix4x4</span></dt><dd><p>Returns a new matrix from <em>t</em>.</p>
- </dd>
- <dt><strong>from_quaternion_translation</strong> (q, t)<span class="classifier">Matrix4x4</span></dt><dd><p>Returns a new matrix from <em>q</em> and <em>t</em>.</p>
- </dd>
- <dt><strong>from_axes</strong> (x, y, z, t)<span class="classifier">Matrix4x4</span></dt><dd><p>Returns a new matrix from <em>x</em>, <em>y</em>, <em>z</em> and <em>t</em>.</p>
- </dd>
- </dl>
- </section>
- <section id="id8">
- <h4>Functions<a class="headerlink" href="#id8" title="Permalink to this headline">¶</a></h4>
- <dl class="simple">
- <dt><strong>copy</strong> (m)<span class="classifier">Matrix4x4</span></dt><dd><p>Returns a copy of the matrix <em>m</em>.</p>
- </dd>
- <dt><strong>add</strong> (a, b)<span class="classifier">Matrix4x4</span></dt><dd><p>Adds the matrix <em>a</em> to <em>b</em> and returns the result.</p>
- </dd>
- <dt><strong>subtract</strong> (a, b)<span class="classifier">Matrix4x4</span></dt><dd><p>Subtracts the matrix <em>b</em> from <em>a</em> and returns the result.</p>
- </dd>
- <dt><strong>multiply</strong> (a, b)<span class="classifier">Matrix4x4</span></dt><dd><p>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>)</p>
- </dd>
- <dt><strong>equal</strong> (a, b)<span class="classifier">bool</span></dt><dd><p>Returns true whether the matrices <em>a</em> and <em>b</em> are equal.</p>
- </dd>
- <dt><strong>transpose</strong> (m)<span class="classifier">Matrix4x4</span></dt><dd><p>Transposes the matrix <em>m</em> and returns the result.</p>
- </dd>
- <dt><strong>invert</strong> (m)<span class="classifier">Matrix4x4</span></dt><dd><p>Inverts the matrix <em>m</em> and returns the result.</p>
- </dd>
- <dt><strong>x</strong> (m)<span class="classifier">Vector3</span></dt><dd><p>Returns the x axis of the matrix <em>m</em>.</p>
- </dd>
- <dt><strong>y</strong> (m)<span class="classifier">Vector3</span></dt><dd><p>Returns the y axis of the matrix <em>m</em>.</p>
- </dd>
- <dt><strong>z</strong> (m)<span class="classifier">Vector3</span></dt><dd><p>Returns the z axis of the matrix <em>m</em>.</p>
- </dd>
- <dt><strong>set_x</strong> (m, x)</dt><dd><p>Sets the x axis of the matrix <em>m</em>.</p>
- </dd>
- <dt><strong>set_y</strong> (m, y)</dt><dd><p>Sets the y axis of the matrix <em>m</em>.</p>
- </dd>
- <dt><strong>set_z</strong> (m, z)</dt><dd><p>Sets the z axis of the matrix <em>m</em>.</p>
- </dd>
- <dt><strong>translation</strong> (m)<span class="classifier">Vector3</span></dt><dd><p>Returns the translation portion of the matrix <em>m</em>.</p>
- </dd>
- <dt><strong>set_translation</strong> (m, t)</dt><dd><p>Sets the translation portion of the matrix <em>m</em>.</p>
- </dd>
- <dt><strong>rotation</strong> (m)<span class="classifier">Quaternion</span></dt><dd><p>Returns the rotation portion of the matrix <em>m</em>.</p>
- </dd>
- <dt><strong>set_rotation</strong> (m, r)</dt><dd><p>Sets the rotation portion of the matrix <em>m</em>.</p>
- </dd>
- <dt><strong>scale</strong> (m)<span class="classifier">Vector3</span></dt><dd><p>Returns the scale of the matrix <em>m</em>.</p>
- </dd>
- <dt><strong>set_scale</strong> (m, r)</dt><dd><p>Sets the scale of the matrix <em>m</em>.</p>
- </dd>
- <dt><strong>identity</strong> ()</dt><dd><p>Returns the identity matrix.</p>
- </dd>
- <dt><strong>transform</strong> (m, v)<span class="classifier">Vector3</span></dt><dd><p>Transforms the vector <em>v</em> by the matrix <em>m</em> and returns the result.</p>
- </dd>
- <dt><strong>to_string</strong> (m)<span class="classifier">string</span></dt><dd><p>Returns a string representing the matrix <em>m</em>.</p>
- </dd>
- </dl>
- </section>
- </section>
- <section id="matrix4x4box">
- <h3>Matrix4x4Box<a class="headerlink" href="#matrix4x4box" title="Permalink to this headline">¶</a></h3>
- <section id="id9">
- <h4>Constructors<a class="headerlink" href="#id9" title="Permalink to this headline">¶</a></h4>
- <dl class="simple">
- <dt><strong>Matrix4x4Box</strong> ()<span class="classifier">Matrix4x4Box</span></dt><dd><p>Returns a new Matrix4x4Box initialized with the identity matrix.</p>
- </dd>
- <dt><strong>Matrix4x4Box</strong> (m)<span class="classifier">Matrix4x4Box</span></dt><dd><p>Returns a new Matrix4x4Box from the Matrix4x4 <em>m</em>.</p>
- </dd>
- </dl>
- </section>
- <section id="id10">
- <h4>Functions<a class="headerlink" href="#id10" title="Permalink to this headline">¶</a></h4>
- <dl class="simple">
- <dt><strong>store</strong> (m)</dt><dd><p>Stores the Matrix4x4 <em>m</em> in the box.</p>
- </dd>
- <dt><strong>unbox</strong> ()<span class="classifier">Matrix4x4</span></dt><dd><p>Returns the stored matrix from the box.</p>
- </dd>
- </dl>
- </section>
- </section>
- <section id="color4">
- <h3>Color4<a class="headerlink" href="#color4" title="Permalink to this headline">¶</a></h3>
- <section id="id11">
- <h4>Constructors<a class="headerlink" href="#id11" title="Permalink to this headline">¶</a></h4>
- <dl class="simple">
- <dt><strong>Color4</strong> (r, g, b, a)<span class="classifier">Color4</span></dt><dd><p>Returns a new Color4 from individual elements.</p>
- </dd>
- </dl>
- </section>
- <section id="id12">
- <h4>Functions<a class="headerlink" href="#id12" title="Permalink to this headline">¶</a></h4>
- <dl class="simple">
- <dt><strong>lerp</strong> (a, b, t)<span class="classifier">Color4</span></dt><dd><p>Returns the linearly interpolated color between <em>a</em> and <em>b</em> at time <em>t</em> in [0, 1].</p>
- </dd>
- </dl>
- <div class="line-block">
- <div class="line"><strong>black</strong> () : Color4</div>
- <div class="line"><strong>white</strong> () : Color4</div>
- <div class="line"><strong>red</strong> () : Color4</div>
- <div class="line"><strong>green</strong> () : Color4</div>
- <div class="line"><strong>blue</strong> () : Color4</div>
- <div class="line"><strong>yellow</strong> () : Color4</div>
- <div class="line"><strong>orange</strong> () : Color4</div>
- <div class="line-block">
- <div class="line">Returns the corresponding mnemonic color.</div>
- </div>
- </div>
- <dl class="simple">
- <dt><strong>to_string</strong> (c)<span class="classifier">string</span></dt><dd><p>Returns a string representing the color <em>c</em>.</p>
- </dd>
- </dl>
- </section>
- </section>
- <section id="id13">
- <h3>Math<a class="headerlink" href="#id13" title="Permalink to this headline">¶</a></h3>
- <dl class="simple">
- <dt><strong>ray_plane_intersection</strong> (from, dir, point, normal)<span class="classifier">float</span></dt><dd><p>Returns the distance along ray (from, dir) to intersection point with plane defined by
- <em>point</em> and <em>normal</em> or -1.0 if no intersection.</p>
- </dd>
- <dt><strong>ray_disc_intersection</strong> (from, dir, center, radius, normal)<span class="classifier">float</span></dt><dd><p>Returns the distance along ray (from, dir) to intersection point with disc defined by
- <em>center</em>, <em>radius</em> and <em>normal</em> or -1.0 if no intersection.</p>
- </dd>
- <dt><strong>ray_sphere_intersection</strong> (from, dir, center, radius)<span class="classifier">float</span></dt><dd><p>Returns the distance along ray (from, dir) to intersection point with sphere defined by
- <em>center</em> and <em>radius</em> or -1.0 if no intersection.</p>
- </dd>
- <dt><strong>ray_obb_intersection</strong> (from, dir, tm, half_extents)<span class="classifier">float</span></dt><dd><p>Returns the distance along ray (from, dir) to intersection point with the oriented
- bounding box (tm, half_extents) or -1.0 if no intersection.</p>
- </dd>
- <dt><strong>ray_triangle_intersection</strong> (from, dir, v0, v1, v2)<span class="classifier">float</span></dt><dd><p>Returns the distance along ray (from, dir) to intersection point with the triangle
- (v0, v1, v2) or -1.0 if no intersection.</p>
- </dd>
- <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">bool</span></dt><dd><p>Returns whether the oriented bounding box (obb_tm, obb_half_extents) intersects
- the frustum defined by the planes ((n0, d0), (n1, d1), …, (n5, d5)). The
- planes be given in BRTLNF order, where B = bottom plane, R = right plane etc.</p>
- </dd>
- <dt><strong>obb_vertices</strong> (obb_tm, obb_half_extents)<span class="classifier">v0, v1, v2, v3, v4, v5, v6, v7</span></dt><dd><p>Returns the vertices of the oriented bounding box (obb_tm, obb_half_extents).</p>
- </dd>
- <dt><strong>obb_merge</strong> (a_tm, a_half_extents, b_tm, b_half_extents, …)<span class="classifier">Matrix4x4, Vector3</span></dt><dd><p>Returns a new box which encloses both the box A (a_tm, a_half_extents) and B
- (b_tm, b_half_extents) and any number of boxes after B.
- Note that the returned OBB will have the same orientation as A and won’t
- necessarily be the smallest enclosing box.</p>
- </dd>
- </dl>
- </section>
- </section>
- <section id="physicsworld">
- <h2>PhysicsWorld<a class="headerlink" href="#physicsworld" title="Permalink to this headline">¶</a></h2>
- <dl class="simple">
- <dt><strong>gravity</strong> (pw)<span class="classifier">Vector3</span></dt><dd><p>Returns the gravity.</p>
- </dd>
- <dt><strong>set_gravity</strong> (pw, gravity)</dt><dd><p>Sets the gravity.</p>
- </dd>
- <dt><strong>cast_ray</strong> (pw, from, dir, length)<span class="classifier">hit, collision_pos, normal, time, UnitId, Actor</span></dt><dd><p>Casts a ray into the physics world and returns the closest actor it intersects with.
- If <em>hit</em> is true the following return values contain the <em>collision_pos</em> in
- world space, the <em>normal</em> of the surface that was hit, the time of impact
- in [0..1] and the <em>unit</em> and the <em>actor</em> that was hit.</p>
- </dd>
- <dt><strong>cast_ray_all</strong> (pw, from, dir, length)<span class="classifier">table</span></dt><dd><p>Casts a ray into the physics world and returns all the
- actors it intersects with as an array of <a class="reference internal" href="#raycasthit">RaycastHit</a> tables.</p>
- </dd>
- <dt><strong>cast_sphere</strong> (pw, from, radius, dir, length)<span class="classifier">hit, collision_pos, normal, time, UnitId, Actor</span></dt><dd><p>Casts a sphere into the physics world and returns the closest actor it intersects with.
- If <em>hit</em> is true the following return values contain the <em>collision_pos</em> in
- world space, the <em>normal</em> of the surface that was hit, the time of impact
- in [0..1] and the <em>unit</em> and the <em>actor</em> that was hit.</p>
- </dd>
- <dt><strong>cast_box</strong> (pw, from, half_extents, dir, length)<span class="classifier">hit, collision_pos, normal, time, UnitId, Actor</span></dt><dd><p>Casts a box into the physics world and returns the closest actor it intersects with.
- If <em>hit</em> is true the following return values contain the <em>collision_pos</em> in
- world space, the <em>normal</em> of the surface that was hit, the time of impact
- in [0..1] and the <em>unit</em> and the <em>actor</em> that was hit.</p>
- </dd>
- <dt><strong>enable_debug_drawing</strong> (pw, enable)</dt><dd><p>Sets whether to <em>enable</em> debug drawing.</p>
- </dd>
- </dl>
- <section id="raycasthit">
- <h3>RaycastHit<a class="headerlink" href="#raycasthit" title="Permalink to this headline">¶</a></h3>
- <p>RaycastHit is a lua table with 5 fields:</p>
- <ul class="simple">
- <li><p><code class="docutils literal notranslate"><span class="pre">[1]</span></code>: The collision position in world space.</p></li>
- <li><p><code class="docutils literal notranslate"><span class="pre">[2]</span></code>: The normal of the surface that was hit.</p></li>
- <li><p><code class="docutils literal notranslate"><span class="pre">[3]</span></code>: The time of impact in [0..1].</p></li>
- <li><p><code class="docutils literal notranslate"><span class="pre">[4]</span></code>: The unit that was hit.</p></li>
- <li><p><code class="docutils literal notranslate"><span class="pre">[5]</span></code>: The actor that was hit.</p></li>
- </ul>
- </section>
- <section id="actor">
- <h3>Actor<a class="headerlink" href="#actor" title="Permalink to this headline">¶</a></h3>
- <dl>
- <dt><strong>actor_destroy</strong> (pw, actor)</dt><dd><p>Destroys the <em>actor</em> instance.</p>
- </dd>
- <dt><strong>actor_instance</strong> (pw, unit)<span class="classifier">Id</span></dt><dd><p>Returns the ID of the actor owned by the <em>unit</em>, or <code class="docutils literal notranslate"><span class="pre">nil</span></code>.</p>
- </dd>
- <dt><strong>actor_world_position</strong> (pw, actor)<span class="classifier">Vector3</span></dt><dd><p>Returns the world position of the <em>actor</em>.</p>
- </dd>
- <dt><strong>actor_world_rotation</strong> (pw, actor)<span class="classifier">Quaternion</span></dt><dd><p>Returns the world rotation of the <em>actor</em>.</p>
- </dd>
- <dt><strong>actor_world_pose</strong> (pw, actor)<span class="classifier">Matrix4x4</span></dt><dd><p>Returns the world pose of the <em>actor</em>.</p>
- </dd>
- <dt><strong>actor_teleport_world_position</strong> (pw, actor, position)</dt><dd><p>Teleports the <em>actor</em> to the given world <em>position</em>.</p>
- </dd>
- <dt><strong>actor_teleport_world_rotation</strong> (pw, actor, rotation)</dt><dd><p>Teleports the <em>actor</em> to the given world <em>rotation</em>.</p>
- </dd>
- <dt><strong>actor_teleport_world_pose</strong> (pw, actor, pose)</dt><dd><p>Teleports the <em>actor</em> to the given world <em>pose</em>.</p>
- </dd>
- <dt><strong>actor_center_of_mass</strong> (pw, actor)<span class="classifier">Vector3</span></dt><dd><p>Returns the center of mass of the <em>actor</em>.</p>
- </dd>
- <dt><strong>actor_enable_gravity</strong> (pw, actor)</dt><dd><p>Enables gravity for the <em>actor</em>.</p>
- </dd>
- <dt><strong>actor_disable_gravity</strong> (pw, actor)</dt><dd><p>Disables gravity for the <em>actor</em>.</p>
- </dd>
- <dt><strong>actor_enable_collision</strong> (pw, actor)</dt><dd><p>Enables collision detection for the <em>actor</em>.</p>
- </dd>
- <dt><strong>actor_disable_collision</strong> (pw, actor)</dt><dd><p>Disables collision detection for the <em>actor</em>.</p>
- </dd>
- <dt><strong>actor_set_collision_filter</strong> (pw, actor, name)</dt><dd><p>Sets the collision filter of the <em>actor</em>.</p>
- </dd>
- <dt><strong>actor_set_kinematic</strong> (pw, actor, kinematic)</dt><dd><p>Sets whether the <em>actor</em> is <em>kinematic</em> or not.</p>
- <div class="admonition note">
- <p class="admonition-title">Note</p>
- <p>This call has no effect on static actors.</p>
- </div>
- </dd>
- <dt><strong>actor_is_static</strong> (pw, actor)<span class="classifier">bool</span></dt><dd><p>Returns whether the <em>actor</em> is static.</p>
- </dd>
- <dt><strong>actor_is_dynamic</strong> (pw, actor) bool</dt><dd><p>Returns whether the <em>actor</em> is dynamic.</p>
- </dd>
- <dt><strong>actor_is_kinematic</strong> (pw, actor)<span class="classifier">bool</span></dt><dd><p>Returns whether the <em>actor</em> is kinematic (keyframed).</p>
- </dd>
- <dt><strong>actor_is_nonkinematic</strong> (pw, actor)<span class="classifier">bool</span></dt><dd><p>Returns whether the <em>actor</em> is nonkinematic (i.e. dynamic and not kinematic).</p>
- </dd>
- <dt><strong>actor_linear_damping</strong> (pw, actor)<span class="classifier">float</span></dt><dd><p>Returns the linear damping of the <em>actor</em>.</p>
- </dd>
- <dt><strong>actor_set_linear_damping</strong> (pw, actor, damping)</dt><dd><p>Sets the linear <em>damping</em> of the <em>actor</em>.</p>
- </dd>
- <dt><strong>actor_angular_damping</strong> (pw, actor)<span class="classifier">float</span></dt><dd><p>Returns the angular damping rate of the <em>actor</em>.</p>
- </dd>
- <dt><strong>actor_set_angular_damping</strong> (pw, actor, rate)</dt><dd><p>Sets the angular damping <em>rate</em> of the <em>actor</em>.</p>
- </dd>
- <dt><strong>actor_linear_velocity</strong> (pw, actor)<span class="classifier">Vector3</span></dt><dd><p>Returns the linear velocity of the <em>actor</em>.</p>
- </dd>
- <dt><strong>actor_set_linear_velocity</strong> (pw, actor, velocity)</dt><dd><p>Sets the linear <em>velocity</em> of the <em>actor</em>.</p>
- <div class="admonition note">
- <p class="admonition-title">Note</p>
- <p>This call only affects nonkinematic actors.</p>
- </div>
- </dd>
- <dt><strong>actor_angular_velocity</strong> (pw, actor)<span class="classifier">Vector3</span></dt><dd><p>Returns the angular velocity of the <em>actor</em>.</p>
- </dd>
- <dt><strong>actor_set_angular_velocity</strong> (pw, actor, velocity)</dt><dd><p>Sets the angular <em>velocity</em> of the <em>actor</em>.</p>
- <div class="admonition note">
- <p class="admonition-title">Note</p>
- <p>This call only affects nonkinematic actors.</p>
- </div>
- </dd>
- <dt><strong>actor_add_impulse</strong> (pw, actor, impulse)</dt><dd><p>Adds a linear <em>impulse</em> (acting along the center of mass) to the <em>actor</em>.</p>
- <div class="admonition note">
- <p class="admonition-title">Note</p>
- <p>This call only affects nonkinematic actors.</p>
- </div>
- </dd>
- <dt><strong>actor_add_impulse_at</strong> (pw, actor, impulse, position)</dt><dd><p>Adds a linear <em>impulse</em> (acting along the world position <em>pos</em>) to the <em>actor</em>.</p>
- <div class="admonition note">
- <p class="admonition-title">Note</p>
- <p>This call only affects nonkinematic actors.</p>
- </div>
- </dd>
- <dt><strong>actor_add_torque_impulse</strong> (pw, actor, impulse)</dt><dd><p>Adds a torque <em>impulse</em> to the <em>actor</em>.</p>
- </dd>
- <dt><strong>actor_push</strong> (pw, actor, velocity, mass)</dt><dd><p>Pushes the <em>actor</em> as if it was hit by a point object with the given <em>mass</em>
- travelling at the given <em>velocity</em>.</p>
- <div class="admonition note">
- <p class="admonition-title">Note</p>
- <p>This call only affects nonkinematic actors.</p>
- </div>
- </dd>
- <dt><strong>actor_push_at</strong> (pw, actor, velocity, mass, position)</dt><dd><p>Like push() but applies the force at the world <em>position</em>.</p>
- <div class="admonition note">
- <p class="admonition-title">Note</p>
- <p>This call only affects nonkinematic actors.</p>
- </div>
- </dd>
- <dt><strong>actor_is_sleeping</strong> (pw, actor)<span class="classifier">bool</span></dt><dd><p>Returns whether the <em>actor</em> is sleeping.</p>
- </dd>
- <dt><strong>actor_wake_up</strong> (pw, actor)</dt><dd><p>Wakes the <em>actor</em> up.</p>
- </dd>
- <dt><strong>actor_debug_draw</strong> (pw, actor, debug_line [, color])</dt><dd><p>Adds the <em>actor</em>’s debug geometry to <em>lines</em>.</p>
- </dd>
- </dl>
- </section>
- <section id="mover">
- <h3>Mover<a class="headerlink" href="#mover" title="Permalink to this headline">¶</a></h3>
- <dl class="simple">
- <dt><strong>mover_create</strong> (pw, unit, height, radius, max_slope_angle, collision_filter)<span class="classifier">Id</span></dt><dd><p>Creates a new mover instance for the <em>unit</em>.</p>
- </dd>
- <dt><strong>mover_destroy</strong> (pw, mover)</dt><dd><p>Destroys the <em>mover</em>.</p>
- </dd>
- <dt><strong>mover</strong> (pw, unit)<span class="classifier">Id</span></dt><dd><p>Returns the ID of the mover owned by the <em>unit</em>.</p>
- </dd>
- <dt><strong>mover_set_height</strong> (pw, mover, height)</dt><dd><p>Sets the <em>height</em> of the <em>mover</em> capsule.</p>
- </dd>
- <dt><strong>mover_radius</strong> (pw, mover)<span class="classifier">number</span></dt><dd><p>Returns the radius of the <em>mover</em> capsule.</p>
- </dd>
- <dt><strong>mover_set_radius</strong> (pw, mover, radius)</dt><dd><p>Sets the <em>radius</em> of the <em>mover</em> capsule.</p>
- </dd>
- <dt><strong>mover_max_slope_angle</strong> (pw, mover)<span class="classifier">number</span></dt><dd><p>Returns the max slope angle of the <em>mover</em>.</p>
- </dd>
- <dt><strong>mover_set_max_slope_angle</strong> (pw, mover, angle)</dt><dd><p>Sets the max slope <em>angle</em> of the <em>mover</em>.</p>
- </dd>
- <dt><strong>mover_set_collision_filter</strong> (pw, mover, filter)</dt><dd><p>Sets the collision <em>filter</em> of the <em>mover</em>.</p>
- </dd>
- <dt><strong>mover_position</strong> (pw, mover)<span class="classifier">Vector3</span></dt><dd><p>Returns the position of the <em>mover</em>.</p>
- </dd>
- <dt><strong>mover_set_position</strong> (pw, mover, position)</dt><dd><p>Teleports the <em>mover</em> to the specified <em>position</em>.</p>
- </dd>
- <dt><strong>mover_center</strong> (pw, mover)<span class="classifier">Vector3</span></dt><dd><p>Returns the center of the <em>mover</em> relative to the transform’s position.</p>
- </dd>
- <dt><strong>mover_set_center</strong> (pw, mover, center)</dt><dd><p>Sets the center of the <em>mover</em> relative to the transform’s position.</p>
- </dd>
- <dt><strong>mover_move</strong> (pw, mover, delta)</dt><dd><p>Attempts to move the <em>mover</em> by the specified <em>delta</em> vector.
- The <em>mover</em> will slide against physical actors.</p>
- </dd>
- <dt><strong>mover_collides_sides</strong> (pw, mover)<span class="classifier">bool</span></dt><dd><p>Returns whether the <em>mover</em> collides sideways.</p>
- </dd>
- <dt><strong>mover_collides_up</strong> (pw, mover)<span class="classifier">bool</span></dt><dd><p>Returns whether the <em>mover</em> collides upwards.</p>
- </dd>
- <dt><strong>mover_collides_down</strong> (pw, mover)<span class="classifier">bool</span></dt><dd><p>Returns whether the <em>mover</em> collides downwards.</p>
- </dd>
- <dt><strong>mover_debug_draw</strong> (pw, mover, debug_line [, color])</dt><dd><p>Adds the <em>mover</em>’s debug geometry to <em>lines</em>.</p>
- </dd>
- </dl>
- </section>
- </section>
- <section id="profiler">
- <h2>Profiler<a class="headerlink" href="#profiler" title="Permalink to this headline">¶</a></h2>
- <dl class="simple">
- <dt><strong>enter_scope</strong> (name)</dt><dd><p>Starts a new profile scope with the given <em>name</em>.</p>
- </dd>
- <dt><strong>leave_scope</strong> ()</dt><dd><p>Ends the last profile scope.</p>
- </dd>
- <dt><strong>record</strong> (name, value)</dt><dd><p>Records <em>value</em> with the given <em>name</em>. Value can be either number or Vector3.</p>
- </dd>
- </dl>
- </section>
- <section id="renderworld">
- <h2>RenderWorld<a class="headerlink" href="#renderworld" title="Permalink to this headline">¶</a></h2>
- <dl class="simple">
- <dt><strong>enable_debug_drawing</strong> (rw, enable)</dt><dd><p>Sets whether to <em>enable</em> debug drawing.</p>
- </dd>
- </dl>
- <section id="mesh">
- <h3>Mesh<a class="headerlink" href="#mesh" title="Permalink to this headline">¶</a></h3>
- <dl class="simple">
- <dt><strong>mesh_create</strong> (rw, unit, mesh_resource, geometry_name, material_resource, visible)<span class="classifier">Id</span></dt><dd><p>Creates a new mesh instance for <em>unit</em> and returns its id.</p>
- </dd>
- <dt><strong>mesh_destroy</strong> (rw, mesh)</dt><dd><p>Destroys the <em>mesh</em> instance.</p>
- </dd>
- <dt><strong>mesh_instance</strong> (rw, unit)<span class="classifier">Id</span></dt><dd><p>Returns the ID of the mesh owned by the <em>unit</em>, or <code class="docutils literal notranslate"><span class="pre">nil</span></code>.</p>
- </dd>
- <dt><strong>mesh_material</strong> (rw, mesh)<span class="classifier">Material</span></dt><dd><p>Returns the material of the <em>mesh</em>.</p>
- </dd>
- <dt><strong>mesh_set_material</strong> (rw, mesh, material)</dt><dd><p>Sets the <em>material</em> of the <em>mesh</em>.</p>
- </dd>
- <dt><strong>mesh_set_visible</strong> (rw, mesh, visible)</dt><dd><p>Sets whether the <em>mesh</em> is <em>visible</em>.</p>
- </dd>
- <dt><strong>mesh_set_cast_shadows</strong> (rw, mesh, cast_shadows)</dt><dd><p>Sets whether the <em>mesh</em> cast shadows.</p>
- </dd>
- <dt><strong>mesh_obb</strong> (rw, mesh)<span class="classifier">Matrix4x4, Vector3</span></dt><dd><p>Returns the Oriented-Bounding-Box of the <em>mesh</em> as (pose, half_extents).</p>
- </dd>
- <dt><strong>mesh_cast_ray</strong> (rw, mesh, from, dir)<span class="classifier">float</span></dt><dd><p>Returns the distance along ray (from, dir) to intersection point with the <em>mesh</em> or -1.0 if no intersection.</p>
- </dd>
- </dl>
- </section>
- <section id="sprite">
- <h3>Sprite<a class="headerlink" href="#sprite" title="Permalink to this headline">¶</a></h3>
- <dl class="simple">
- <dt><strong>sprite_create</strong> (rw, unit, sprite_resource, material_resource, visible)<span class="classifier">Id</span></dt><dd><p>Creates a new sprite instance for the <em>unit</em> and returns its id.</p>
- </dd>
- <dt><strong>sprite_destroy</strong> (rw, sprite)</dt><dd><p>Destroys the <em>sprite</em> instance.</p>
- </dd>
- <dt><strong>sprite_instance</strong> (rw, unit)<span class="classifier">Id</span></dt><dd><p>Returns the ID of the sprite owned by the <em>unit</em>, or <code class="docutils literal notranslate"><span class="pre">nil</span></code>.</p>
- </dd>
- <dt><strong>sprite_material</strong> (rw, sprite)<span class="classifier">Material</span></dt><dd><p>Returns the material of the <em>sprite</em>.</p>
- </dd>
- <dt><strong>sprite_set_material</strong> (rw, sprite, material)</dt><dd><p>Sets the <em>material</em> of the <em>sprite</em>.</p>
- </dd>
- <dt><strong>sprite_set_frame</strong> (rw, sprite, index)</dt><dd><p>Sets the frame <em>index</em> of the <em>sprite</em>.
- The <em>index</em> automatically wraps if it greater than the total number of
- frames in the sprite.</p>
- </dd>
- <dt><strong>sprite_set_visible</strong> (rw, sprite, visible)</dt><dd><p>Sets whether the <em>sprite</em> is <em>visible</em>.</p>
- </dd>
- <dt><strong>sprite_flip_x</strong> (rw, sprite, flip)</dt><dd><p>Sets whether to flip the <em>sprite</em> on the x-axis.</p>
- </dd>
- <dt><strong>sprite_flip_y</strong> (rw, sprite, flip)</dt><dd><p>Sets whether to flip the <em>sprite</em> on the y-axis.</p>
- </dd>
- <dt><strong>sprite_set_layer</strong> (rw, sprite, layer)</dt><dd><p>Sets the rendering <em>layer</em> of the <em>sprite</em>.</p>
- </dd>
- <dt><strong>sprite_set_depth</strong> (rw, sprite, depth)</dt><dd><p>Sets the rendering <em>depth</em> of the <em>sprite</em>.</p>
- </dd>
- <dt><strong>sprite_obb</strong> (rw, sprite)<span class="classifier">Matrix4x4, Vector3</span></dt><dd><p>Returns the Oriented-Bounding-Box of the <em>sprite</em> as (pose, half_extents).</p>
- </dd>
- <dt><strong>sprite_cast_ray</strong> (rw, sprite, from, dir)<span class="classifier">float, int, int</span></dt><dd><p>Returns (t, layer, depth), where <em>t</em> is the distance along ray (from, dir) to
- intersection point with the <em>sprite</em> or -1.0 if no intersection.</p>
- </dd>
- </dl>
- </section>
- <section id="light">
- <h3>Light<a class="headerlink" href="#light" title="Permalink to this headline">¶</a></h3>
- <dl class="simple">
- <dt><strong>light_create</strong> (rw, unit, type, range, intensity, spot_angle, color)<span class="classifier">Id</span></dt><dd><p>Creates a new light for the <em>unit</em> and returns its id.
- 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>.</p>
- </dd>
- <dt><strong>light_destroy</strong> (rw, light)</dt><dd><p>Destroys the <em>light</em> instance.</p>
- </dd>
- <dt><strong>light_instance</strong> (rw, unit)<span class="classifier">Id</span></dt><dd><p>Returns the ID of the light owned by the <em>unit</em>, or <code class="docutils literal notranslate"><span class="pre">nil</span></code>.</p>
- </dd>
- <dt><strong>light_type</strong> (rw, light)<span class="classifier">string</span></dt><dd><p>Returns the type of the <em>light</em>.
- 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>.</p>
- </dd>
- <dt><strong>light_color</strong> (rw, light)<span class="classifier">Color4</span></dt><dd><p>Returns the color of the <em>light</em>.</p>
- </dd>
- <dt><strong>light_range</strong> (rw, light)<span class="classifier">float</span></dt><dd><p>Returns the range of the <em>light</em>.</p>
- </dd>
- <dt><strong>light_intensity</strong> (rw, light)<span class="classifier">float</span></dt><dd><p>Returns the intensity of the <em>light</em>.</p>
- </dd>
- <dt><strong>light_spot_angle</strong> (rw, light)<span class="classifier">float</span></dt><dd><p>Returns the spot angle of the <em>light</em>.</p>
- </dd>
- <dt><strong>light_shadow_bias</strong> (rw, light)<span class="classifier">float</span></dt><dd><p>Returns the shadow bias of the <em>light</em>.</p>
- </dd>
- <dt><strong>light_set_type</strong> (rw, light, type)</dt><dd><p>Sets the <em>type</em> of the <em>light</em>.</p>
- </dd>
- <dt><strong>light_set_color</strong> (rw, light, color)</dt><dd><p>Sets the <em>color</em> of the <em>light</em>.</p>
- </dd>
- <dt><strong>light_set_range</strong> (rw, light, range)</dt><dd><p>Sets the <em>range</em> of the <em>light</em>.</p>
- </dd>
- <dt><strong>light_set_intensity</strong> (rw, light, intensity)</dt><dd><p>Sets the <em>intensity</em> of the <em>light</em>.</p>
- </dd>
- <dt><strong>light_set_spot_angle</strong> (rw, light, angle)</dt><dd><p>Sets the spot <em>angle</em> of the <em>light</em>.</p>
- </dd>
- <dt><strong>light_set_shadow_bias</strong> (rw, light, bias)</dt><dd><p>Sets the shadow <em>bias</em> of the <em>light</em>.</p>
- </dd>
- <dt><strong>light_set_cast_shadows</strong> (rw, light, cast_shadows)</dt><dd><p>Sets whether the <em>light</em> casts shadows.</p>
- </dd>
- <dt><strong>light_debug_draw</strong> (rw, light, debug_line)</dt><dd><p>Fills <em>debug_line</em> with debug lines from the <em>light</em>.</p>
- </dd>
- </dl>
- </section>
- <section id="fog">
- <h3>Fog<a class="headerlink" href="#fog" title="Permalink to this headline">¶</a></h3>
- <dl class="simple">
- <dt><strong>fog_create</strong> (rw, unit)<span class="classifier">Id</span></dt><dd><p>Creates a new fog instance for the <em>unit</em> and returns its id.
- Note that the fog component is limited to one instance per World. Every call
- to this function will overwrite any previously created fog instance.</p>
- </dd>
- <dt><strong>fog_destroy</strong> (rw, fog)</dt><dd><p>Destroys the <em>fog</em> instance.</p>
- </dd>
- <dt><strong>fog_instance</strong> (rw, unit)<span class="classifier">Id</span></dt><dd><p>Returns the ID of the fog owned by the <em>unit</em>, or <code class="docutils literal notranslate"><span class="pre">nil</span></code>.</p>
- </dd>
- <dt><strong>fog_set_color</strong> (rw, fog, color)</dt><dd><p>Sets the <em>color</em> of the <em>fog</em>.</p>
- </dd>
- <dt><strong>fog_set_density</strong> (rw, fog, density)</dt><dd><p>Sets the <em>density</em> of the <em>fog</em>.</p>
- </dd>
- <dt><strong>fog_set_range_min</strong> (rw, fog, range)</dt><dd><p>Sets the minimum <em>range</em> of the <em>fog</em>.</p>
- </dd>
- <dt><strong>fog_set_range_max</strong> (rw, fog, range)</dt><dd><p>Sets the maximum <em>range</em> of the <em>fog</em>.</p>
- </dd>
- <dt><strong>fog_set_sun_blend</strong> (rw, fog, sun_blend)</dt><dd><p>Sets the sun <em>blend</em> of the <em>fog</em>.</p>
- </dd>
- <dt><strong>fog_set_enabled</strong> (rw, fog, enable)</dt><dd><p>Sets whether the <em>fog</em> is <em>enabled</em>.</p>
- </dd>
- </dl>
- </section>
- </section>
- <section id="resourcepackage">
- <h2>ResourcePackage<a class="headerlink" href="#resourcepackage" title="Permalink to this headline">¶</a></h2>
- <dl>
- <dt><strong>load</strong> (package)</dt><dd><p>Loads all the resources in the <em>package</em>.</p>
- <div class="admonition note">
- <p class="admonition-title">Note</p>
- <p>The resources are not immediately available after the call is made,
- instead, you have to poll for completion with has_loaded().</p>
- </div>
- </dd>
- <dt><strong>unload</strong> (package)</dt><dd><p>Unloads all the resources in the <em>package</em>.</p>
- </dd>
- <dt><strong>flush</strong> (package)</dt><dd><p>Waits until the <em>package</em> has been loaded.</p>
- </dd>
- <dt><strong>has_loaded</strong> (package)<span class="classifier">bool</span></dt><dd><p>Returns whether the <em>package</em> has been loaded.</p>
- </dd>
- </dl>
- </section>
- <section id="scenegraph">
- <h2>SceneGraph<a class="headerlink" href="#scenegraph" title="Permalink to this headline">¶</a></h2>
- <dl class="simple">
- <dt><strong>create</strong> (sg, unit, position, rotation, scale)<span class="classifier">Id</span></dt><dd><p>Creates the transform for the <em>unit</em> and returns its ID.</p>
- </dd>
- <dt><strong>destroy</strong> (sg, transform)</dt><dd><p>Destroys the <em>transform</em> instance.</p>
- </dd>
- <dt><strong>instance</strong> (sg, unit)<span class="classifier">Id</span></dt><dd><p>Returns the ID of the transform owned by the <em>unit</em>, or <code class="docutils literal notranslate"><span class="pre">nil</span></code>.</p>
- </dd>
- <dt><strong>owner</strong> (sg, transform)<span class="classifier">UnitId</span></dt><dd><p>Returns the unit that owns <em>transform</em>.</p>
- </dd>
- <dt><strong>local_position</strong> (sg, transform)<span class="classifier">Vector3</span></dt><dd><p>Returns the local position of the <em>transform</em>.</p>
- </dd>
- <dt><strong>local_rotation</strong> (sg, transform)<span class="classifier">Quaternion</span></dt><dd><p>Returns the local rotation of the <em>transform</em>.</p>
- </dd>
- <dt><strong>local_scale</strong> (sg, transform)<span class="classifier">Vector3</span></dt><dd><p>Returns the local scale of the <em>transform</em>.</p>
- </dd>
- <dt><strong>local_pose</strong> (sg, transform)<span class="classifier">Matrix4x4</span></dt><dd><p>Returns the local pose of the <em>transform</em>.</p>
- </dd>
- <dt><strong>world_position</strong> (sg, transform)<span class="classifier">Vector3</span></dt><dd><p>Returns the world position of the <em>transform</em>.</p>
- </dd>
- <dt><strong>world_rotation</strong> (sg, transform)<span class="classifier">Quaternion</span></dt><dd><p>Returns the world rotation of the <em>transform</em>.</p>
- </dd>
- <dt><strong>world_pose</strong> (sg, transform)<span class="classifier">Matrix4x4</span></dt><dd><p>Returns the world pose of the <em>transform</em>.</p>
- </dd>
- <dt><strong>set_local_position</strong> (sg, transform, position)</dt><dd><p>Sets the local <em>position</em> of the <em>transform</em>.</p>
- </dd>
- <dt><strong>set_local_rotation</strong> (sg, transform, rotation)</dt><dd><p>Sets the local <em>rotation</em> of the <em>transform</em>.</p>
- </dd>
- <dt><strong>set_local_scale</strong> (sg, transform, scale)</dt><dd><p>Sets the local <em>scale</em> of the <em>transform</em>.</p>
- </dd>
- <dt><strong>set_local_pose</strong> (sg, transform, pose)</dt><dd><p>Sets the local <em>pose</em> of the <em>transform</em>.</p>
- </dd>
- <dt><strong>link</strong> (sg, parent, child, child_local_position, child_local_rotation, child_local_scale)</dt><dd><p>Links <em>child</em> to <em>parent</em>. After linking the child will follow its
- parent. Set child_local_* to modify the child position after it has been
- linked to the parent, otherwise che child will be positioned at the
- location of its parent.</p>
- </dd>
- <dt><strong>unlink</strong> (sg, child)</dt><dd><p>Unlinks <em>child</em> from its parent if it has any. After unlinking, the local
- pose of the <em>child</em> is set to its previous world pose.</p>
- </dd>
- <dt><strong>parent</strong> (sg, child)<span class="classifier">Id</span></dt><dd><p>Returns the parent of the instance <em>child</em> or <code class="docutils literal notranslate"><span class="pre">nil</span></code>
- if <em>child</em> has no parent.</p>
- </dd>
- <dt><strong>first_child</strong> (sg, parent)<span class="classifier">Id</span></dt><dd><p>Returns the first child of the instance <em>parent</em> or <code class="docutils literal notranslate"><span class="pre">nil</span></code>
- if <em>parent</em> has no children.</p>
- </dd>
- <dt><strong>next_sibling</strong> (sg, child)<span class="classifier">Id</span></dt><dd><p>Returns the next sibling of the instance <em>child</em> or <code class="docutils literal notranslate"><span class="pre">nil</span></code>
- if <em>child</em> has no sibling.</p>
- </dd>
- </dl>
- </section>
- <section id="soundworld">
- <h2>SoundWorld<a class="headerlink" href="#soundworld" title="Permalink to this headline">¶</a></h2>
- <dl class="simple">
- <dt><strong>stop_all</strong> (sound_world)</dt><dd><p>Stops all the sounds in the world.</p>
- </dd>
- <dt><strong>pause_all</strong> (sound_world)</dt><dd><p>Pauses all the sounds in the world</p>
- </dd>
- <dt><strong>resume_all</strong> (sound_world)</dt><dd><p>Resumes all previously paused sounds in the world.</p>
- </dd>
- <dt><strong>is_playing</strong> (sound_world, id)<span class="classifier">bool</span></dt><dd><p>Returns whether the sound <em>id</em> is playing.</p>
- </dd>
- <dt><strong>set_group_volume</strong> (sound_world, group, volume)</dt><dd><p>Sets the <em>volume</em> of the sound <em>group</em>. The volume of the sounds within
- <em>group</em> is multiplied by the group’s volume.</p>
- </dd>
- </dl>
- </section>
- <section id="unitmanager">
- <h2>UnitManager<a class="headerlink" href="#unitmanager" title="Permalink to this headline">¶</a></h2>
- <dl class="simple">
- <dt><strong>create</strong> ([world])<span class="classifier">UnitId</span></dt><dd><p>Creates a new empty unit. If <em>world</em> is specified, the unit will be owned by
- that world.</p>
- </dd>
- <dt><strong>destroy</strong> (unit)</dt><dd><p>Destroys the given <em>unit</em>.</p>
- </dd>
- <dt><strong>alive</strong> (unit)<span class="classifier">bool</span></dt><dd><p>Returns whether the unit is alive.</p>
- </dd>
- </dl>
- </section>
- <section id="window">
- <h2>Window<a class="headerlink" href="#window" title="Permalink to this headline">¶</a></h2>
- <dl class="simple">
- <dt><strong>show</strong> ()</dt><dd><p>Shows the window.</p>
- </dd>
- <dt><strong>hide</strong> ()</dt><dd><p>Hides the window.</p>
- </dd>
- <dt><strong>resize</strong> (width, height)</dt><dd><p>Resizes the window to <em>width</em> and <em>height</em>.</p>
- </dd>
- <dt><strong>move</strong> (x, y)</dt><dd><p>Moves the window to <em>x</em> and <em>y</em>.</p>
- </dd>
- <dt><strong>minimize</strong> ()</dt><dd><p>Minimizes the window.</p>
- </dd>
- <dt><strong>maximize</strong> ()</dt><dd><p>Maximizes the window.</p>
- </dd>
- <dt><strong>restore</strong> ()</dt><dd><p>Restores the window.</p>
- </dd>
- <dt><strong>title</strong> ()<span class="classifier">string</span></dt><dd><p>Returns the title of the window.</p>
- </dd>
- <dt><strong>set_title</strong> (title)</dt><dd><p>Sets the title of the window.</p>
- </dd>
- <dt><strong>show_cursor</strong> (show)</dt><dd><p>Sets whether to <em>show</em> the cursor.</p>
- </dd>
- <dt><strong>set_fullscreen</strong> (fullscreen)</dt><dd><p>Sets whether the window is <em>fullscreen</em>.</p>
- </dd>
- <dt><strong>set_cursor</strong> (cursor)</dt><dd><p>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>, <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>, <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>.</p>
- </dd>
- <dt><strong>set_cursor_mode</strong> (cursor, mode)</dt><dd><p>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>. 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 is moved.</p>
- </dd>
- </dl>
- </section>
- <section id="world">
- <h2>World<a class="headerlink" href="#world" title="Permalink to this headline">¶</a></h2>
- <dl class="simple">
- <dt><strong>spawn_unit</strong> (world, name, [position, rotation, scale])<span class="classifier">UnitId</span></dt><dd><p>Spawns a new instance of the unit <em>name</em> at the given <em>position</em>, <em>rotation</em> and <em>scale</em>.</p>
- </dd>
- <dt><strong>spawn_empty_unit</strong> (world)<span class="classifier">UnitId</span></dt><dd><p>Spawns a new empty unit and returns its id.</p>
- </dd>
- <dt><strong>destroy_unit</strong> (world, unit)</dt><dd><p>Destroys the given <em>unit</em>.</p>
- </dd>
- <dt><strong>num_units</strong> (world)<span class="classifier">int</span></dt><dd><p>Returns the number of units in the <em>world</em>.</p>
- </dd>
- <dt><strong>units</strong> (world)<span class="classifier">table</span></dt><dd><p>Returns all the the units in the world in a table.</p>
- </dd>
- <dt><strong>unit_by_name</strong> (world, name)<span class="classifier">UnitId</span></dt><dd><p>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.
- If there are multiple units with the same name, a random one will be returned.</p>
- </dd>
- <dt><strong>update_animations</strong> (world, dt)</dt><dd><p>Update all animations with <em>dt</em>.</p>
- </dd>
- <dt><strong>update_scene</strong> (world, dt)</dt><dd><p>Updates the scene with <em>dt</em>.</p>
- </dd>
- <dt><strong>update</strong> (world, dt)</dt><dd><p>Updates the world with <em>dt</em>.</p>
- </dd>
- <dt><strong>create_debug_line</strong> (world, depth_test)<span class="classifier">DebugLine</span></dt><dd><p>Creates a new DebugLine. <em>depth_test</em> controls whether to
- enable depth test when rendering the lines.</p>
- </dd>
- <dt><strong>destroy_debug_line</strong> (world, line)</dt><dd><p>Destroys the debug <em>line</em>.</p>
- </dd>
- <dt><strong>create_screen_gui</strong> (world)<span class="classifier">Gui</span></dt><dd><p>Creates a new Gui for 2D drawing.</p>
- </dd>
- <dt><strong>create_world_gui</strong> (world)<span class="classifier">Gui</span></dt><dd><p>Creates a new Gui for 3D drawing.</p>
- </dd>
- <dt><strong>destroy_gui</strong> (world, gui)</dt><dd><p>Destroys the <em>gui</em>.</p>
- </dd>
- <dt><strong>scene_graph</strong> (world)<span class="classifier">SceneGraph</span></dt><dd><p>Returns the scene graph.</p>
- </dd>
- <dt><strong>render_world</strong> (world)<span class="classifier">RenderWorld</span></dt><dd><p>Returns the render sub-world.</p>
- </dd>
- <dt><strong>physics_world</strong> (world)<span class="classifier">PhysicsWorld</span></dt><dd><p>Returns the physics sub-world.</p>
- </dd>
- <dt><strong>sound_world</strong> (world)<span class="classifier">SoundWorld</span></dt><dd><p>Returns the sound sub-world.</p>
- </dd>
- <dt><strong>animation_state_machine</strong> (world)<span class="classifier">AnimationStateMachine</span></dt><dd><p>Returns the animation state machine.</p>
- </dd>
- </dl>
- <section id="camera">
- <h3>Camera<a class="headerlink" href="#camera" title="Permalink to this headline">¶</a></h3>
- <dl class="simple">
- <dt><strong>camera_create</strong> (world, unit, projection, fov, far_range, near_range)<span class="classifier">Id</span></dt><dd><p>Creates a new camera for <em>unit</em> and returns its id.
- 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>.</p>
- </dd>
- <dt><strong>camera_destroy</strong> (world, camera)</dt><dd><p>Destroys the <em>camera</em> instance.</p>
- </dd>
- <dt><strong>camera_instance</strong> (world, unit)<span class="classifier">Id</span></dt><dd><p>Returns the ID of the camera owned by the <em>unit</em>, or <code class="docutils literal notranslate"><span class="pre">nil</span></code>.</p>
- </dd>
- <dt><strong>camera_set_projection_type</strong> (world, camera, projection)</dt><dd><p>Sets the projection type of the <em>camera</em>.
- 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>.</p>
- </dd>
- <dt><strong>camera_projection_type</strong> (world, camera)<span class="classifier">string</span></dt><dd><p>Returns the projection type of the <em>camera</em>.
- 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>.</p>
- </dd>
- <dt><strong>camera_fov</strong> (world, camera)<span class="classifier">float</span></dt><dd><p>Returns the field-of-view of the <em>camera</em> in degrees.</p>
- </dd>
- <dt><strong>camera_set_fov</strong> (world, camera, fov)</dt><dd><p>Sets the field-of-view of the <em>camera</em> in degrees.</p>
- </dd>
- <dt><strong>camera_near_clip_distance</strong> (world, camera)<span class="classifier">float</span></dt><dd><p>Returns the near clip distance of the <em>camera</em>.</p>
- </dd>
- <dt><strong>camera_set_near_clip_distance</strong> (world, camera, near)</dt><dd><p>Sets the near clip distance of the <em>camera</em>.</p>
- </dd>
- <dt><strong>camera_far_clip_distance</strong> (world, camera)<span class="classifier">float</span></dt><dd><p>Returns the far clip distance of the <em>camera</em>.</p>
- </dd>
- <dt><strong>camera_set_far_clip_distance</strong> (world, camera, far)</dt><dd><p>Sets the far clip distance of the <em>camera</em>.</p>
- </dd>
- <dt><strong>camera_set_orthographic_size</strong> (world, camera, half_size)</dt><dd><p>Sets the vertical <em>half_size</em> of the orthographic view volume.
- The horizontal size is proportional to the viewport’s aspect ratio.</p>
- </dd>
- <dt><strong>camera_screen_to_world</strong> (world, camera, pos)<span class="classifier">Vector3</span></dt><dd><p>Returns <em>pos</em> from screen-space to world-space coordinates.</p>
- </dd>
- <dt><strong>camera_world_to_screen</strong> (world, camera, pos)<span class="classifier">Vector3</span></dt><dd><p>Returns <em>pos</em> from world-space to screen-space coordinates.</p>
- </dd>
- </dl>
- </section>
- <section id="sound">
- <h3>Sound<a class="headerlink" href="#sound" title="Permalink to this headline">¶</a></h3>
- <dl class="simple">
- <dt><strong>play_sound</strong> (world, name, [loop = false, volume = 1.0, range = 70.0, position = nil, group = nil])<span class="classifier">SoundInstanceId</span></dt><dd><p>Plays the sound with the given <em>name</em>. If the listener is further away than
- <em>range</em> the sound will not be heard. If <em>position</em> is not specified the
- sound will be played as a 2d-sound (i.e. no attenuation nor spatialization).
- <em>group</em> is a string that identifies the sound’s group, see <code class="docutils literal notranslate"><span class="pre">SoundWorld.set_group_volume()</span></code>.</p>
- </dd>
- <dt><strong>stop_sound</strong> (world, id)</dt><dd><p>Stops the sound with the given <em>id</em>.</p>
- </dd>
- <dt><strong>link_sound</strong> (world, id, unit, node)</dt><dd><p>Links the sound <em>id</em> to the <em>node</em> of the given <em>unit</em>.
- After this call, the sound <em>id</em> will follow the unit <em>unit</em>.</p>
- </dd>
- <dt><strong>set_listener_pose</strong> (world, pose)</dt><dd><p>Sets the <em>pose</em> of the listener.</p>
- </dd>
- <dt><strong>set_sound_position</strong> (world, id, position)</dt><dd><p>Sets the <em>position</em> of the sound <em>id</em>.</p>
- </dd>
- <dt><strong>set_sound_range</strong> (world, id, range)</dt><dd><p>Sets the <em>range</em> of the sound <em>id</em>.</p>
- </dd>
- <dt><strong>set_sound_volume</strong> (world, id, volume)</dt><dd><p>Sets the <em>volume</em> of the sound <em>id</em>.</p>
- </dd>
- </dl>
- </section>
- <section id="level">
- <h3>Level<a class="headerlink" href="#level" title="Permalink to this headline">¶</a></h3>
- <dl class="simple">
- <dt><strong>load_level</strong> (world, name, [pos, rot])<span class="classifier">Level</span></dt><dd><p>Loads the level <em>name</em> into the world at the given <em>position</em> and <em>rotation</em>.</p>
- </dd>
- <dt><strong>destroy_level</strong> (world, level)</dt><dd><p>Destroys a level previously loaded by load_level(). Only units directly
- spawned by the level are unspawned.</p>
- </dd>
- </dl>
- </section>
- </section>
- </section>
- </div>
- </div>
- <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
- <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>
- <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>
- </div>
- <hr/>
- <div role="contentinfo">
- <p>© <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.
- <span class="lastupdated">Last updated on Dec 14, 2025.
- </span></p>
- </div>
- Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
- <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
- provided by <a href="https://readthedocs.org">Read the Docs</a>.
-
- </footer>
- </div>
- </div>
- </section>
- </div>
- <script>
- jQuery(function () {
- SphinxRtdTheme.Navigation.enable(true);
- });
- </script>
- <!-- Theme Analytics -->
- <script async src="https://www.googletagmanager.com/gtag/js?id=G-XNVGCMNDZH"></script>
- <script>
- window.dataLayer = window.dataLayer || [];
- function gtag(){dataLayer.push(arguments);}
- gtag('js', new Date());
- gtag('config', 'G-XNVGCMNDZH', {
- 'anonymize_ip': true,
- });
- </script>
- </body>
- </html>
|