Camera constrained to shape?
19 January 2015 14:51
Hi,
I've looked through your code. When you use:
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:
I've modified your version of app.js. It is in the attachment.
I've looked through your code. When you use:
m_util.clamp(dest_pan_y_mouse, 0.2, -0.2);
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