Question about using the camera.

I am playing with CCCamera() to learn how to use it. Right now I am using it to zoom in and out of a scene. My scene has small sprites from -1000,-1000 to 1000,1000 spaced out every 50 points.
I have configured it to look at the target TargetWorldSpace(0,0,0) and I have positioned the camera at CenterWorldSpace(0,0,Z) - and varying Z to zoom in and out.
I have observed that if Z is less than about 200 then nothing is displayed, and if Z is > about 1000 then nothing is displayed. (Otherwise working within that range it is working great). Can anyone help me understand why this is happening?
Also, what does CameraVisibleBounds to?

Also, am I on the right track for creating a game layout that is larger than a physical screen? Should I build up the scene, add the sprites and move the camera around it with the player? (Ignoring memory constraints for now.)



  • RamiTabbaraRamiTabbara AUMember, Xamarin Team Xamurai

    Hi Bryon,

    The best way to think about the CCCamera is that it's a container class for the view and projection matrices of your scene. In particular, the projection matrix dictates the viewing frustrum that bounds the volume of the world that can be seen by the camera. The z-bounds of this frustum are determined by the near and far clipping bounds that are properties of the camera. By default, CCCamera's clipping bounds are restricted to z-1024 to z+ 1024 when using 2d proj relative to the camera z position.

    If you're using 3d camera projection (which is default) then the bounds restriction is z+0.1 to< z+100.

    In either case, once you position something outside of this range it will no longer be visible. Hope that helps.

Sign In or Register to comment.