- 카메라가 플레이를 따라 다니도록..
````
[SerializeField]
Define.CameraMode _mode = Define.CameraMode.QuarterView;
[SerializeField]
Vector3 _delta = new Vector3(0.0f, 6.0f, -5.0f);
[SerializeField]
GameObject _player = null;
void Start()
{
}
void LateUpdate()
{
if (_mode == Define.CameraMode.QuarterView)
{
RaycastHit hit;
if (Physics.Raycast(_player.transform.position, _delta, out hit, _delta.magnitude, LayerMask.GetMask("Wall")))
{
float dist = (hit.point - _player.transform.position).magnitude * 0.8f;
transform.position = _player.transform.position + _delta.normalized * dist;
}
else
{
transform.position = _player.transform.position + _delta;
transform.LookAt(_player.transform);
}
}
}
````
- 위에서
transform.position = _player.transform.position + _delta;
transform.LookAt(_player.transform);
- 위 부분은 카메라가 플레이어 방향을 주시하는 LookAt.. 플레이어를 따라다니도록 transprom 설정도..