论坛

由用户创建的信息 Evgeny Rodygin
26 October 2015 12:39
This topic is more about mathematics now as for me
Anyway, in order to solve this task we need to know what kind of behavior is acceptable for us.

I think, one of solutions is to recalculate a new pivot depending on the current camera direction like it is done in the camera.js module inside the set_move_style method:

var cam_eye = m_cam.get_eye(camobj, _vec3_tmp);
var view_vector = m_util.quat_to_dir(cam_quat, m_util.AXIS_MY,_vec3_tmp);
var pivot = m_vec3.scaleAndAdd(cam_eye, view_vector, PIVOT_DEFAULT_DIST, view_vector);
m_cam.set_pivot(camobj, pivot);


Where PIVOT_DEFAUL_DIST is set to 10 by default. You can play with this value in order to get the best result. I would start from something like 100 meters. This way, we'll really get something like pivot from the EYE camera.

[EDIT] Removed internal properties usage from the code.
26 October 2015 11:45
Thank you for the example.
I haven't noticed one simple thing. You have a line in the app initialization:
        physics_enabled: false

It should be set to true. Console says that the character has no physics but actually the whole scene has no physics.
We'll add more evident warning for such cases.

After enabling physics you need to put uranium.js and uranium.js.mem inside your app folder (they can be found in sdk/deploy/apps/common).
And also you need to apply scale for the physics plane because bullet doesn't know a thing about scale. And it is always better to apply scale for anything related to physics.
24 October 2015 00:10
Well. The settings look perfectly ok for me. The only thing we left to do is to check your scene. Could you please provide us a small example which doesn't work for you? (without actual buildings, just a character and some sample collision plane)
24 October 2015 00:01
Ответ на сообщение пользователя philippo
Hi there,

I can confirm the memory leak on linux, firefox 41.0.1.
Pity, otherwise blend4web is a dream come true, awesome project. But the memory issue is a showstopper for right now…

Anyways, keep up the good work!
Hello,
Could you please provide us further info on this problem? Which demo causes memory issues? Which Blend4Web version do you use? And what kind of tools do you use to detect this leakage?
22 October 2015 09:04
Hello!

And the view is now related to the mouse movement, it works fine on Firefox
but it doesn't work on safari, any idea why?
This is because Safari (as well as IE and Opera) still doesn't support PointerLock API. We can only wait for them to add this feature.

My main problem though is that the Key controls are not functioning, is there something I might have missed in the code or in the scene set up?
The code looks ok for me.
Several reasons can cause such an issue:
1) If you try to use keyboard inside an iframe, you need to set focus to it before. Here is a similar thread.

2) Maybe, your physics setup for the character or the scene is wrong. Please check if all settings look similar to what we have in tutorial. There should be some console output if this is the reason.
If you won't be able to find something suspicious, then it is better to make screenshots with scene and character setup.
20 October 2015 14:38
Well. If we'll take a look at the app, we can see that the camera switches to EYE only after reaching some specified point. So, if we store the last pivot before switching to EYE camera into some global variable we can then restore it whenever we need it. In our case we should assign it to the camera after changing its type to TARGET again. I think, this should work.
20 October 2015 11:09
Good day,

Blend4Web currently supports only one shadow source. So you won't be able to have shadows from all the sources on the scene. In future we are planning to add support for up to 4 lights and add a dynamic shadow switch, so that only required lights will cast shadows.

The Generate Shadows flag just solves the ambiguity with several lights so that the engine can choose which light should cast shadows.
19 October 2015 18:57
Ответ на сообщение пользователя John
Hi Roman,

This is John, I work with Dany on the same project. Thanks for your help so far, really appreciated :)

Referring to your last comments about the texture. The walls are one big box object that have the same texture and it is set to Repeat under "Image Mapping". In fact, all textures images mapping for the Floor and Marble Border are set to repeat (see repeat.jpg).

When we run the exported JSON file in the Viewer, we get some part of the Walls, Floor and Marble Border texture rendering properly and some parts not. (see 3DMuseum-JSON.jpg). When we render the image by pressing F12, all textures load properly (see 3DMuseum-Blender-Render.jpg).

Is there any extra setting we need to adjust to get the texture rendering properly for web?

Thanks for your help in advance.
John
Hello and welcome to the forum John!

I suppose, you use textures which have dimensions not equal to power of 2 (4, 8 ,16, 64, 128, 256 etc). We call such textures NPOT. WebGL doesn't support tiling for this type of images. So you need to modify them to be POT.
This is an old problem and we are happy to say that it was recently solved by us and the a fix will be included into the 15.10 release later this month
19 October 2015 17:02
Thanks for the example. Now we can see the picture.

This problem occurs because of the implicit camera pivot recalculation inside the camera.set_move_style method. For target camera it is just being placed to 10 meters in front of the camera.

What you can do to fix this issue is to set the pivot to the right value just after calling the set_move_style function. This can be done with the set_pivot method.
19 October 2015 13:13
De Balie conference hall will open its doors to the visitors of the annual Blender Conference this Friday!

Tickets were sold out but anyway if you want to watch all the program in real time you can do it on the youtube channel. The Blend4Web speech will take place on Saturday at 14.30 in Amsterdam local time. Don't miss it!