Limit Camera Movement

I have a map on the screen and I could either zoom out (moving the camera closer to the map) or in (moving the camera away). I'd like it so that there's a limit to the left, right, up, down movement of the camera such that it would stop once I get to either the left/right/top/bottom edge of the map. Any ideas?

JoeMon said:

I have a map on the screen and I could either zoom out (moving the camera closer to the map) or in (moving the camera away). I'd like it so that there's a limit to the left, right, up, down movement of the camera such that it would stop once I get to either the left/right/top/bottom edge of the map. Any ideas?


Are you using jME2 or 3? Are you extending SimpleApplication? If so, simply override the onBinding (onAction if you're using the new controls in jME3) to check the location of the camera.

I'm using jME2, and I'm extending a SimpleGame class… thanks for the reply. :slight_smile: