Game Development Reference
in Listing 2.1 .
Listing 2.1 Script to Make a Game Object Move in a Circular
Path Around Its Starting Position
private var radius: float = 30;
private var startPosition: Vector3;
private var speed: int = 3;
startPosition.x = this.transform.position.x;
startPosition.z = this.transform.position.z;
function Update ()
radius * Mathf.Sin(Time.fixedTime * speed) + startPosition.x;
radius * Mathf.Cos(Time.fixedTime * speed) + startPosition.z;
Step 18. Select SphereCam from Hierarchy such that the Camera
Preview window opens in Scene.
Step 19. Ensure that you can see both Game and Scene views and
Step 20. The camera preview for the SphereCam will display
a moving scene as the Sphere moves about within the
Step 21. Create a Plane and position and orientate it as shown in
Figure 2.10 .
Note: Steps 22-25 are only possible in the Pro version of Unity as the
free version does not have the option Render Texture .
Step 22. In Project, select Create > Render Texture. Rename it to
Step 23. Select SphereCam in the Hierarchy and in the Target
Texture property of the Camera component select and set
sphereCamView. If you select sphereCamView from the Project,
you will see the view captured by SphereCam on this new
texture's surface in the Inspector.
Step 24. Drag and drop the sphereCamView render texture onto
the new plane in the Scene.