Move camera forward programatically in 2D


I'm trying to use the camera.moveForward method to zoom the map with enabledZoom set to false. It works perfectly in 3d, even though, when the map is set to 2D mode, it simply stops moving the camera after calling the method. You can check this behaviour in the camera tutorial in sandcastle , just change the map type to 2D and the w and s for zoom will simply stop working. Does anyone know if this is a bug or if i'm supposed to use a different method for zooming in 2d?


The moveForward method moves the camera’s position along the view direction. It will still move it in 2D, but it will not appear to because of the orthographic projection. To zoom in 2D, you need to change the projection. Use the zoomIn and zoomOut functions. It will use moveForward or modify the projection based on the scene mode.

That worked perfectly, thank you very much!