Code Review
- PivotBasedCameraRig.cs
- Scripts /
- Cameras /
- Standard Assets /
- Assets /
- project /
2 using UnityEngine;
3
4
5 namespace UnityStandardAssets.Cameras
6 {
7 public abstract class PivotBasedCameraRig : AbstractTargetFollower
8 {
9 // This script is designed to be placed on the root object of a camera rig,
10 // comprising 3 gameobjects, each parented to the next:
11
12 // Camera Rig
13 // Pivot
14 // Camera
15
16 protected Transform m_Cam; // the transform of the camera
17 protected Transform m_Pivot; // the point at which the camera pivots around
18 protected Vector3 m_LastTargetPosition;
19
20
21 protected virtual void Awake()
22 {
23 // find the camera in the object hierarchy
24 m_Cam = GetComponentInChildren<Camera>().transform;
25 m_Pivot = m_Cam.parent;
26 }
27 }
28 }