Forum

User posts trepaning
24 March 2015 02:09
One more issue, with Transform animated mesh: Is there any reason why this Transform animated mesh will not Scale or Transform? The Glow works.

function load_lampFan_cb(data_id) {
    var lampFan= m_scenes.get_object_by_name("lampFan", data_id);
    m_trans.set_translation(lampFan, -.5, 2, 0.45); //xzy
    m_trans.set_scale(lampFan, 0.2);
    m_scenes.apply_glow_anim(lampFan, 1, 1, 0);
}
23 March 2015 20:35
I am not sure if this is at all a handy idea but when I was messing with idTech 4 (Doom 3) engine, there were no vertex animation capabilities, so a fellow named der_ton wrote an export script that added bones to vertex points of a mesh, allowing for complicated animations like the melting Cyberdemon at the end of the "Daikatana 2" Doom 3 mod. Without the exporter, such an animation would not have been possible, or would have been very complicated to animate. I mention this because I am wondering if there would be any file size saved with such export capabilities with B4W. Would a melting sphere animated with bones be a smaller file size than a vertex animated mesh? It does not seem to me that there would be any file size difference, and adding bones may actually make a larger file than a vertex animation export, but it is an idea that I wanted to pass along.
23 March 2015 19:16
All I had to do to be successful was test with the blender bikini girl. All works fine. I am off and running, thanks!
23 March 2015 19:02
Thanks for the info, I have actually tried various versions of what you wrote and have not been successful. Perhaps it is the model I am using, as the bikini dance girl in this thread was just for the sake of this thread, "alex" is actually one of the models from the Junk music video. The mesh called "alex" is skinned to the armature called "alexArmature". That armature, in turn, is parented to "alexEmpty", which allowed me to place the linked model in a main scene. Could "alexEmpty" be preventing anything? I will try this with the blender dance girl later and see if it works. I ASSUME the mesh being parented with automatic weights is what you mean by parented to the armature. Also, I will still need to have a reference to "alex" for the sake of GLOW. Once I have figured out placement of skeletal animated meshes, I am pretty much done with the studies and can go full production.
22 March 2015 19:35
Here is the scene JS, feel free to toss in the bit required if you have a moment. If I figure it out before this post is noticed, I will post the solution. However, chores first…

"use strict";

b4w.register("example_main", function(exports, require) {

var m_app    = require("app");
var m_data   = require("data");
var m_main   = require("main");
var m_scenes = require("scenes");
var m_trans  = require("transform");

var _previous_selected_obj = null;

exports.init = function() {
    m_app.init({
        canvas_container_id: "canvas3d", 
        callback: init_cb,
        physics_enabled: false,
        force_selectable: true,
        background_color: [0.7, 0.9, 1.0, 1.0],//rgba
        alpha: true
    });
}


function init_cb(canvas_elem, success) {
    if (!success) {
        console.log("b4w init failure");
        return;
    }
    m_app.enable_controls(canvas_elem);
    canvas_elem.addEventListener("mousedown", main_canvas_click, false);
    window.onresize = on_resize;
    on_resize();
    load();
}

var m_mouse = require("mouse");


function load() {

m_data.load("json/dyn_load_pos.json", load_cb);

m_data.load("json/alex.json", load_alex_cb);

}


function load_cb(data_id) {
    m_app.enable_camera_controls();
}

function load_alex_cb(data_id) {
    var alex= m_scenes.get_object_by_name("alex", data_id);
    m_trans.set_translation(alex, 111, 0, 0); 
    m_scenes.apply_glow_anim(alex, .95, 1, 0);

}



function main_canvas_click(e) {
    if (epreventDefault)
        epreventDefault();
    var x = e.clientX;
    var y = e.clientY;
    var obj = m_scenes.pick_object(x, y);




var alex= m_scenes.get_object_by_name("alex");
    if (obj && obj.name == "alex")        window.open("http://www.blend4web.com/");


;


}




function on_resize() {
    var w = window.innerWidth;
    var h = window.innerHeight;
    m_main.resize(w, h);
};



});



b4w.require("example_main")init();
21 March 2015 23:23
this no longer works as a way to position the JSON file in the main scene, any info appreciated yet again!

function load_alex_cb(data_id) {
var alex= m_scenes.get_object_by_name("alex", data_id);
m_trans.set_translation(alex, 111, 0, 0); //xzy
m_trans.set_scale(alex, 5);
m_scenes.apply_glow_anim(alex, .95, 1, 0);

}

the Glow does work, but translation and scale do not. Model is called "alex", armature is "alexArmature". I am assuming I have to do scale and translation to the armature, but I currently do not know how to implement it.
21 March 2015 22:41
And that's how easy it is to work with Blend4Web!
21 March 2015 21:25
Here is another bone animation question for you:

As cool as I think this is, and I think it's pretty dang cool

http://www.trepaning.com/b4w/blenderDance.html 10 megs

it is not what I wanted to achieve, so any insight as to what the issue may be is appreciated.

http://www.trepaning.com/b4w/blenderDance.blend 18 megs
21 March 2015 18:42
The silver platter was handed to me in the SDK, so thanks for that. I just had to look at the fan's .blend file and all was revealed. Works great!
21 March 2015 17:14
Like most things with B4W, updating is easy, but also changes to systems at work are monitored, so I just have to make sure the admin is good with it before it happens and we're in a major project at work, so no real time to bother anyone for permissions. There will be more free time at work to do B4W soon. At home, I tested with the updated version and all is well BUT the glow effect does not work in IE when loaded in as JSON (though I have not tested to see if Glow works in an HTML export). I will try to get multiple bone-animated JSON files loaded into a single main scene over the weekend, but am still okay with the solution being handed to me on a silver platter…! :)