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
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
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.
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
05 February 2018 20:16