Forum

Rotate,zoom,pan the target camera by buttons

03 February 2018 11:57
Hi all, i've another super newbie question. Im looking for some html buttons that can rotate(left, right), Zoom (in/out) my target camera.

I've found the rotate_camera(cam_obj, angle_phi, angle_theta, timeopt, cbopt) method.

and ive impemented it it seems works fine on one side rotation eg :left but how i can invert the rotation eg right ?

here my piece of code :

function button_click_left(e) {
var cam_obj = m_scenes.get_active_camera();
m_cam_anim.rotate_camera(cam_obj,0.3,0,1000);
}

it works fine and smooth but only in one direction.

And also someone can suggest me how can i use to zoom in and out the camera smoothly ?

and for the pan (left,right,top,down) ?

Thanks in advance for the support to all ;-)

Bye bye
05 February 2018 15:44
sorry for the push but, Anyone can help me to achieve this ?

I've almost finished my project but the only missing part is this :-(

Thanks in advance to all.

Regards
05 February 2018 17:25
Thanks to my friend Михаил, that linked me the solution ! (translated in english :-D)

i've solved the rotate problem. here the solution : https://www.blend4web.com/ru/forums/topic/4208/?page=1#post-20331

posted by Konstantin Khomyakov :

In the SDK file src / addons / camera_anim.js replace
this line with

if (_is_camera_stop_rotating || Math.abs (e )>= Math.abs (angle_phi)) {

but this line on

if (_is_camera_stop_rotating || Math.abs (e) >= Math.abs (angle_theta)) {

This solution works really fine, now i can put negative radians in the rotate method !.

Remain only the Zoom in and Zoom Out problem.
05 February 2018 18:07
I've talked too first :-( on the build and deployed project it does not work. Works only on the Dev project.

Someone can help me ?

Thank in advance and best regards.
05 February 2018 20:16
-SOLVED-

In order to make it works after fix in build and deploy i recompiled the b4w.

just launch the compile_b4w.py in the script folder of the SDK.

Bye Bye
 
Please register or log in to leave a reply.