Character Animation tools
A detailed description of blenders character animation tools
August 16, 2001

Using Armatures in the gameengine

In this section of the character animation tools tutorial I plan to show you how to use armatures inside the gameengine. I do however assume that you have some experience with the armatures before and know how to create a basic movement of a character. I also assume that you have some basic knowledge of the gameengine.

TankCommander has helped me out by telling me how to do this and he also provided a .blend file so please download this .blend file and open it. >>game-armatures.blend<<
If you open it you'll see a basic character, a basic Armature structure for it, and you will see I already added a bit of motion to it, try pressing alt+a to see the animation.

We'll be using the animation to make the character move, and we will also make the character move forward by using a regular motion actuator. Lets do that first, select the character and go to the realtime buttons (F8), you can see I already set it up to be a dynamic actor and I changed some of the default settings to fit my needs.
Now simply add a keyboard sensor and set it to react on the 'UP' key. Next add a 'AND' Controller and link the sensor to it. Finally add a 'motion' Actuator and set the y force to -10 and link it to the controller.

Now if you press 'P' and ignore the 'no camera' error you can test your motion by pressing on the 'UP' key. If all went right you should have a character moving forward.

Lets set up the armatures now, the basic idea is that I've created a walk cycle (very simple but still) in the action window and I named it 'walk'. If you press 'alt+a' you can see it, it's not the best piece of animation (made this in littlerly 30 seconds) but it shows some mesh deformation on the legs. Lets start by selecting the Armature and going to the realtime buttons.
You see I haven't made this a Actor like I did with the character itself, because we don't want the Armature to be an actor so leave it like that.
For the armature add a keyboard sensor and make it react on the 'UP' key. Then add a 'AND' Controller, and link it to the sensor. Now add a 'Action' Actuator, link it to the controller.
Change the action name 'AC:' to the name of the walkcycle 'walk'. Now we need to set the begin and end frame of the animation, if you look at the action window you can see that the 'walk' sequence starts at frame 1, and ends at frame 26, however the begin and end pose are exactly the same so we need to take 1 frame of the animation because else we'll get a jerky movement. So in the Action Actuator set the start frame to '1' and the end frame to '25'. We just need to do 1 more thing now and that is change the 'action playback type' from 'Play' to 'Loop Stop' because we want the animation to loop for aslong as you press the 'UP' key, but Stop as soon as you release the 'UP' key.

Do this and then you can test the animation by pressing 'P' (ignoring the 'no camera' error) and then pressing the up key.
Well it's far from perfect and needs some more work to actually look like a realistic walk cycle, but atleast now you should have a good idea at how to make your character walk using armatures inside the gameengine.

This was it again, please come back again soon because I'll keep updating this tutorial over the next few weeks as more of the new character animation system becomes clear.

Greetings,
Timothy Kanters (Kib_Tph)
Click here to e-mail me

Previous» 1 2 3 4 «Next