User posts sciremedia
06 June 2017 13:50
01 December 2016 14:59
Hi!
We've been already testing out the new fps.js module included in the latest release, as it fits nicely with a project we have in development. We understand this is a 1.0 version of this module and further development is planned for it, yet we've found some issues already that we'd like to point out for your consideration:
On the move callbacks for the character movement via GMPD_AXIS_0 and GMPD_AXIS_1 sensors, we've found that a deadzone for both axis is needed, otherwise the character will move with the slightest movement of the gamepad joystick (ours never gets perfectly centered and always registers some fractional value above or below 0, so the character is always moving).
We've temporarily fixed this by modifying move_backward_cb() and move_right_cb():
(this deadzone range should probably be user-configurable as well).
Also, we find there is a helpful change_flystyle() function bind to KEY_C; this is interesting for testing but should probably be optional for deployment; we see no way to disable this functionality right now.
We'll keep on working with the module in our project, and provide additional feedback should we find any further issues.
Thanks a lot!
We've been already testing out the new fps.js module included in the latest release, as it fits nicely with a project we have in development. We understand this is a 1.0 version of this module and further development is planned for it, yet we've found some issues already that we'd like to point out for your consideration:
On the move callbacks for the character movement via GMPD_AXIS_0 and GMPD_AXIS_1 sensors, we've found that a deadzone for both axis is needed, otherwise the character will move with the slightest movement of the gamepad joystick (ours never gets perfectly centered and always registers some fractional value above or below 0, so the character is always moving).
We've temporarily fixed this by modifying move_backward_cb() and move_right_cb():
value = value > -0.1 && value < 0.1 ? 0 : value;
(this deadzone range should probably be user-configurable as well).
Also, we find there is a helpful change_flystyle() function bind to KEY_C; this is interesting for testing but should probably be optional for deployment; we see no way to disable this functionality right now.
We'll keep on working with the module in our project, and provide additional feedback should we find any further issues.
Thanks a lot!
21 November 2016 12:50
18 November 2016 12:32
Hi!
We are currently in the early stages of developing a first person view scene setup with HMD support. (Gamepad for movement, Oculus Rift for display, running on WebVR-enabled Chromium on Windows 10)
We have a simple character, with the main camera attached to it to create the first-person view effect (similar to the Jungle Outpost tutorial scene). So, I've prepared a very basic gamepad setup to move the character around. If the camera is controlled the traditional way (via mouse with request_pointerlock), the character moves as expected (i.e. going forward on the gamepad will move the character directly ahead to the direction he is looking to).
But, when introducing the Oculus setup (via request_fullscreen_hmd and enable_hmd) so that camera orientation is controlled with the VR headset, the movement of the character is unlinked from the camera orientation (i.e. going forward on the gamepad will always move the character north, no matter in which direction the user is looking with the HMD).
This behavior would work fine for vehicle-type scenes (as in the Space Disaster demo), but not so well on character walking scenes as ours. I think there might be some easy way to link the character rotation to the orientation of the camera, but haven't been able to figure it out so far. Any ideas?
Thanks a lot!
We are currently in the early stages of developing a first person view scene setup with HMD support. (Gamepad for movement, Oculus Rift for display, running on WebVR-enabled Chromium on Windows 10)
We have a simple character, with the main camera attached to it to create the first-person view effect (similar to the Jungle Outpost tutorial scene). So, I've prepared a very basic gamepad setup to move the character around. If the camera is controlled the traditional way (via mouse with request_pointerlock), the character moves as expected (i.e. going forward on the gamepad will move the character directly ahead to the direction he is looking to).
But, when introducing the Oculus setup (via request_fullscreen_hmd and enable_hmd) so that camera orientation is controlled with the VR headset, the movement of the character is unlinked from the camera orientation (i.e. going forward on the gamepad will always move the character north, no matter in which direction the user is looking with the HMD).
This behavior would work fine for vehicle-type scenes (as in the Space Disaster demo), but not so well on character walking scenes as ours. I think there might be some easy way to link the character rotation to the orientation of the camera, but haven't been able to figure it out so far. Any ideas?
Thanks a lot!
16 November 2016 15:31
Many coders working in Mac use Dash as a documentation reference helper (I believe the equivalents may be Zeal for Linux and Velocity for Windows).
Have you considered contributing the Blend4Web API reference as a Dash docset so that it is accesible from these platforms? I believe this should be fairly easy for you, there is some detailed documentation on the process, and it would be extremely helpful for people who have Dash integrated in their workflow (that includes us, obviously).
Thanks a lot!
Have you considered contributing the Blend4Web API reference as a Dash docset so that it is accesible from these platforms? I believe this should be fairly easy for you, there is some detailed documentation on the process, and it would be extremely helpful for people who have Dash integrated in their workflow (that includes us, obviously).
Thanks a lot!
29 September 2016 16:24
Reply to post of user Ivan Lyubovnikov
Oh, this line also can lead to the error:canvas_elem.addEventListener("mouseup", function(e){ m_mouse.request_pointerlock(canvas_elem) }, false);
This listener should be removed before switching the camera type, because the pointerlock will be requested on every click regardless the type.
Ideally the algorithm should be like the following:
—- switch to TARGET/STATIC —–
exit_pointerlock
removeEventListener("mouseup")
perform switching
—- switch to EYE —–
addEventListener("mouseup")
perform switching
This does not work for me :(
When I get to make the lockpointer work, then it is impossible to eliminate it.
I tired it with:
m_mouse.exit_pointerlock(canvas_elem);
canvas_elem.removeEventListener("mouseup", function(e){ m_mouse.request_pointerlock(canvas_elem) }, false);
But nothing.
function pointerBlockFunct(camera, canvas_elem){
console.log(canvas_elem);
console.log(m_mouse.check_pointerlock(canvas_elem));
// if (m_cam.get_move_style(camera) == m_cam.MS_EYE_CONTROLS){
// console.log('camara is type eye!');
// } else {
// console.log('camara is not type eye"');
// }
if (m_mouse.check_pointerlock(canvas_elem)){ // if it is lock then:
console.log('try unlock');
m_mouse.exit_pointerlock(canvas_elem);
} else {
console.log('try lock');
var canvas_elem = m_cont.get_canvas();
// NOW DONT LOCK MOUSE!!
var canvas_elem = document.getElementById("main_canvas_container");
m_mouse.request_pointerlock(canvas_elem);
canvas_elem.addEventListener("mouseup", function(e){ m_mouse.request_pointerlock(canvas_elem) }, false);
};
};
$("#returnToCameraTarget").unbind().click(function(){
// console.log('clicked');
var camera = m_scs.get_active_camera();
var canvas_elem = m_cont.get_canvas();
// canvas_elem.addEventListener("mouseup", main_canvas_click, false);
m_app.enable_camera_controls();
var camloc = m_scs.get_object_by_name("home_cam_location");
var camtarget = m_scs.get_object_by_name("camera_target");
cameraAnimations(camera, camloc, camtarget);
// console.log(camloc, camtarget);
// change_camera_style('dinamica', camobj, camloc, camtarget);
m_changeCamStyle.set_target_camera(
camera,
POS,
PIVOT,
TARGET_HORIZ_LIMITS,
TARGET_VERT_LIMITS,
DIST_LIMITS,
PIVOT_LIMITS,
USE_PANNING
);
canvas_elem.removeEventListener("mouseup", pointerBlockFunct(camera, canvas_elem), false);
});
// var canvas_elem = m_cont.get_canvas();
// document.getElementById("vista").addEventListener("click", function(){
// canvas_elem.addEventListener("mouseup", pointerBlockFunct(canvas_elem), false);
// });
$("#chageviewToFirstPerson").unbind().click(function(){
m_app.disable_camera_controls();
var camera = m_scs.get_active_camera();
// var canvas_elem = document.getElementById("main_canvas_container");
var canvas_elem = m_cont.get_canvas();
canvas_elem.addEventListener("mouseup", pointerBlockFunct(camera, canvas_elem), false);
// pointerBlockFunct(canvas_elem);
var camloc = m_scs.get_object_by_name("fpLocation");
var camtarget = m_scs.get_object_by_name("fpTarget");
cameraAnimations(camera, camloc, camtarget);
// para poder restaurar las coordenadas en las que se queda la camara una vez usado eye:
POS = m_changeCamStyle.set_eye_camera(camera);
});
Help? :(
28 September 2016 15:18
We have a project in which we have to change the way the camera target to first person mode.
I managed to change the camera to first person target but the moment in which we must return back to target gives me an error:
My 2 functions:
Here use these functions on click my html tags:
I managed to change the camera to first person target but the moment in which we must return back to target gives me an error:
print.js:73 B4W ERROR: eye_rotate(): Wrong camera object or camera move styleerror
print.js:73exports.eye_rotate
camera.js:448default_rotation_cb
mouse.js:315smooth_cb
mouse.js:308exports.update
controls.js:136frame
main.js:465loop
main.js:421
My 2 functions:
function change_camera_style(tipo, objCamera, objLocation, objTarget) {
var cameraVec3 = m_trans.get_translation(objCamera);
var locationVec3 = m_trans.get_translation(objLocation);
var targetVect3 = m_trans.get_translation(objTarget);
switch(tipo) {
case "estatica":
m_app.enable_camera_controls();
m_cam.static_setup(objCamera, { pos: locationVec3, look_at: targetVect3 });
// m_cam.correct_up(objCamera, m_util.AXIS_Y, true);
console.log('estatica (disabled camera controsl)');
// console.log(m_cam.get_move_style(objCamera));
var canvas_elem = m_cont.get_canvas();
if (m_mouse.check_pointerlock(canvas_elem)){
m_mouse.exit_pointerlock(canvas_elem);
canvas_elem.addEventListener("mouseup", main_canvas_click, false);
};
canvas_elem.addEventListener("mouseup", main_canvas_click, false);
FIRSTPERSON = false;
break;
case "dinamica":
m_app.enable_camera_controls();
m_cam.target_setup(objCamera, { pos: locationVec3, pivot: targetVect3});
m_cam.rotate_camera(objCamera, Math.PI/8, 0, true, true);
m_cam.target_switch_panning(objCamera, true); // activar el panning
var canvas_elem = m_cont.get_canvas();
// if (m_mouse.check_pointerlock(canvas_elem)){
// m_mouse.exit_pointerlock(canvas_elem);
// canvas_elem.addEventListener("mouseup", main_canvas_click, false);
// };
FIRSTPERSON = false;
console.log('dinamica (enabled camera controsl)');
console.log(m_cam.get_move_style(objCamera));
break;
case "eye":
if (FIRSTPERSON == false){
m_app.disable_camera_controls();
m_cam.eye_setup(objCamera, { pos: locationVec3, look_at: targetVect3, horiz_rot_lim: EYE_HORIZ_LIMITS, vert_rot_lim: EYE_VERT_LIMITS });
m_cam.rotate_camera(objCamera, 0, -Math.PI/16, true, true);
var character = m_scs.get_first_character();
m_cons.append_stiff_trans(objCamera, character, [0, 4.5, 0]); // el vector este le indicamos el offset del cuello del personaje
// para poder capturar el raton del usuario:
var canvas_elem = m_cont.get_canvas();
canvas_elem.addEventListener("mouseup", function(e){ m_mouse.request_pointerlock(canvas_elem) }, false);
FIRSTPERSON = true;
console.log('eye (disabled camera controsl)');
console.log(m_cam.get_move_style(objCamera));
// m_app.enable_camera_controls();
// console.log(locationVec3);
// console.log(targetVect3);
}
break;
}
};
function cameraAnimations(camobj, camloc, camtarget){
// Límites de la cámara:
function get_cam_limits(){
m_cam.set_move_style(camobj, m_cam.MS_TARGET_CONTROLS); // devuelve cámara a dinámica
var dist = m_cam.target_get_distance_limits(camobj);
var hor = m_cam.target_get_horizontal_limits(camobj);
var ver = m_cam.target_get_vertical_limits(camobj);
var limits = {d:dist, h:hor, v:ver};
return limits;
};
function reset_camera_limits(limits) {
m_cam.target_set_distance_limits(camobj, limits['d']);
m_cam.target_set_horizontal_limits(camobj, limits['h']);
m_cam.target_set_vertical_limits(camobj, limits['v']);
};
// calcular la velocidad optima:
function velocidadoptima(camobj, camloc){ // velocidadoptima(camobj, camloc);
var puntoA = m_trans.get_translation(camobj);
var puntoB = m_trans.get_translation(camloc);
var deltaX = puntoB[0] - puntoA[0]
var deltaY = puntoB[1] - puntoA[1];
var deltaZ = puntoB[2] - puntoA[2];
var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ);
var opspeed = distance/2; // ajustar a gusto
if (opspeed < 0.5) opspeed = 0.5;
return opspeed;
}
// change_camera_style('dinamica', camobj, camloc, camtarget);
var cam_limits = get_cam_limits();
var velocidad = velocidadoptima(camobj, camloc);
// pos si pierde la velocidad:
if (velocidad == 0.5){
velocidad = 2.9800495608016644;
};
// console.log(velocidad);
// // change_camera_style(tipo, objCamera, objLocation, objTarget)
// change_camera_style('estatica', camobj, camloc, camtarget);
// m_camanim.move_camera_to_point(camobj, camloc, velocidad, velocidad);
// var canvas_elem = m_cont.get_canvas();
// if (m_mouse.check_pointerlock(canvas_elem)){
// m_mouse.exit_pointerlock(canvas_elem);
// canvas_elem.addEventListener("mouseup", main_canvas_click, false);
// console.log('tiene lock');
// };
// change_camera_style('dinamica', camobj, camloc, camtarget);
m_cam.set_move_style(camobj, m_cam.MS_STATIC); // convierte cámara en estática (si no, no se anima por API)
// change_camera_style('estatica', camobj, camloc, camtarget);
m_camanim.move_camera_to_point(camobj, camloc, velocidad, velocidad, camanim_fin);
var camtarget_loc = m_trans.get_translation(camtarget);
m_cam.set_move_style(camobj, m_cam.MS_TARGET_CONTROLS); // devuelve cámara a dinámica
// change_camera_style('dinamica', camobj, camloc, camtarget);
m_cam.target_set_trans_pivot(camobj, null, camtarget_loc); // devuelve pivote al target
reset_camera_limits(cam_limits); // al cambiar el tipo de cámara pierde los límites, hay que resetearlos
function camanim_fin(){
var camtarget_loc = m_trans.get_translation(camtarget);
m_cam.set_move_style(camobj, m_cam.MS_TARGET_CONTROLS); // devuelve cámara a dinámica
// change_camera_style('dinamica', camobj, camloc, camtarget);
m_cam.target_set_trans_pivot(camobj, null, camtarget_loc); // devuelve pivote al target
reset_camera_limits(cam_limits); // al cambiar el tipo de cámara pierde los límites, hay que resetearlos
FIRSTPERSON = false;
};
};
Here use these functions on click my html tags:
$("#chageviewToFirstPerson").click(function() {
var camobj = m_scs.get_active_camera();
var camloc = m_scs.get_object_by_name("fpLocation");
var camtarget = m_scs.get_object_by_name("fpTarget");
// cameraAnimations(camobj, camloc, camtarget);
change_camera_style('eye', camobj, camloc, camtarget);
});
$("#returnToCameraTarget").on('click', function(e) {
e.preventDefault();
var camobj = m_scs.get_active_camera();
var camloc = m_scs.get_object_by_name("home_cam_location");
var camtarget = m_scs.get_object_by_name("camera_target");
// cameraAnimations(camobj, camloc, camtarget);
cameraAnimations(camobj, camloc, camtarget);
change_camera_style('dinamica', camobj, camloc, camtarget);
});
09 March 2016 19:27
Is there any way to ignore some files within the project structure on the compilation stage?
We are aware of the css_ignore and js_ignore arrays on .b4w_project, but these would flag files to not be minified; we were looking for a way to exclude some files altogether.
Case in point, our project has some html/css layered on top of the canvas; we edit the styles in a .sass file in the project, which outputs a minified css. We need not to have the original sass file in the bundled deploy folder; currently we delete it manually before delivery, we were wondering if there is a more streamlined way to do this.
Thanks!
We are aware of the css_ignore and js_ignore arrays on .b4w_project, but these would flag files to not be minified; we were looking for a way to exclude some files altogether.
Case in point, our project has some html/css layered on top of the canvas; we edit the styles in a .sass file in the project, which outputs a minified css. We need not to have the original sass file in the bundled deploy folder; currently we delete it manually before delivery, we were wondering if there is a more streamlined way to do this.
Thanks!
04 February 2016 18:13
04 February 2016 17:48
Hi!
So, we have a rather complex project set up and working fine, but we have run into some problems on the compilation stage for final delivery of our app. I believe we must be missing some step on the (pre)compilation process, but we've been unable to find an explanation to this in the docs.
We have a standard (not bundled) project, with all assets on their regular sdk locations.
We compile with the link in the Project Manager; all options set to defaults except for:
engine_type = copy
js_ignore = (some scripts)
css_ignore = (some styles)
The console returns a success and all files seem to be processed fine.
Problem is, we presumed this compiled app would be suitable for delivery but it's not: once we place the contents of deploy/apps/[ourapp] in the webserver, the page throws a 404 on the .json file for the project (looks for it in [server]/assets/[ourapp]/[ourapp].json, but this folder was not created on compilation).
If we manually place the assets folder there to get away with the error (containing the json, bin, and textures), the error goes away and the app loads fine.
So, we do know how to get around the problem, but it makes us think we might be missing some part of the compilation process, and we'd rather go by the book with it to avoid potential problems.
Any hints on this would be much appreciated.
Thanks a lot.
Alex.
So, we have a rather complex project set up and working fine, but we have run into some problems on the compilation stage for final delivery of our app. I believe we must be missing some step on the (pre)compilation process, but we've been unable to find an explanation to this in the docs.
We have a standard (not bundled) project, with all assets on their regular sdk locations.
We compile with the link in the Project Manager; all options set to defaults except for:
engine_type = copy
js_ignore = (some scripts)
css_ignore = (some styles)
The console returns a success and all files seem to be processed fine.
Problem is, we presumed this compiled app would be suitable for delivery but it's not: once we place the contents of deploy/apps/[ourapp] in the webserver, the page throws a 404 on the .json file for the project (looks for it in [server]/assets/[ourapp]/[ourapp].json, but this folder was not created on compilation).
If we manually place the assets folder there to get away with the error (containing the json, bin, and textures), the error goes away and the app loads fine.
So, we do know how to get around the problem, but it makes us think we might be missing some part of the compilation process, and we'd rather go by the book with it to avoid potential problems.
Any hints on this would be much appreciated.
Thanks a lot.
Alex.