コード例 #1
0
ファイル: Camera_Movement.cs プロジェクト: KLDMS/3Ddemo
    // Update is called once per frame
    void Update()
    {
        target = playerstat.GetTarget();

        Vector3 targetPosition = player.transform.position;
        Vector3 velocity       = Vector3.zero;

        transform.position = Vector3.SmoothDamp(transform.position, targetPosition, ref velocity, movementSmoothSpeed);

        var targetRotation = Quaternion.LookRotation(target.transform.position - transform.position);

        transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, rotationSmoothSpeed);
    }