© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2024
C. HardmanGame Programming with Unity and C#https://doi.org/10.1007/978-1-4842-9720-9_27

27. Camera Movement

Casey Hardman1  
(1)
West Palm Beach, FL, USA
 

The first thing we’ll do for our project is get some camera movement in working order. The player has to be able to move around the stage to be able to see the whole thing, after all. We’ll allow the player to move the camera with the arrow keys as well as by right-clicking and dragging with the mouse. We’ll also provide the option to use the mouse scroll wheel to zoom in or out, which lets the player control how close their camera is to the stage.

All of the movement will be applied to a Vector3 variable ...

Get Game Programming with Unity and C#: A Complete Beginner’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.