Forum

Ray test callback not excuted....

30 October 2017 13:01
I clone the code snipet by making project in demo page.
And I found something interesting.
exports.append_ray_test = function(obj, from, to, collision_id, callback,
        autoremove, calc_all_hits, calc_pos_norm, ign_src_rot) {

    var id = get_unique_ray_test_id();

    var test = {
        id: id,
        body_id: obj ? obj.physics.body_id : 0,
        from: new Float32Array(from),
        to: new Float32Array(to),
        collision_id: collision_id,
        collision_id_num: col_id_num(collision_id),
        autoremove: autoremove,
        calc_all_hits: calc_all_hits,
        calc_pos_norm: calc_pos_norm,
        ign_src_rot: ign_src_rot,
        callback: callback
    }

    // NOTE: it's not possible to determine the worker in no obj specified
    var worker = find_worker_by_body_id(test.body_id) || _workers[0];
    var scene = find_scene_by_worker(worker);

    var sphy = scene._physics;

    sphy.ray_tests[id] = test;
    sphy.ray_tests_arr.push(test);

    m_ipc.post_msg(worker, m_ipc.OUT_APPEND_RAY_TEST, test.id, test.body_id, test.from,
            test.to, test.collision_id_num, test.autoremove,
            test.calc_all_hits, test.calc_pos_norm, test.ign_src_rot);

    return id;
}

I add a breakpoint in below codes.
Ray test instructions have been added in scene._physics.ray_tests.
But callbacks always been hang up…

Anyone can help?
30 October 2017 15:19
Hello and welcome here.

Could you send us a demo which contains the problem?
We are using message system between rendering and physics, so the callback is called after a message has come from physics engine. May be the problem is there.
Blend4Web Team
kirill@blend4web.com
31 October 2017 05:09
Thanks for your kindly reply.
This demo which I am using is intergrated with a complecated system. I need more time to isolate.
31 October 2017 06:07
Kirill, you can clone the demo from git@github.com:henrydf/b4w-raytest-demo.git

Thanks for your help.
 
Please register or log in to leave a reply.