When using the camera boundaries component in camera center mode it works as expected in top down ortho, but if I switch to perspective camera the camera center is more a "screen center" or "camera target".
Would it be possible to add some mode in next versions to behave like in top down ortho (limit camera position XZ to collider limits in XZ)?

Also, seems there is a bug when drawing the debug gizmos, "bounderiesCollider" doesn't seem to have any value when checked in the last "if" of OnDrawGizmos (seems it's not even needed as it's already using the boxCollider or the sphereCollider). When commented out, it draws the gizmos.

if (type == Type.Rectangle)// && bounderiesCollider is BoxCollider)
{
// ...
}
else if (type == Type.Circle)// && bounderiesCollider is SphereCollider)
{
//...
}

Thanks!

    you are correct, in top down mode, the "offset position" (position of the camera center projected to the floor) XZ is the same as the camera XZ, but if the camera rotation X is < 90, then it's not the case anymore. And yes this is that offset position that we clamp inside the boundaries. Clamping the camera XZ position could also be done, it might be problematic is some cases. Have you tried the "edge mode" (demo scene: CircleEdgeBoundaries_Perspective) ? Does that not do the job?

    Thank you for the bug report, it's a left over from a previous version indeed!

      Write a Reply...