论坛

由用户创建的信息 Ivan Lyubovnikov
02 November 2015 15:57
You can use main.set_render_callback() for this task.
or main.append_loop_cb()
30 October 2015 17:39

What do you mean by this, doing this i get a vector, and im assuming its the directional vector the camera is pointing, but from this how do i know when i click a direction, which direction to translate on?
An appropriate vector is needed here. For example, if we need to know which way is left from the camera's current point of view we can take the local negative X axis and convert it:
var quat = transform.get_rotation(cam, _vec4_tmp);
var left_dir = util.quat_to_dir(quat, m_util.AXIS_MX, _vec3_tmp);

30 October 2015 12:35
Сделали через API:
set_plock_smooth_factor
get_plock_smooth_factor
27 October 2015 11:27
Ответ на сообщение пользователя sdc44
Thanks i ended up using the controls you talked about. Is there anyway to make the movement not so choppy, i provided the interface to move in increments like i wanted, but i was hoping to make the camera move smoothly to the new point,
We have smoothing in the "Viewer" app for mouse actions. It's done via the "app.js" addon but we don't currently provide any API methods. Therefore some coding is needed.

You should take a look at this callback - this is how it's done for mouse translations/rotations. The code is a bit unwieldy but the main idea is simple:
1) In this function we have "dest_x_mouse" value which means the total amount of "movement".
2) We get the amount of time elapsed since the previous frame:
var value = m_ctl.get_sensor_value(obj, id, 0);

And use it to calculate the amount of "movement" for the current frame:
var x_mouse = m_util.smooth(dest_x_mouse, 0, value, smooth_coeff_rot_trans_mouse());
dest_x_mouse -= x_mouse;
...

3) Then we move camera somehow according to the "x_mouse" value, for example:
trans_hover_cam_horiz_local(obj, m_util.AXIS_X,
                            (x_mouse + x_touch)
                            * HOVER_MOUSE_TOUCH_TRANS_FACTOR);



also is there a way that i can tell which way the camera is facing and than move the camera left/right/forward/back relative to that
There is the get_camera_angles function which returns azimuth and elevation angles for the given camera. They can be used to determine the orientation in the world space.

Also you can extract the camera rotation quaternion and convert one of the camera local axes to a world space to calculate the direction of desirable moving:
var quat = transform.get_rotation(cam, _vec4_tmp);
var z_world_cam = util.quat_to_dir(quat, m_util.AXIS_Z, _vec3_tmp);



m_cam.translate_hover_cam_v(camera, pos);
Beware! You are using the deprecated method. It also spams in the console about this.
26 October 2015 17:34
I use Profiling Tools but so far I can't identify the real reason for those lags.
Chrome allows to save the collected data. We can look at it if you'll attach the profile to the post.
23 October 2015 18:45
Blend4Web 15.10 developer preview build is now available on the site. In this release we've further elaborated our project management system and improved its interface. Also we've developed the functionality for the Logic Editor. Antialiasing, NPOT-texture and sound sources support have been improved too. Beside this we've made it possible to animate some additional properties for the light sources. These and other changes are described more detailed in release notes in the documentation.

The final release is supposed to be on the next week.
23 October 2015 18:42
На сайте появилась предварительная сборка Blend4Web 15.10. В этом релизе мы доработали систему управления проектами и улучшили её интерфейс. Также был расширен функционал редактора логики. Были улучшены антиалиасинг, поддержка NPOT-текстур и работа звуковых источников. Кроме этого, появилась возможность анимировать ряд дополнительных свойств источников освещения. Подробнее эти и другие изменения описаны в документации в замечаниях к релизам.

Итоговый релиз должен состояться на следующей неделе.
23 October 2015 17:51
I can't say definitely where is the problem. There is a plenty of possible reasons which cause the lags.
I'm not familiar with AngularJS but another framework - jQuery Mobile which we use in our "Viewer" application has some bottlenecks. So it can be slow in a certain cases.
JSON.stringify() function can also be the cause of troubles here if the "towers_measures" object is too big. The best way to figure this out is to use profiling tools.
You can use "Profiles->Collect Javascript CPU Profile" in the Chrome console during the camera moving and then see which function takes a big amount of time.


Into my function I'm contstructing a big array of ~8x14x400 objects
Also it isn't a good approach to construct a big new array in a function which is called many times. It's better to use previously created array and just rewrite it every time.
22 October 2015 15:08
Hi great b4w programmers… I started using your sdk a few months ago and I'm loving it!
Hi, salmar_dev, thanks for your praises!


Into my function I'm contstructing a big array of ~8x14x400 objects and using some of those values to update the scene.
This could be the cause of freezes if you call it regularly. Could you paste this function here, so we can understand what actually happens.
22 October 2015 14:47
Ответ на сообщение пользователя Архитектор
как уже написал выше - использую способ - "вставка контента как веб-приложения" (№3)… ошибки вероятно есть, хотя код точно такой же как в видео, вроде бы… может быть по скайпу или ещё как то можно с вами связаться - что бы наглядно всё обсудить?

Можно по почте, но лучше скопируйте сюда сообщения из консоли, думаю, сразу станет понятно, в чем проблема.