<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.fightorder.net/wiki/index.php?action=history&amp;feed=atom&amp;title=Animation-LuaScripting</id>
	<title>Animation-LuaScripting - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.fightorder.net/wiki/index.php?action=history&amp;feed=atom&amp;title=Animation-LuaScripting"/>
	<link rel="alternate" type="text/html" href="https://www.fightorder.net/wiki/index.php?title=Animation-LuaScripting&amp;action=history"/>
	<updated>2026-04-21T00:39:29Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://www.fightorder.net/wiki/index.php?title=Animation-LuaScripting&amp;diff=2403&amp;oldid=prev</id>
		<title>Qrow: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://www.fightorder.net/wiki/index.php?title=Animation-LuaScripting&amp;diff=2403&amp;oldid=prev"/>
		<updated>2026-03-04T00:08:26Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:08, 3 March 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Qrow</name></author>
	</entry>
	<entry>
		<id>https://www.fightorder.net/wiki/index.php?title=Animation-LuaScripting&amp;diff=2399&amp;oldid=prev</id>
		<title>Qrow: Created page with &quot;== Getting started ==  === Setup ===  Lua unit animation is implemented partially in the engine, and partially in a Lua gadget which is shipped with Spring in springcontent.sdz. By default, gadget is not loaded, so a bit of setup is required to enable Lua unit scripts. (In some games, gadget is alredy activated, for example in Zero:k)  To enable Lua unit scripts, create a file &#039;&#039;LuaRules/Gadgets/unit_script.lua&#039;&#039;, and paste the following into it:  {|border=&quot;0&quot; cellpa...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.fightorder.net/wiki/index.php?title=Animation-LuaScripting&amp;diff=2399&amp;oldid=prev"/>
		<updated>2026-03-04T00:07:48Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Getting started ==  === Setup ===  Lua unit animation is implemented partially in the engine, and partially in a Lua gadget which is shipped with Spring in &lt;a href=&quot;/wiki/index.php?title=Springcontent.sdz&quot; class=&quot;mw-redirect&quot; title=&quot;Springcontent.sdz&quot;&gt;springcontent.sdz&lt;/a&gt;. By default, gadget is not loaded, so a bit of setup is required to enable Lua unit scripts. (In some games, gadget is alredy activated, for example in Zero:k)  To enable Lua unit scripts, create a file &amp;#039;&amp;#039;LuaRules/Gadgets/unit_script.lua&amp;#039;&amp;#039;, and paste the following into it:  {|border=&amp;quot;0&amp;quot; cellpa...&amp;quot;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:07, 3 March 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Qrow</name></author>
	</entry>
	<entry>
		<id>https://www.fightorder.net/wiki/index.php?title=Animation-LuaScripting&amp;diff=2402&amp;oldid=prev</id>
		<title>interanimation&gt;Flozi: /* Further reading */ add a link through to skeleton examples page</title>
		<link rel="alternate" type="text/html" href="https://www.fightorder.net/wiki/index.php?title=Animation-LuaScripting&amp;diff=2402&amp;oldid=prev"/>
		<updated>2022-11-17T19:38:15Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Further reading: &lt;/span&gt; add a link through to skeleton examples page&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Getting started ==&lt;br /&gt;
