Page 1 of 1

Spin in reverse direction

Posted: Thu Sep 02, 2010 1:09 am
by D.Durand
I wanted to know how to make something spin in reverse direction. Look like the "spin" function accept no direction variable :-(

Re: Spin in reverse direction

Posted: Thu Sep 02, 2010 5:42 am
by Balthazar
Try using numbers of angles below zero, like -2, -5 and so on.

Re: Spin in reverse direction

Posted: Sun Sep 05, 2010 5:54 am
by D.Durand
Thank for you answer, but Spin don't have angle variable. :cry:

Re: Spin in reverse direction

Posted: Sun Sep 05, 2010 11:35 am
by zuzuf
The spin function takes several parameters (in the Lua scripting API):

Code: Select all

spin(unitID, obj, axis, speed, (accel))
Where unitID is the 'this' parameter (it's designed to be called like this:spin(this.piece, ...) ). Setting speed to something negative should make the model piece spin in reverse direction.

Re: Spin in reverse direction

Posted: Tue Sep 07, 2010 1:58 am
by D.Durand
Lua ? What is lua ? You speak also of a "this"... I mean, i need to learn C coding ? :(

Re: Spin in reverse direction

Posted: Tue Sep 07, 2010 4:03 pm
by zuzuf
There are 3 ways of animating models:
  • use default animation parameters for 3DM models (doesn't work on units)
  • write a COB script (OTA scripting language) to animate a unit model (unit only)
  • write a Lua script (using TA3D's Lua API) to animate a unit model (unit only)
Lua is a scripting language designed to be embedded in programs (like games, TA3D, Spring and Supreme commander use Lua) to extend their functionalities. The language itself is simple (http://www.lua.org/manual/5.1/) and the "this" thing is only a variable (the first parameter given to any function called by TA3D to animate the unit) which represents the unit itself (actually you could animate a unit from another unit's script ... if you can access an object representing that unit). Lua is very different from C so you don't have to learn C coding.

Scripting a unit with Lua is similar to scripting in COB. You first declare the pieces of your model, then for each function which is needed for your unit you write animation commands which looks like:

Code: Select all

-- turn the leg around x axis until it reaches 90° at 45°/sec
this:turn(this.leg, x_axis, 90, 45)
You can find the whole list of Lua functions here : http://trac.ta3d.org/browser/trunk/docs ... otypes.txt

I recommend you look at some of the Lua scripts from the free data set. Most of them implements the same animation as their COB equivalent from OTA.

Re: Spin in reverse direction

Posted: Tue Sep 07, 2010 10:49 pm
by D.Durand
Okay, i look at it. Thank for the link.

Re: Spin in reverse direction

Posted: Thu Sep 09, 2010 7:17 am
by D.Durand
Where can i find the "free data set" ? If its' the "ta3d-data" from the server, i have that error when i try to install it :

Code: Select all

Réception de : 1 ftp://downloads.ta3d.org/binaries/linux/apt/ testing/main ta3d-data 0.0.1 [65,2MB]
65,2Mo réceptionnés en 1min 52s (581ko/s)                                                                                                                   
(Lecture de la base de données... 208252 fichiers et répertoires déjà installés.)
Dépaquetage de ta3d-data (à partir de .../ta3d-data_0.0.1_all.deb) ...
dpkg : erreur de traitement de /var/cache/apt/archives/ta3d-data_0.0.1_all.deb (--unpack) :
 impossible de créer « /usr/share/games/ta3d/resources/anims/corint/paneltop/paneltop.png.dpkg-new » (pendant le traitement de « ./usr/share/games/ta3d/resources/anims/corint/paneltop/paneltop.png »): Aucun fichier ou dossier de ce type
dpkg-deb: sous-processus coller tué par le signal (Relais brisé (pipe))
Des erreurs ont été rencontrées pendant l'exécution :
 /var/cache/apt/archives/ta3d-data_0.0.1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)


Re: Spin in reverse direction

Posted: Thu Sep 09, 2010 4:29 pm
by zuzuf
Interesting ... I didn't notice the package was broken.

Yes the free data set is the ta3d-data package but you can also find it there : http://downloads.ta3d.org/mods/ta3d_free_data_set.7z (I've just updated it)

Re: Spin in reverse direction

Posted: Fri Sep 10, 2010 12:27 am
by D.Durand
Thank.