Game Development Reference
In-Depth Information
80.
81.
//Apply zooming
82.
float wheel = Input.GetAxis("Mouse ScrollWheel");
83.
//Zoom in
84.
if(wheel > 0 && transform.localPosition.z < maxZoom){
85.
//Move the camera forward on its local Z axis
86.
//using zoom speed
87.
transform.Translate(0, 0, zoomSpeed);
88.
} else //Zoom out
89.
if(wheel < 0 && transform.localPosition.z > minZoom){
90.
//Move the camera backwards on its local Z axis
91.
//using the negative value of zoom speed
92.
transform.Translate(0, 0, -zoomSpeed);
93.
}
94.
}
95.
}
Listing 11: Camera script for the third person input system
Search WWH ::




Custom Search