Loading animated geometry (TVA)
Since static meshes aren’t really fun, we’re going to add some flavor to our projects by adding an animated thing into the scene. It’ll be some kind of monster, just to see what you can do with it. It will be doing a simple animation, it will just swing its arms a bit and growl (no sound, since that’s something totally different).
Note: make sure you’ve got the may 15th 2008 release of TV when running this sample, otherwise the rancor won’t be drawn.

What do we need?
- First of all we’ll need an animated 3D object. We’re lucky that the forum user Delaney has provided us an animated object, which is the monster. It’s saved as a *.tva file, which is the native animated object extension of TV. Normally you’d export the file from for example 3ds max as a *.tva or as an animated *.x file.
- A TVMesh isn’t able to play animations, it’s just a static object in the 3D world that can move and rotate, but it’s not able to have arms that bend etc. Therefore, we’ll use a TVActor. A TVActor is a dynamic object in the 3D world that can play animations and ofcourse a lot more, but that’s not what this tutorial is about.
How do we set things up?
- We need to delete the TVMesh and substitute it with a TVActor. We’re using private Rancor as TVMesh or any equivalent to that in your language. Then we need to instantiate it. It’s done the same way as a TVMesh, but with a slight difference. We’re now calling
- We need to load the model into the TVActor. This is done the same way as a tvm file, by calling LoadTVA this time. The first parameter is the path of course. The second one defines if the texture that are specified in the tvm file should be loaded. The third one defines if the shaders should be loaded. We haven’t done shaders yet, so i won’t go into depth with those, since you’ll find out what they are in some tutorials 20+.
- We apply the same material we used before, but we don’t want to have specular lighting on the Rancor (our model), since that looks ugly. That’s why we put the specular reflection in the material creation to 0.
- If we would show the rancor on our screen right now, it would show it’s back to us. There are 2 options to see his front, by changing the camera, or in our case by rotating the actor around the y-axis (the up axis). We’re rotating it by 180 degrees.
- Now we need to specify which animation will be played on the screen. We’ll choose animation 1 for now. Of course we also want the animation to loop in this case, so the actor will keep moving instead of just swinging its arms once. This is done in these 2 lines:
Rancor.SetAnimationLoop(true);
- Now we tell the TVActor to actually play the animation.
The parameter you can adjust takes care of the animation speed. If you want to have something animate realy slow, you place a low number in there, if you want it to animate quickly, you put a higher number in there.
- We’re going to have normal mapping on the rancor, so we tell TV to use it.
- Last thing we need to do is adjust the camera position. We’re going to set the camera at a good distance, and we’re going to make it look to the rancor’s face. This is done by:
The first three parameters specify the position of the camera in the 3D world (x,y,z).
The last three parameters specify the look at point. The look at point is the point the camera is pointing to. It’s pretty straight forward
How do we render this?
- This is easy, since we just substitute Cube.Render() with TVActor.Render(true). The parameter specifies whether the actor should go 1 step further in the animation. This is usefull when you need to render the actor multiple times per frame and you don’t want the animation to go fast forward.
Things you can add/change yourself
- The rancor model we’ve been supplied with contains more than 1 animation. Try changing the animation.
- Try playing with the animation speed and the animation loop boolean, see what the effects are like.