Finally I "cracked" the problem of activating different "pre-baked" animation files (.anim files) from within the javascript of outerra models, thanks to this outerra github webpage
https://github.com/Outerra/anteworld/wiki/Animation-API
It was then only a matter of adapting this to launch multiple animated actions. Below are the essential statements to be included in the javascript file.
As an example I used several test animation files that I had made in blender and imported into outerra (see above discussion...many thanks again to patmarrnc!! for speeding up this achievement).
I was able to activate them from within the javascript of a character using as a control variable the speed of the character motion (he is configured as a vehicle,using transparent/invisible wheels as for my bicycle).
It turned out that the animations could fit more or less to a character that does ice-skating (without skates so far !) by using a bad "walk-cycle" - good however for ice-skating !
Since I discovered this solution just few days ago I have not had the time yet to set up a better animation for demonstration. I am just beginning to learn blender in general and animating characters in particular.
Here is the otx file of the animated character for download from dropbox https://www.dropbox.com/s/92rmeqpr3ozkzm8/Patrick1.otx?dl=0The blender file of the model can be downloaded from here
https://www.turbosquid.com/3d-models/human-male-3d-model/504883He will appear as a vehicle "PatrickBoned3-hi" in the outerra menu. As usual for vehicles use "w" for moving forward, "s" for breaking, "a" and "d" for moving left and right. By using "v" you can switch between different camera views among which notably a "fly-by" mode that I developed (still to be optimized but promising). Also using the "+" and "-" on the numeric keyboard zoom in and out.
Enjoy ! and BUILD ON IT !
Here is a video of some action recorded on ice ! Below are the essential javascript statements to activate different animations (.anim files) depending on a control variable. I chose the "h" key (horn action of vehicles) to switch between two different animations. By the way, by changing the speed3 and the limits for kmh for switching between different actions you can also make him walk normally instead of skating.
So now with these simple commands it becomes possible for us to develop animated characters performing many different complex actions either through keyboard control or controlled by in-game algoritms implemented in the model javascript (maybe walking, climbing, swimming, etc... automatically depending on the terrain properties).
Together with andfly's great approach we have now two ways to make complex programmable animations inside outerra !
There is really no more excuse now not to develop lots of animated characters for outerra ! Or allmost. The only limitation that I still see is that in any case so far we are limited to modify characters treated as vehicles so they will not be able to move as freely as we wish. The "real animated character" (with total freedom in all regards) as the outerra mercenary is defined as object with physics="character" not physics="vehicle" but for me at least it is unclear how and where the physics of the mercenary is defined and how we could mod it.
var _animation1,_animation2;
var flag=0;
var sincro=0;
var speed1=1; //any positive float value
var speed2=1; //any positive float value
//invoked only the first time the model is loaded, or upon reload
function init_chassis(){
...
_act_horn = this.register_event("car/controls/horn", horn_action);
....
}
//invoked for each new instance of the vehicle
function init_vehicle()
{
...
this.geom = this.get_geomob(0);
_animation1 = this.geom.load_animation("Scene1.anim", "", 0);
_animation2 = this.geom.load_animation("Scene2.anim", "", 0);
...
}
function horn_action(){
if (flag==0){
flag=1;
}else{
flag=0;
}
}
//invoked when engine starts or stops
function engine(start){
...
}
//invoked each frame to handle the inputs and animate the model
function update_frame(dt, engine, brake, steering)
{
...
sincro=sincro+dt;
if (flag==0){
this.geom.get_animation_stack().blend_animation(_animation1, 1, true, (speed1*sincro)%1);
} else {
this.geom.get_animation_stack().blend_animation(_animation2, 1, true, (speed2*sincro)%1);
}
this.geom.animate();
...
}