Spin in reverse direction

recreating units
Post Reply
D.Durand
Posts: 87
Joined: Sun Feb 07, 2010 11:21 am

Spin in reverse direction

Post by D.Durand » Thu Sep 02, 2010 1:09 am

I wanted to know how to make something spin in reverse direction. Look like the "spin" function accept no direction variable :-(

User avatar
Balthazar
Moderator
Posts: 2055
Joined: Wed Nov 01, 2006 4:31 pm
Location: Russian Federation
Contact:

Re: Spin in reverse direction

Post by Balthazar » Thu Sep 02, 2010 5:42 am

Try using numbers of angles below zero, like -2, -5 and so on.

D.Durand
Posts: 87
Joined: Sun Feb 07, 2010 11:21 am

Re: Spin in reverse direction

Post by D.Durand » Sun Sep 05, 2010 5:54 am

Thank for you answer, but Spin don't have angle variable. :cry:

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Re: Spin in reverse direction

Post by zuzuf » Sun Sep 05, 2010 11:35 am

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.
=>;-D Penguin Powered

D.Durand
Posts: 87
Joined: Sun Feb 07, 2010 11:21 am

Re: Spin in reverse direction

Post by D.Durand » Tue Sep 07, 2010 1:58 am

Lua ? What is lua ? You speak also of a "this"... I mean, i need to learn C coding ? :(

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Re: Spin in reverse direction

Post by zuzuf » Tue Sep 07, 2010 4:03 pm

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.
=>;-D Penguin Powered

D.Durand
Posts: 87
Joined: Sun Feb 07, 2010 11:21 am

Re: Spin in reverse direction

Post by D.Durand » Tue Sep 07, 2010 10:49 pm

Okay, i look at it. Thank for the link.

D.Durand
Posts: 87
Joined: Sun Feb 07, 2010 11:21 am

Re: Spin in reverse direction

Post by D.Durand » Thu Sep 09, 2010 7:17 am

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)


User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Re: Spin in reverse direction

Post by zuzuf » Thu Sep 09, 2010 4:29 pm

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)
=>;-D Penguin Powered

D.Durand
Posts: 87
Joined: Sun Feb 07, 2010 11:21 am

Re: Spin in reverse direction

Post by D.Durand » Fri Sep 10, 2010 12:27 am

Thank.

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests