User posts HotGoblins
13 October 2016 11:13
Ok thanks, I managed to recover fps.
For interested :
function fps_cb(fps_avg, phy_fps_avg) {

    function load_cb(data_id) {   

Now, I noticed in the main.js some interesting things :

- get_rendered_info() –> What is exactly this infos ? How display or exploit this ?

- pause() –> This method pauses the application but what exactly ? The refresh ? The shadow calculation ? Events ? Everithing ?

pause() is interesting if it release computer capacity, so I want paused my app if the user is in a other webpage and replay if the user come back. How know if the app (or web page) is active ?

I'm not crazy ! My reality is just different than yours.
13 October 2016 10:09

Your problem is : your normals is invert !
Select your terrain, Edit mode, CTRL+N.
If this doesn't work, CTRL+N once again and check Inside in the Tools panels.

You can put a light below and upper your terrain to check, one side work great in both cases.
I'm not crazy ! My reality is just different than yours.
12 October 2016 17:43

For my project, I use .json export format and I noticed that we want display FPS, we can use :

exports.init = function () {
            canvas_container_id: "main_canvas_container",
            callback: init_cb,
            physics_enabled: true,
            show_fps: true

So : "show_fps: true".

My question is the following :

Is there a way to display fps but in a controlled manner?
I wish I could change where it appears, font color, font size…
It's possible ?

Thanks in advance.
I'm not crazy ! My reality is just different than yours.
11 October 2016 16:03
I didn't know this technique, It works, It's great !
Thanks Evgeny

[edit :]
And where I can find the others parameters reference like your ".b4w_selectable" please ?
In the doc, I find only module.
I'm not crazy ! My reality is just different than yours.
10 October 2016 18:09

Is it possible to affect "Selectable" to many objects by one click ?

I have a lot of objects and actually I select each object one by one to affect this. It's boring.

I'm not crazy ! My reality is just different than yours.
21 September 2016 15:16
I'm interesting about this question and I don't have the respond.

Waiting you can :
put your walls "Selectable"
not select "Enable outlining"
and in your script, if you click on your walls, you don't do anything
I'm not crazy ! My reality is just different than yours.
19 September 2016 11:12

For a question of programming, to rotate a camera like this button, you can create an empty in Blender and positionne this in the center of the scene. Your camera will look at this empty. Now, parent your camera with your empty and just rotate your empty in vertical axis for create an orbiting camera. (If I understand your question).

After, create a button who rotate this empty at first click and stop this rotation if you click elsewhere.

I hope I helped you.
I'm not crazy ! My reality is just different than yours.
16 September 2016 10:56
Like always, thanks Yuri !

I did not remember this app exists while I had just found great few weeks ago.
After some tests, I managed to do what I wanted.

For those who are interested. To create a raycast with a 3D object, it's necessary :

In Blend file :
  • Active "enabled physics".
  • In the 3D object who cast the ray, active "Object Physics".
  • In the 3D object who receive the ray, add a material and enable "Special: Collision".
  • (The collision ID allows to target only certain objects)

In javascript :
function my_function() {
        var obj_src = m_scenes.get_active_camera(); //the ray begin at camera's position
        var begin_ray = m_vec3.fromValues(0, 5, 0); //the ray begin 5m above obj_src...
        var end_ray = m_vec3.fromValues(0, -5, 0); //... and ends 5m below obj_src

        var ray_test_cb = function (id, hit_fract, obj_hit, hit_time, hit_pos, hit_norm) {

            //my calculations
            var pos_player = m_trans.get_translation(_player);
            m_trans.set_translation(_player, pos_player[0], hit_pos[1] + _PLAYER_HEIGHT, pos_player[2]);
        var id = m_phy.append_ray_test_ext(obj_src, begin_ray , end_ray, "Floor",
                    ray_test_cb, true, false, true, true);

To understand how "m_phy.append_ray_test_ext" and "ray_test_cb" works, see
append_ray_test_ext and
I'm not crazy ! My reality is just different than yours.
14 September 2016 16:04
Hi and thanks for your helping.

So far, I managed to calculate an intersection between a 3D Point and the screen
–> use m_cam.project_point()… , it's OK.

I managed to calculate an intersection between a 2D click with a plan in the 3D space
–> use parametric line, m_cam.calc_ray, m_math.line_pline_intersect …, it's OK.

Now, I want to calculate an intersection between a parametric line and an object but I dont't know how it works in Blend4Web. It is possible ?
I say it's works on Unity with : Physics.Raycast( transform.position, -Vector3.up, out hit, 50, LayerMask.GetMask("myFloor") )

To illustrate :
I want, every time I move my player, calculate the distance between my player and the fake floor not-rendering. If this distance is higher or lower than my constant (1.7m), I modify the Y value of my player's transform to my constant. Like this, the player is all the time "standing".
Create a fake floor like this allows me to create an other floor to smooth the steps of a staircase for example.

My problem :
In this example, I don't use the pline/plane intersection method because my fake floor is not a plane.

An other possibilty ?
To overcome my problem, I thought to use physics with my player and my floor but I'm not really convinced to use physics. if it's possible, I would rather do without.
I'm not crazy ! My reality is just different than yours.
05 September 2016 18:10
It's written in the doc and I could notice this :

Shadows from Point light sources are generated the same way as from Spot light sources and are projected only in one direction specified by the source’s Rotation parameter.

Why ??
A point light shines in all directions and it should be the same for its shadows.

For example, I wanted to illuminate just a room in my scene, so I put a point light in the room but like the shadows are only in one direction, the others rooms are illuminate too. Four walls should be able to completely block a lamp.

What do you think ?
I'm not crazy ! My reality is just different than yours.