Forum

Deactivate camera movement in real-time

30 November 2015 15:27 #5437
Hello there!

I was wondering if there was a way to deactivate the camera movement (navigation) after the scene has been loaded?

For example, when I click on an object, a popup appears and I would like the prevent the user from being able to rotate the scene behind the popup until he hits the close button.

I assume I will need to dive into the app development and do it in JS right?

Thanks!
JD
01 December 2015 10:04 #5444
Hello.

I assume I will need to dive into the app development and do it in JS right?

You are right. You have two ways to realize described camera behavior:
1) The first way is the hardest way - to disable camera controls at all. For example
function main_canvas_click(e) {
    if (e.preventDefault)
        e.preventDefault();

    var x = e.clientX;
    var y = e.clientY;

    var obj = m_scenes.pick_object(x, y);

    if (obj and m_scenes.get_object_name(obj) == "NAME") {
        m_app.disable_camera_controls();
    }
}

2) The second way is more democratic way - to set up camera limitation via API. You should use the following methods from the "camera" module:
eye_set_horizontal_limits
eye_set_vertical_limits
target_set_vertical_limits
target_get_vertical_limits
Blend4Web developer
01 December 2015 14:52 #5454
Alright great I'll give it a try! Thank you!

JD
 
Please register or log in to leave a reply.