User posts davide.lanfra
26 September 2017 13:22
Hello everybody,
I have some super-newbie questions .

My objective is to load some scenes (following the tutorial Dynamic Loading tutorial) and put them in a row in the center of the scene (I'm using a target camera). For this reason I would like to:

    -load the scenes (each one with a single object) and store them in an array;
    -loop the array, find and sum the objects widths;
    -in another loop set the position of each object with the set_translation method; I thought to find the position of each one from the center of the scene (x = sum of previous objects widths) and substract half of the total width.

I hope that it makes sense. Here come my newbie questions.

1) Is it correct that Blend4Web do not have a method to group meshes? For example, I wanted to group all the meshes to position the whole group in the center, but I could not find a way to do it.

2) I'm struggling to find a Javascript API method to get the width of an object. I understood that in 3d space I have to leave my bias and I should not search for the width, but for the dimension in one of the axis. I tried to use the get_object_bounding_box and the get_matrix methods, but my uncertainty about 3d concepts left me with nothing. How do you find, for example, the x dimension of an object?

3) Would you do this task, putting objects in row, in a different way?

Thanks everybody for every advice to understand better how to do something like that.
17 February 2017 16:19
Update, for the posterity ;).
I resolved the issue. It was a problem of the material in Blender.

In the material tab i had to switch on the "Show transparency" checkbox and set the alpha to 0.
In the influence settings (under the textures tab) i had to switch on "alpha" and set it to 1.
17 February 2017 14:13
Hello everybody!
I'm tying to customize a mesh in a Blend4Web exported scene, but I'm having some issues with a transparent background canvas.
Following the code snippets I was able to set the texture of a mesh as a canvas. Everything works well for opaque textures.
Now, I should add some custom text to a mesh. For this reason I duplicated some faces a moved them away a little bit from the original mesh, to avoid z-fighting issues.
The problem is that when I set the canvas texture with a transparent canvas with some text on it, the mesh show only a black surface. If I add a background to the canvas, I see the texture, correctly mapped, but I loose the effect that I need: add a text to a surface.

Do you have any advice? I tried also to set a double material on the mesh, the material shared with the original mesh and one with the canvas texture…without success. The result is the same: black surface.

I'm new to this field and maybe I'm loosing something obvious…