Jump to content

Animation triggers to torque script?


Recommended Posts

In the full template so far I've only found a pair of animation triggers being used for the player footsteps. Its functionality is "hard coded" in the engine source in player.cpp.


So, are those animation triggers only usable through C++? Is there any inconvenience for using a callback from tsThread.cpp (they start there, don't they?) to use torque script to define changes instead?


I suspect there is an issue with client/server behaviour but as I only want to toy around with single player I hope that won't be a problem for now.



If that's possible, I plan on sending to the .cs file the animated object name and the animation sequence name along with the animation trigger number so I can have more flexibility.

So, for example, the trigger#3 of limping_animation of peasant_object -result: damage to the peasant each time the foot touches gound- can give a different result that another trigger#3 but for long_shot of cannon_n3 -result: if bullet>0 make some blast far away-.

This way I don't need to change the small number of animation triggers (30 for each animation sequence is more than enough).


My second question, is that too complex and inconvenient? Should I just stick with classic conditionals and timed intervals and leave animation triggers alone?



Thanks for your help. There is almost no documentation for animation triggers around (or it's very hard to find because trigger is too common of a name) so any input on this subject is welcome.

Link to post
Share on other sites

Unfortunately those are not related, even if they share the name.


These are more key-frame markers than classical triggers. You can check these animation triggers in the shape editor->properties->Seq tab->at the bottom.

The soldier shape from the Full template uses #1 and #2 to mark the aparition of the footsteps decals and dust inside the walking animations.


"Trigger" is used a lot around some different objects inside Torque3D. Maybe the use of "trigger" to name this feature wasn't very lucky.

Link to post
Share on other sites
  • 1 month later...

I'm checking that resource. I don't know how I missed it. Thanks a lot for pointing it.


But I did a thing of my own at the end.

I should have informed of that here, sorry.


It works for easy things like echo variables so if you want to check it, the documentation I did is:


http://pastebin.com/4z5jbspn

http://pastebin.com/syssW88r


(Sorry for the constant commenting with irei1as_ in the code. It was a keyword to find the changed lines. Feel free to delete those comments if you want to try it and they annoy you.)


Err, well, it's the animation trigger thing plus something related to sprites I'm playing with. Feel free to ignore anything that says 'Sprite'.


It works for TsStatic and normal shapebases (like the coin example) but I have to test it more with the special ones like the player and vehicles.


Also it's not elegant at all. I wasn't able to make it work with DECLARE_CALLBACK() -it made me an error- so I forced a Con::executef().

But, well, in the chat I was told it was alright.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...