Forum

Help with the binding of actions to character

20 May 2017 14:37
Hello again:

I keep trying with the fps module. I've been setting up an scenery, which has been very interesting, configuring the lens flare, day time and all that is really easy with the api options, great work. The sea is still half the way as it is a pretty complex setup to understand, up to now I have had good results with the normal maps and the foam, now I'm gonna try to understand how the coastline works, I stil haven't get it. If you have any hint it will be welcome.

The tree setup with the wind system is great, too. I have only found a bit of problems in the vertex painting as it would left some of the vertex static and the mesh of the trunk would mess up. Repainting the vertex I got a better result but still need to get better at that. Anyway it is very convincing the wind setup and all that.

But, now I'm starting with the animations of the character, I'm not sure which is the best approach to bind the animations to the character physics object. Would adding a new action to the key with a callback to call the exported skeletal animation be a good approach? I don´t see how to modify the default states of the character to apply the corresponding animations: walk, run…

If you can help me with this I will be grateful.
Thank you
21 May 2017 05:37
See if these two videos on character animation help you:
https://youtu.be/1S5QttQBT3A
https://youtu.be/VGgggZUNOew
I am still learning in this area, let me know how if this is what you are looking for.
21 May 2017 22:48
Thank you Will for taking the time of answering me. I have watched the videos and got a better understanding of the baking process, I haven't done anything yet with blend4web but it seems pretty easy.

But what I'm asking for is about the fps module that now comes integrated in the api. You have the basic movements of the character already implemented and a state machine and several tweaks for controllers even VR. So I would like to understand it and follow that line.

If I get the trick I will post it here.

Thank you
22 May 2017 00:35
Hi again:

At last I found the way and it was more a problem with the documentation than anything. In this example of the api docs:

var m_fps = require("fps");

var move_cb = function(forw_back, right_left) {
    console.log(forw_back, right_left);  
}

m_fps.enable_fps_controls({
    character : null,
    element : null,
    motion_cb : move_cb
});


the motion_cb is not correctly set with that syntax. You have to do it:

m_fps.enable_fps_controls(character, null, move_cb);
// Without the brackets


And it gets correctly configured. Then when you move you get the callback correctly and you can trigger the appropiate actions. Fine.
22 May 2017 11:51
At last I found the way and it was more a problem with the documentation than anything.

Good day and thank you for pointing out this problem. We will update the documentation as soon as possible.
Blend4Web team - Editor
22 May 2017 13:30
Happy to help
 
Please register or log in to leave a reply.