Controlling object and NLA with buttons

22 October 2017 17:49
Hi all, after understanding material and lighting, I'm working on movements and animations, but now i'm stuck with two problems:

1) I successful followed this tutorial of Ian Scott:

But I'm not able to find the right solution to create two different movements on suzanne when I click one of the cone (my example moving up and down while rotating).
I have attached an image with three different solution I tried (no one of them was right).

2) The second problem isn't a real problem; I have created some NLA animation of different objects, when I launch the "fast preview" blend4web" deploy them correctly, which is good. Now I want to control these NLAs clicking on a mesh like the cone of the first problem.
How I can "connect" these NLAs to a "button"? I made some tries with "play animation" and "play timeline", but I didn't understand how to do it.

Thanks in advance to everyone can help me to understand my problems.
20 June 2018 17:59
Hi,guys, i'm new to Blend4web, thk for the really goodjob you did with B4W.
I have the same question and find no answer, did you find something ? @Havokhin
Or someone have a solution or an explication ?
Thk a lot for your answer.
20 June 2018 20:18
Hello guys.

So, for the first question, Havokhin's node setup contains errors (see the warning triangles) because you must never have the same object occur more than once in a Switch Select. Note: In the latest B4W versions, "Switch Select" was renamed to "Select".

Here is the correct node setup for moving and rotating the monkey head at the same time. It requires the objects "Suzanne", "ConeUp" and "ConeDown" just as in Ian's video tutorial:

For the second question, "Play Animation" is the correct node for this. I made a scene with a small cube falling from a big cube by setting Loc/Rot keyframes on the small cube:

With the following node setup, the animation of the small cube will play whenever the big cube is clicked:

This setup requires the objects "CubeSmall" and "CubeBig". "CubeSmall" must have an animation and the animation name is "CubeSmallAction" (this name is automatically given when you make the animation). You have to type that name in the "Anim. Name" field of the node. You can always find out the name of an object's animation by looking at the outliner under the object name:

If you do not want B4W to wait for the animation to finish, check the box "Do Not Wait" in the Play Animation node. If the box is checked, the system returns to the "Switch Select" node right away and the user will be able to interrupt and restart the animation at any time. If the box is not checked, the system waits at the animation node and returns to the "Switch Select" only after finishing the animation, thus user clicks will be ignored until the full animation has been played.
Please register or log in to leave a reply.