&lt;br /&gt;
=== Setup ===&lt;br /&gt;
&lt;br /&gt;
Lua unit animation is implemented partially in the engine, and partially in a Lua gadget which is shipped with Spring in [[springcontent.sdz]]. By default, gadget is not loaded, so a bit of setup is required to enable Lua unit scripts. (In some games, gadget is alredy activated, for example in Zero:k)&lt;br /&gt;
&lt;br /&gt;
To enable Lua unit scripts, create a file &amp;#039;&amp;#039;LuaRules/Gadgets/unit_script.lua&amp;#039;&amp;#039;, and paste the following into it:&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;0&amp;quot; cellpadding=&amp;quot;4&amp;quot;&lt;br /&gt;
|style=&amp;quot;background: #41545c; border: 1px #aaa solid;&amp;quot;|&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
 -- Enables Lua unit scripts by including the gadget from springcontent.sdz&lt;br /&gt;
 &lt;br /&gt;
 -- Uncomment to override the directory which is scanned for *.lua unit scripts.&lt;br /&gt;
 --UNITSCRIPT_DIR = &amp;quot;scripts/&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 return include(&amp;quot;LuaGadgets/Gadgets/unit_script.lua&amp;quot;)&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Also, do check whether your [http://github.com/spring/spring/blob/master/installer/builddata/springcontent/LuaGadgets/system.lua &amp;#039;&amp;#039;LuaRules/system.lua&amp;#039;&amp;#039;] is up to date, if you copied this verbatim into your game. (Must be from a later date than 5 september 2009)&lt;br /&gt;
&lt;br /&gt;
Now this is done, you can start putting *.lua files in your &amp;#039;&amp;#039;scripts/&amp;#039;&amp;#039; folder.&lt;br /&gt;
&lt;br /&gt;
=== Workflow ===&lt;br /&gt;
&lt;br /&gt;
Lua has the major advantage over BOS/COB that you do not need to compile it, which can reduce the time to develop scripts quite a bit.&lt;br /&gt;
&lt;br /&gt;
To save further time, do not restart Spring for each small change. Simply run Spring in an window so you can easily switch between your editor and Spring, and use &amp;#039;&amp;#039;/cheat&amp;#039;&amp;#039; and &amp;#039;&amp;#039;/luarules reload&amp;#039;&amp;#039; to reload all Lua unit scripts.&lt;br /&gt;
&lt;br /&gt;
To be able to use commands above, unzip your game into directory named &amp;quot;myGame.sdd&amp;quot;, then you can directly change lua scripts (animations etc.) and reload.&lt;br /&gt;
&lt;br /&gt;
Additionally, for Lua unit scripts operating on Assimp models (primarily .dae and .blend), it is possible to do most of your animating in Blender using the [https://github.com/Anarchid/blender2lus blender2lus] export addon.&lt;br /&gt;
&lt;br /&gt;
=== Workflow for animating S3o models in Blender ===&lt;br /&gt;
&lt;br /&gt;
Anarchids Blendertools can be used to animate (within limits) S3O models. Here are the steps:&lt;br /&gt;
&lt;br /&gt;
1. Export your model into Blender.&lt;br /&gt;
&lt;br /&gt;
2. Restore the Hierarchy in Blender.&lt;br /&gt;
&lt;br /&gt;
https://blender.stackexchange.com/questions/26108/how-do-i-parent-objects&lt;br /&gt;
(Ctrl + P) is your friend .&lt;br /&gt;
&lt;br /&gt;
3. If all Pivots are set correctly, create the Animations, one by one.&lt;br /&gt;
&lt;br /&gt;
4. Export the Animations with Anarchids Skript Export tool. &lt;br /&gt;
&lt;br /&gt;
5. Open the resulting Animationskript for postprocesing.&lt;br /&gt;
&lt;br /&gt;
6. Find Move commands like {[&amp;#039;c&amp;#039;]=&amp;#039;move&amp;#039;,[&amp;#039;p&amp;#039;]=LowerJaw, [&amp;#039;a&amp;#039;]=x_axis, [&amp;#039;t&amp;#039;]=-0.000000, [&amp;#039;s&amp;#039;]=0.012682}, and purge them. Replace them with todos- you will have to insert them manually later, with correct axis and values.&lt;br /&gt;
&lt;br /&gt;
7.In the turn commands - exchange the [&amp;#039;a&amp;#039;]=z_axis with [&amp;#039;a&amp;#039;]=y_axisz and the old [&amp;#039;a&amp;#039;]=y_axis with [&amp;#039;a&amp;#039;]=z_axis.&lt;br /&gt;
Here is a Regex, to make the text-search easier.&lt;br /&gt;
&lt;br /&gt;
{\[&amp;#039;c&amp;#039;]=&amp;#039;turn&amp;#039;,\[&amp;#039;p&amp;#039;]=([^\s]+), \[&amp;#039;a&amp;#039;]=z_axis, \[&amp;#039;t&amp;#039;]=\*&lt;br /&gt;
&lt;br /&gt;
{\[&amp;#039;c&amp;#039;]=&amp;#039;turn&amp;#039;,\[&amp;#039;p&amp;#039;]=([^\s]+), \[&amp;#039;a&amp;#039;]=y_axis, \[&amp;#039;t&amp;#039;]=\*&lt;br /&gt;
&lt;br /&gt;
8. Invert (change the sign) of the y_axis values.&lt;br /&gt;
&lt;br /&gt;
9. Start the game and call the Animation you want to debug in a Loop.&lt;br /&gt;
&lt;br /&gt;
10. Congratulations you now have smoothly animated S3o Models.&lt;br /&gt;
&lt;br /&gt;
== Further reading ==&lt;br /&gt;
* [[Animation:LuaExamples]]&lt;br /&gt;
* [http://tvo.github.com/spring/2010/04/19/lus-stumpy.html Stumpy tutorial]&lt;br /&gt;
* [http://tvo.github.com/spring/2010/04/26/lus-stumpy-2.html Polishing the stumpy]&lt;br /&gt;
* [[Animation-LuaCallins]]&lt;br /&gt;
* [[Animation-LuaCallouts]]&lt;br /&gt;
* [[Animation-CobLuaDifferences | comparing Lua and COB unit scripts]]&lt;br /&gt;
* [[SpringTutorialGame]] contains simple  examples unit scripts&lt;br /&gt;
* [[SpringRtsTutorialAnimDef]] examples animation scripts&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;br /&gt;
&lt;br /&gt;
* Conversion tool&lt;br /&gt;
* Performance measurements&lt;br /&gt;
* Link to article in piro&amp;#039;s magazine&lt;br /&gt;
* Coordinate system (axis, direction of rotation, picture)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Animation]]&lt;/div&gt;</summary>
		<author><name>interanimation&gt;Flozi</name></author>
	</entry>
</feed>