Forum

Camera zoom limits

07 December 2017 18:34
I've a scene where the camera goes to several spots and where the focus goes to another Target.
The camera is in Target mode. I want to set several camera limits (horizontal panning limits/zoom limits/e.g.).
However I can't seem to get it to work. I tried it with nodes which will activate upon buttonclick. But no luck.

Is it possible to set different (zoom) limits e.g. in Javascript when a camera has reached his destination and looks at the target? The following code is the button action for the moment:

   var test_1 = create_button("Start");
    test_1.onclick = "Start";
    controls_container.appendChild(test_1);
	test_1.className = "btn 1";
	test_1.addEventListener("click", function(e) {
	
		var cam_obj = m_scenes.get_active_camera();

        var final_cam_pos_obj = m_scenes.get_object_by_name("cam_2");
        var final_target_obj = m_scenes.get_object_by_name("tar_2");

        rotate_final_cam_pos_object_to_final_target(final_cam_pos_obj, final_target_obj);

        m_cam.static_setup(cam_obj);

        var set_target_mode = function() {
            var target = m_trans.get_translation(final_target_obj, _vec3_tmp2);
            m_cam.target_setup(cam_obj, {pivot : target});
        }

        m_cam_anim.move_camera_to_point(cam_obj, final_cam_pos_obj, 5.0, 50, set_target_mode);
		m_logic_n.run_entrypoint("Scene", "scene1");
    }, false);


Much appreciated!
13 December 2017 15:07
Is it possible to set different (zoom) limits e.g. in Javascript when a camera has reached his destination and looks at the target? The following code is the button action for the moment:
Helllo,

sorry for the delayed answer.
Zoom limits for target camera are called distance limits in b4w and there are dedicated api method and logic node properties to configure them
Blend4Web Team - developer
Twitter
LinkedIn
 
Please register or log in to leave a reply.