DTS/Blender/Creating an Advanced Character
From TDN
Creating an Advanced Character in Blender for Use by the Player Object from TGE
The goal of this tutorial is to cover all the nuances of creating a DTS based player object. This tutorial will be a work in progress as I learn all of the details for implementation. I also expect the tutorial to change as others suggest better ways to do this. I have classified this tutorial as an "advanced tutorial". The reason for this is I intend to provide the minimum detail necessary to get the concepts across. That means there may be detail missing that a beginner would miss. As time goes by and people request additional information I will fill in the blanks. Do not be afraid to ask if something does not make sense. I want this to be usable, but not take forever to write at the same time.
Prerequisite Tutorials:
Before you start it is very important to know the basics of Blender.
Reference :
http://www.blender.org/documentation/htmlI/book1.html
http://tdn.garagegames.com/wiki/DTS Check the Blender section.
http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro
To understand the Advanced Character tutorial you should be be familiar with all the concepts at this link:
http://www.blender.org/documentation/htmlI/c1205.html
You must be able to:
- Use Blender 2.41 with the 0.91 exporter to export a DTS object and place that DTS object in the engine.
Torque exporter reference:
http://tdn.garagegames.com/wiki/DTS/Blender/Exporter_User_Interface_Overview
- Look up or know how to use many of the features in Blender including: rigging, UV mapping, general editing, posing, action manipulation, texturing, and probably a bunch of other things as well.
We recommend this excellent video tutorial in order to get all the information of animation for Torque :
http://www.users.on.net/~symes/gamedev/videotuts/videotuts.html
- Write/modify scripts to change DTS object selection for the player (player.cs) and be able to edit scripts for supporting using DSQs.
- Have Patience.
Definitions:
- DTS - Dynamix Three Space, the base format used for objects in Torque.
- IK - Inverse Kinematics, a way to allow the placement of a foot, hand, tentacle tip, etc at a specific location and the rest of the armature will be adjusted to fit if the position is possible.
Tutorial:
- [edit]
Sizing the player
Image:PlayerSize.blend.zip - Blend file with boxes scaled to the height of the orc's head, 2m, and 6ft.
If you are looking to create a player that is roughly the same size of the orc or is a size similar to that of a human this blend file is intended to provide a reference for you. It is ready to be exported and placed in the engine as a tsstatic. I placed this next to a tsstatic orc to get my size bearings for the orc height which is approximately 2.25 meters/blender units.
- [edit]
Building a simple player mesh
Image:SimplePlayerMesh.blend.zip - Blend file with a very simple player mesh.
This mesh is intended to provide a basis for animating later. If you would like to use your own mesh that is fine. My intent in creating this mesh is to reduce the work managing the mesh while creating the tutorial. - [edit]
Rigging the player mesh
Image:RiggedPlayerMesh.blend.zip - Blend file based on the simplePlayerMesh.blend and rigged with an armature.
This is a starting point for animating. I have not setup any IK or nodes or anything DTS specific.
- [edit]
Setting up nodes in the player
Image:NodedPlayerMesh.blend.zip - Blend file based on the riggedPlayerMesh.blend with added player nodes.
This blend adds the following nodes: ski0, ski1, mount0, cam, and eye. Notice that the mount0 node is not connected to the bone structure. This is on purpose as I intend to try and animate this by using a position constraint to the hand bone. I had trouble on another model where I attached the mount0 as a hand bone. I ran into trouble keeping the bone structure from skewing the mount0 angle enough that it would not sit flat. I am thinking by not attaching this bone to the skeleton and doing a position only constraint that I can fix some of the alignment problems. We shall see.
- [edit]
Setting up IK control for positioning the character
Image:IkPlayerMesh.blend.zip - Blend file based upon nodedPlayerMesh.blend with basic IK setup on the arms and legs.
Notice how mount0 is now tracking the position of the hand, but not the rotation. This should help keep the gun straight and pointing in the proper direction during animations. Also notice there are four IK handles: IKfoot.R,IKfoot.L,IKhand.R,IKhand.L. There is also a root bone to allow the positioning of the body. The IK handles are not parented to the rest of the mesh. This makes animations such as jumping to made just by moving the root bone. I don't know if this is the "best" IK setup, but it seems to work for now. It probably really depends on what you are doing.
Here are some tips for using IK or understanding what I did. The last bone in each IK chain has an IK modifier applied to it. This modify determines how many bones up the chain will be used in the IK chain, the target of the chain (if any), and if the bone the modifier is applied to is part of the chain. I use a target in my chains and I do not use the last bone (tip) in the chain. You can see this by looking at the blend file. Another important thing to note is that I keyframe the bones in the first frame of the animation so that I can "preload" their position. If you do not then the IK solution can mess up. So make sure to keyframe an initial position of the legs and arms. Then all you have to keyframe is the IK targets. Their is a caveat to that though. If you are trying to keyframe an animation using just the handles, sometimes the bones don't twist/bend the way you want. For that you can keyframe the bones you need to fix. For instance check out the celsalute animation in one of the later blend files that have animations. I had to keyframe one of the arm bones to get the salute to look right, but I only had to keyframe it at the apex of the salute. The exporter does a very good job of doing the hard work for you.
- [edit]
Animating non-blend animations
Image:NonblendPlayerMesh.blend.zip - non-blend animations.
There is one death animation that uses the Bounds object to properly align to the ground when the player dies. If the Bounds object is not there then the engine will crash as there is no reference between the ski0 and ski1 nodes to ground.
- root - This is a stand there and breath, fidget, etc animation.
- run - Forward movement animation.
- back - Backward movement animation.
- side - Sideward movement animation. Animated to move left, but reversed for moving right.
- fall - Pose/Animation of the player when falling.
- land - Hard land animation.
- jump - Moving jump animation.
- standjump - Standing and jumping animation.
- sitting - Sitting pose/animation for driver.
- celsalute - Salute animation.
- celwave - Wave animation. Warning my animation is slightly suggestive. If you are offended by a lower block thrust then please do not watch this animation.
- scoutroot - Passenger animation.
- death1 to deathn - Animations of the player dying. This one was the most fun to make. Muahahahaha!
- [edit]
Animating blend animations
Image:BlendPlayerMesh.zip - Here is the latest with the blend animations. This has the DSQs thus far, the blend file, the cs file, and the dts file. All animations are now prefixed by "em_" so that they do not get mixed up with other animations you may have. The ground transform animations run, back, and side are animated using a ground transform. However, to recreate you will have to keyframe the Bounds object for each animation individually and export them seperately. See the section on setting up ground transform animations for details. The animations looksn, looknw, and lookms are not in here. I have not figured out what they do.- look - Move arms up and down +/- 80 degrees for aiming of gun. Animate upward at beginning of animation and downward at end.
- head - Move head up and down +/- 80 degrees for aiming of gun. Animate upward at beginning of animation and downward at end.
- looksn?
- looknw?
- lookms?
- headside - Look left to right +/- some number of degrees defined by maxLookAngle in Player datablock.
- light_recoil - Recoil animation when firing a gun. Not sure when medium_recoil and heavy_recoil are triggered, but I figured if you can make the light version you should be able to make the other two.
- [edit]
Setting up the ground transform
I am reworking this section based upon comments from others. It may not be very accurate.
A ground transform animation is an animation that adusts according to the speed of the object. If a player is walking the walking speed will match the speed of the player to look like he is walking properly. Setting up animations using the Bounds object to represent the ground transform turned out to be an interesting problem. In order to export a ground transform animation the Bounds object has to be keyframed for that animation on export. Take "run" for instance. The Bounds object needs to be keyframed for the distance traveled in the direction of the "run" animation. That means you can only export the "run" animation during that export. If you try and export other ground transform based animations they will be messed up if the keyframes on the Bounds object are setup for the "run" animation. This also means you cannot setup multiple ground transform based animations in a monolithic (no DSQ) DTS. So, if you are going to use ground transform animations such as "run", "back", or "side" you must use DSQs. Here is a method for exporting ground transforms using "run" as an example:- Clear all IPO curves for the "Bounds" object.
- Put the "Bounds" object at a starting position at animation frame 1 and insert a keyframe at that position.
- Set the animation frame to whatever is the last frame for your "run" animation.
- Determine how far your character would have moved at the end of the animation and place the "Bounds" object at that position and insert a keyframe.
- Start the exporter and disable the export on all animations except the "run" animation.
- Set the ground frames for 2 for the "run" animation(This may eat up some of the animation at the beginning so if this bugs you move the frames forward past frame 2. For this tutorial I have not worried about it.).
- Export the animation.
- [edit]
Triggers
Image:TriggerPlayerMesh.blend.zip
I have only been able to get the foot triggers working. I am also not sure you can make a script based trigger without editing the player.cc. These triggers seem to be different from say triggers that call "onTrigger" in script.
Triggers allow animations to signal the engine by generating an event that a C++ function or a script function can "trigger" off of.- Foot triggers - The triggerPlayerMesh.blend file has triggers for left and right foot steps enabled (triggers 1 and 2 respectively). Adding more triggers of different types will most likely need code changes to player.cc.
- [edit]
Other Details
- Script for connecting DSQs to the DTS for all the non-blend animations
Image:NonblendExampleman.cs.zip - It looks like the show tool (-mod show) looks for a cs file of the same name as the dts file in the same directory. For exampleman.dts you would need a corresponding exampleman.cs in order for the show tool to play your DSQ based animations. Note that some of the cs files I provide are not the correct spelling to work in the show tool. You will have to rename it to the name of the DTS exampleman.dts for it to work right.
- You can name the sequences anything you want when you export. For instance I named a couple of sequences em_root and em_run. When the exporter exported them they were named em_root.dsq and em_run.dsq. In the cs file for the dts I entered them in like this:
sequence0 = "./em_root.dsq root";
sequence1 = "./em_run.dsq run";
- Script for connecting DSQs to the DTS for all the non-blend animations
Categories: Art | 3d | Modeling



