Forum

How to use NLA in blend4web

11 January 2017 18:58
Hello, I want to use the shape keys to make expressions, so I use the key frame in animation to make the expression action clips editor and add the action clips in NLA editor. Then I export it to json file and use the js to control the play of the action, the code is shown below:
if (obj) {
		if(obj.name=="a")
		{
			m_nla.set_range(0, 100);
			m_nla.play();

		}

But It can not work, in addition, I have not check the logic editor.
Look forwards to your reply, thanks!
11 January 2017 19:09
I don't know how to make it,
12 January 2017 16:54
Hello, I want to use the shape keys to make expressions, so I use the key frame in animation to make the expression action clips editor and add the action clips in NLA editor. Then I export it to json file and use the js to control the play of the action, the code is shown below:
if (obj) {
if(obj.name=="a")
{
m_nla.set_range(0, 100);
m_nla.play();

}

But It can not work, in addition, I have not check the logic editor.
Look forwards to your reply, thanks!
I can't fully understand your question.
Could you please provide more details and attach example project (how to export project)

[UPD]
I have not check the logic editor.
I've attached an example of applying shape keys via logic nodes
Blend4Web Team - developer
Twitter
LinkedIn
15 January 2017 08:37
Thank you, dear Konstantin Khomyakov.I upload the exported files here.Make it clear, I want to Control the playback of the action clips in NLA editor. So I write the js code like this:
function main_canvas_click(e) {
    if (e.preventDefault)
        e.preventDefault();
    var x = m_mouse.get_coords_x(e);
    var y = m_mouse.get_coords_y(e);
    var obj = m_scenes.pick_object(x, y);
    if (obj) {
		if(obj.name=="a")
		{
			m_nla.set_range(0, 25);
			m_nla.play();
			//m_nla.stop();
		}
}
}
. I want to realize the function when I hit the object named "a", then the action in the NLA will be played. But now it cannot work, so I need your help, thanks.
15 January 2017 09:18
wow, the exported project file is too big to upload. Maybe I can send a email to you, if that is convenient, dear Khomyakov.
16 January 2017 19:51
Reply to post of user Konstantin Khomyakov
I can't fully understand your question.
Could you please provide more details and attach example project (how to export project)

[UPD]

I've attached an example of applying shape keys via logic nodes
Hello, I still can not realize the function, and I don't know how to solve it.
16 January 2017 19:51
Reply to post of user Konstantin Khomyakov
I can't fully understand your question.
Could you please provide more details and attach example project (how to export project)

[UPD]

I've attached an example of applying shape keys via logic nodes
Hello, I still can not realize the function, and I don't know how to solve it.
16 January 2017 23:37
Hello, I still can not realize the function, and I don't know how to solve it.
Hello!
Have you enabled NLA in your scene settings (https://www.blend4web.com/doc/en/scene_settings.html?highlight=nla#nla) ?

Also can be checked in code directly: https://www.blend4web.com/api_doc/module-nla.html#.check_nla
Blend4Web Team - developer
Twitter
LinkedIn
18 January 2017 06:23
Yes, I enabled the NLA in my scene settings, and if I enable "Apply default animation", the animation will play when the webpage is open. But I cannot control the playback of the animation.
18 January 2017 07:34
Reply to post of user Konstantin Khomyakov
Hello!
Have you enabled NLA in your scene settings (https://www.blend4web.com/doc/en/scene_settings.html?highlight=nla#nla) ?

Also can be checked in code directly: https://www.blend4web.com/api_doc/module-nla.html#.check_nla
Maybe I can send a email to you and send the files to you, if that is convenient, dear Khomyakov.
 
Please register or log in to leave a reply.