Bone animation help please

24 March 2015 21:49 #1804
As I see the missing part is applying both API transformation and animation to the same object. In our current implementation, animation is applied to an object as a whole (Loc+Rot+Scale) even if you insert keyframes partially. Still it's possible to achieve the same effect if object is duplicated by another EMPTY object. Just add your animated object inside a group, then duplicate this group by EMPTY, then set "Relative Group Coords" option on the EMPTY, and finally, apply any transformation you want to this EMPTY.
This sounds somewhat difficult, so in the future we plan to simplify this allowing application of animations/transforms to parented objects.
Blend4Web Team
24 March 2015 22:36 #1805
Okay, just tested that, it works, just need to place the main object out of sight unless there is another way to make the model that does not scale or transform not show up while still showing the duplicate. Also, how to add GLOW or Selectable to the Empty object? It's not important because with bones and vertex, all is pretty much covered, so no need to figure out hacks or fixes, but with object transform meshes able to be scaled and transformed, there would be no limits to what can be used.
25 March 2015 09:29 #1810
In our workflow the method works pretty well, because we frequently use secondary scenes and link groups from that scenes. So no need to place objects somewhere behind the camera view. GLOW and Selectable always applied to MESH objects, because EMPTY has no geometry and thus no volume to apply effects to. This also should not be a problem, just use get_object_by_dupli_name(empty_name, object_inside_group_name) from the scenes module to get any object inside the duplicated group.
Blend4Web Team
25 March 2015 20:11 #1822
mesh displays and animates, but not transformable or glowing as per my quick tests.

function load_empty_cb(data_id) {
    var Empty= m_scenes.get_object_by_name("Empty", data_id);
    var lampFan= m_scenes.get_object_by_dupli_name(Empty, lampFan);  //also tried ("Empty", "lampFan")
    m_trans.set_translation(Empty, -2.5, 2, 0.45); //xzy
    m_trans.set_scale(Empty, 0.2);
    m_scenes.apply_glow_anim(lampFan, 1, 1, 0);
25 March 2015 20:44 #1823
var Empty= m_scenes.get_object_by_name("Empty", data_id);

In your file the duplication empty object is named "Group". There is an object named "Empty" in your file but it is not used.

var lampFan= m_scenes.get_object_by_dupli_name(Empty, lampFan); //also tried ("Empty", "lampFan") 

The second variant is correct: String arguments should be used in this method (see the API doc for argument types). Again, "Group" instead of "Empty".

EDIT: having JavaScript console open might be also useful for debugging. Just hit F12
Development Lead | Twitter
25 March 2015 23:42 #1826
Works perfectly, thanks for the final piece of the puzzle! (for now…)

Hmm, actually, ALMOST works perfectly. Still no GLOW but will look into it in a bit.
26 March 2015 10:55 #1830
Take a look at my example, please
var empty = m_scenes.get_object_by_name("Empty");
var obj = m_scenes.get_object_by_dupli_name_list(["Group", "lampFan"], empty);

You linked a group and you can use get_object_by_dupli_name_list to get the object "lampFan"
m_scenes.apply_glow_anim(obj, 0.2, 3.8, 1)

This function applys the glow-animation to the object
Blend4Web developer
26 March 2015 19:35 #1837
Great info, I will test it out later. These object animated meshes are a bit of a process bugger compared to the other animation types. Still, it is good to get all that info in one place regarding the different animation types.
31 March 2015 04:36 #1894
with the last example, can you supply it as is PLUS transform it to 20% of its size and offset it by a spacing or two.
31 March 2015 10:49 #1898

with the last example, can you supply it as is PLUS transform it to 20% of its size and offset it by a spacing or two.

The engine doesn't support it yet. Your scale will be replaced by the scale from your animation.
But you can rotate the object via API. In this case you can use transforming and resizing.

Blend4Web developer
Please register or log in to leave a reply.