Forum

Camera constrained to shape?

19 January 2015 14:51
Hi,

I've looked through your code. When you use:
m_util.clamp(dest_pan_y_mouse, 0.2, -0.2);
you clamp only the value which is added to the result Y coordinate. Not the Y coordinate itself that is wrong.

I've come to the following solution for your task. It works exactly as you described:
var pivot = m_cam.get_pivot(obj);
if (pivot[1] >= 1 && trans_pivot_y_mouse < 0 ||
    pivot[1] <= 0 && trans_pivot_y_mouse > 0) {
    // do nothing
    } else {
        m_cam.move_pivot(obj, trans_pivot_x_mouse, trans_pivot_y_mouse);
    }
}

I've modified your version of app.js. It is in the attachment.
20 January 2015 04:27
Wow thank you very much Evgeny, it works!

I hope this thread is useful to others as well!

Thanks again! Really! You saved me a ton of time!

I like the new masthead btw
20 January 2015 11:31
I like the new masthead btw
Yeah it is now can be rotated horizontally
The Founder | Twitter | Facebook | Linkedin
 
Please register or log in to leave a reply.