void Awake() { /*if(!cameraTransform && Camera.main) * cameraTransform = Camera.main.transform; * if(!cameraTransform) * { * Debug.Log("Please assign a camera to the ThirdPersonCamera script."); * enabled = false; * }*/ _target = transform; if (_target) { controller = _target.GetComponent(typeof(ZeldaCharacterController)) as ZeldaCharacterController; } if (controller) { CharacterController characterController = _target.collider as CharacterController; centerOffset = characterController.bounds.center - _target.position; headOffset = centerOffset; headOffset.y = characterController.bounds.max.y - _target.position.y; } else { Debug.Log("Please assign a target to the camera that has a ThirdPersonController script attached."); } Cut(_target, centerOffset); }
void Awake() { /*if(!cameraTransform && Camera.main) cameraTransform = Camera.main.transform; if(!cameraTransform) { Debug.Log("Please assign a camera to the ThirdPersonCamera script."); enabled = false; }*/ _target = transform; if (_target) { controller = _target.GetComponent(typeof(ZeldaCharacterController)) as ZeldaCharacterController; } if (controller) { CharacterController characterController = _target.collider as CharacterController; centerOffset = characterController.bounds.center - _target.position; headOffset = centerOffset; headOffset.y = characterController.bounds.max.y - _target.position.y; } else Debug.Log("Please assign a target to the camera that has a ThirdPersonController script attached."); Cut(_target, centerOffset); }