Форум

Сообщения, созданные пользователем AtttilaVM
18 августа 2017 20:17
I am developing a simple VR app to my Galaxy Nexus 5 using Chrome/59.0.3071.125 via Blend4Web CE 17.06. The app responds perfectly to any rotation movement, so I can look around, this is provided out of the box by the blend4web SDK.
However when I try to access the HMD position or quat data I get the same static values:
pos = [1, 1, 1]
quat = [0, 0, 0, 1]

Regardless of the position of my phone.

Here is the code snippet I use to access the data:

function register_hmd() {
				m_hmd_conf.update();
				// camera rotation is enabled with HMD
				m_hmd.enable_hmd(m_hmd.HMD_ALL_AXES_MOUSE_NONE);

				var cam = m_scenes.get_active_camera();
				var position = m_ctl.create_hmd_position_sensor();
				var rotation = m_ctl.create_hmd_quat_sensor();

				function gesture_detect_cb(obj, id, pulse) {
						var pos = m_ctl.get_sensor_payload(obj, id, 0);
						var quat = m_ctl.get_sensor_payload(obj, id, 1);
						console.log("pos", pos[0], pos[1], pos[2],
												"quat", quat[0], quat[1], quat[2], quat[3]);
						console.log(m_hmd.get_pos);
				}
11 июня 2017 12:33
Ok I found it. It turned out that blend4web uses the Google Closure Compiler, and the
–language_in
parameter hardcoded in scripts/lib/project_cli.py

— a/scripts/lib/project_cli.py
+++ b/scripts/lib/project_cli.py
@@ -348,7 +348,7 @@ def fill_global_paths(base_dir):

# closure compiler params
_js_cc_params = [_java_exec, "-jar", js_cc_path,
- "–language_in=ECMASCRIPT5"]
+ "–language_in=ECMASCRIPT6"]

# engine sources directory
_src_dir = join(base_dir, "src")


However I guess it is not wise to change this parameter, because all of the b4w modules are written in es5. So It can effect their optimization badly. So I will transpile my code to es5.
10 июня 2017 22:28
When I try to compile ecma6 code I get:

Use –language_in=ECMASCRIPT6 or ECMASCRIPT6_STRICT or higher to enable ES6 features.


However I do not know where can I use this, project.py does not accept this cli switch.
27 января 2017 00:16
The OP is right. I was able to reproduce the bug, if two or more anchors are present at the scene with custom element configuration checked in, they will capture the picking event. I used the 16.12.1 blend4web version. Here is my project (I used the new type tree structure)

link

Fortunately I have a very slow internet so I took my time and found and workaround the bug.:

@@ -1749,11 +1749,6 @@ exports.pick_object = function(canvas_x, canvas_y) {
         return null;
     }
 
-    var anchor = m_anchors.pick_anchor(canvas_x, canvas_y);
-
-    if (anchor)
-        return anchor;
-
     var color = m_scenes.pick_color(main_scene, canvas_x, canvas_y);
 
     if (!color)


I am not SDK developer so it is absolutely not an official fix.