Not logged inOpenClonk Forum
Up Topic 3D mesh rendering

This board is threaded (i.e. has a tree structure). Please use the Reply button of the specific post you are referring to, not just any random button. If you want to reply to the topic in general, use the Post button near the top and bottom of the page.

Post Reply
In Response to Clonk-Karl

> mixing two animations that use different bones: individually animating f.e. upper- and lower-body (or door and forge!)


I have implemented this; it is available using the following C4Script functions:

bool AnimationPlay(string animation, int weight);
bool AnimationStop(string animation);
bool AnimationSetState(string animation, int position, int weight);


position is given in milliseconds. weight is used when two or more animations which are played concurrently affect the same bone. In that case, weighted linear interpolation is applied, with the given weight for the given animation. If only one animation is played, then weight is not used, but it must not be zero. For AnimationSetState(), both position and weight can be nil to keep the current value. Note that when calling AnimationPlay() is called the Animation is not played automatically; instead one needs to call AnimationSetState() with increasing position periodically. If Günther allows me to introduce another per-object variable, then I can add another parameter to play the animation automatically for this though ;)

If an animation is played via the "Animation" ActMap entry then it's weight is 1000. If the action is already played before, then it is reset to the beginning and it will stop when the action changes again. I'm not exactly sure whether this scripting interface should replace the ActMap one, or whether they should stay side by side. Any input on this is welcome; also on the C4Script interface.

A demonstration of the functionality can be seen in the Outset.c4s scenario in the mesh branch: A clonk is playing the "Walk" animation, but every once in a while it changes to "Jump", smoothly fading between the two animations.

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill