Animation

9 posts / 0 new
Last post
NFelix
NFelix's picture
Offline
Joined: 05/06/2011
Animation

Following my post in feature requests, about an animation editor, this question has arisen: how do I use animation in GameStart? After exporting my object from Maya, with several animations, how can I assign each animation to a key-press? For example, i could assign a walk to the 'W' key, a jump to the 'Space' key, etc. How can I do it? Is there any tutorial about it?

Thanks in advance

Mr.Admin
Mr.Admin's picture
Offline
Joined: 03/29/2010
Re: Animation

Hi, I never used Maya for this process so I need to ask a few questions:

  1. Did you import your model via FBX?
  2. How are your animations stored? As separate motion in Maya or as one single animation track combining different motions?

I am adding a script to this thread to control a character so that you get an idea on how things work.
I can also write a builtin to do just what you ask but that is dependent on your workflow.

NFelix
NFelix's picture
Offline
Joined: 05/06/2011
Re: Animation

Well, I use Maya almost exclusively, at work, so I chose to export from it. I exported as DAE, with one single animation track, and a simple animation.

Thanks for the script, i'm looking at it right now. As soon as I arrive home, I will try it.

I'm really loving GameStart. The engine is powerful, the editor, although still missing some functionality, is looking already pretty good, and the support you give to us, new users, is GREAT.

Thank you, and keep up the excellent work!!! Laughing out loud

Mr.Admin
Mr.Admin's picture
Offline
Joined: 03/29/2010
Re: Animation

Thanks Wink

I think that you will have much better results with FBX seeing as this is an Autodesk format.
Plus, DAE support is provided by the FBX SDK so I am pretty sure this is the best choice.

One thing to make sure is to get the latest FBX exporter plugin, this is really important.

As you said, the editor is not complete, so let me know if you hit some troubles.

François Gutherz
François Gutherz's picture
Offline
Joined: 04/03/2010
Re: Animation

Even if the pipeline between Maya & GameStart was not specifically tested, all the animations of the "Mediecross" project (found in the Blog section) were made with Maya 2010.
The only important detail I remember is that we exported all the animations of the Knight character (run, jump, hit) in one single timeline, using the FBX format.

The workflow to get the character animated into GS is quite simple, but it requires a few step, though.
Keep us posted of your progress, if you can Smile

NFelix
NFelix's picture
Offline
Joined: 05/06/2011
Re: Animation

Well, I'm missing something here...

I was getting an error, so then I tried with a very simple object, a sphere with some basic animation. I exported as fbx, imported to GameStart, and used the script 'character_animation.nut'. I edited it, leaving only two animations, with the correct key intervals. Then I altered the 'UpdateControls' function to leave only the statement for the 'KeyUpArrow', so that it changes to the second animation when the up arrow is pressed.
I created a group, with the sphere inside, and in altered the string in the 'scene.findGroup' to the name of my group. I tried to apply the script to both the sphere and group, but always get the same error:
'Unhandled exception: CObject is null

Source: psphere1.nut'

I know it must be something I should be doing but I'm not, but can't understand what is it...

Sorry for my inexperience...

Mr.Admin
Mr.Admin's picture
Offline
Joined: 03/29/2010
Re: Animation

No problem Wink

I missed a lot of informations about the script I gave you, sorry about that.
First of all, this is a scene script. It could be modified to be an item script but there's a good reason to keep it on the scene, I'll expand on that at the end of this post.

I assume the script breaks at the line where you replaced 'scene.findGroup'?
I should give you a bit more informations on how this script works:

Basically you can start one or more motions on a group of items, but this group has to exist in the scene first.
When you import your FBX there is no group existing in the created scene. To create a new group, select one or more items in the Scene Explorer then click the + button in the Group Explorer which is located right under the Scene Explorer tree. This should prompt you for the name of a new group.

Tip: By hovering on a button with the mouse pointer in the GUI you can get a description of the action this button performs.

Once this group is created you can retrieve it from a script using its name via the 'scene.findGroup' function.
You can then start motions etc, on the items belonging to the group.

The point of doing all this through groups is to allow the animation of independent parts of a hierarchy (upper body/lower body/head/etc...).

//---------

Now, why keep that script as a scene script? The reasoning is that a skinned character represents an already fairly complex scene tree and you certainly don't want to clutter your level scenes with several characters populating the scene tree with all of their bone items.

Since scenes can be instantiated into other scenes (by drag'n'dropping a scene from the project explorer on a viewport) with all their properties retained, it makes sense to isolate characters and work on them in their own, clean scene and import them in level scenes through instances.

Hopefully, instances are one area I had time to document, so you can check it in the documentation here.

Hope this helps!

NFelix
NFelix's picture
Offline
Joined: 05/06/2011
Re: Animation

YES, now it works. Thank you so much for your help!!!

It was really a groups problem. When i created the group as you said, the error message disappeared. Only then the animation was not playing. But I played a bit with the Maya FBX export settings, and now it works. Like a charm Laughing out loud :D And I'm loving GameStart even more Laughing out loud

Just out of curiosity, in the line ' Idle={name = "Idle", take = "Take 001", start =1.0 / 25.0, end = 25.0 / 25.0} ', the 25 (or 30, as it was on the original you sent me), is the frame-rate of the animation, isn't it?

Well, now i will try to make a bouncing ball move along uneven terrain, with a 'jump cycle'.

Once again, thank you for your help and patience Laughing out loud

Mr.Admin
Mr.Admin's picture
Offline
Joined: 03/29/2010
Re: Animation

Great to know! Wink

You are correct about the framerate thing, the original animation I wrote this script for was exported from MAX to FBX but I expect this to be the same in MAYA.

There are several approach you can take to achieve what you are planning. As you will not be able to animate physic items (the physics will take over your animation) your best bet is to parent the animated ball to a null item which has a collision shape. So that the bouncy ball will follow the item colliding with the terrain.

Keep us posted on how things go.

Login or register to post comments