Home | Features | Roadmap | Learn | Documentation | ||
Latest version: Tramway SDK 0.0.9 Github Quick links Home Get Started |
Animation ComponentThis EntityComponent plays back animations. More precisely, it generates pose matrices for the deformation of 3D models. It basically lets you animate 3D models. With this component you get 8 tracks to play back animations on. You also get an additional track for procedural animations. Multiple animations get added together. This can be used to animate parts of characters seperately. The playback speed of animations can be changed. This is useful for movement animations. You can also set up weights for animations. For example, you could create a nodding animation for a character. Then you could play it back with a weight of 0.2 to get a slight nod, 0.5 to get a normal nod and 1.0 to get a very enthusiastic nod. There are also fade-ins and fade-outs, which gradually increase or decrease the animation weight. This could be used, for example, if you created a walking animation for a character, which you could fade out, to make the character appear as if it is gradually coming to a stop. There is some limited animation re-targeting – if the model for which you created the animations has an armature which is similar enough for the model which you want to animate, you can play back the same animations ande everything will work. The bone names do need to be exactly the same in both models. Programming in C++
The only thing that you need to do before initializing this component? You need to feed it a model. This has to be a dynamic model, since static models have no bone data in them.
Component<AnimationComponent> component;
Then you can begin playing some animations. You do need to make sure that the animation that you want to play is already loaded, since I forgot to add the code for them to be automatically streamed in. Anyway: Animation::Find("mongus-run")->Load();
component->PlayAnimation("mongus-run",
-1,
1.0f,
1.0f);
If you look closely, you will notice that we set the number of repeats to -1. This means that it will repeat for a very long time. It will stop eventually, but it will take at least 2 years for an application running at 60 FPS. To actually view the animation that you are playing, you need to attach it to a RenderComponent.
Component<RenderComponent> model;
The possibilities of animation playback are limitless. Check the API documentation for more information. Scripting in LuaStill working on this. |
|
|