コード例 #1
0
 void FPS()
 {
     if (transform.parent != hoodCam.transform)
     {
         transform.SetParent(hoodCam.transform, false);
         transform.position = hoodCam.transform.position;
         transform.rotation = hoodCam.transform.rotation;
         targetFieldOfView  = hoodCameraFOV;
         hoodCam.FixShake();
     }
 }
コード例 #2
0
 void FPS()
 {
     if (transform.parent != hoodCam.transform)
     {
         transform.SetParent(hoodCam.transform, false);
         transform.position = new Vector3(hoodCam.transform.position.x - 0.05f, hoodCam.transform.position.y + 0.3f, hoodCam.transform.position.z);;
         transform.rotation = hoodCam.transform.rotation;
         targetFieldOfView  = hoodCameraFOV;
         hoodCam.FixShake();
     }
 }
コード例 #3
0
ファイル: RCC_Camera.cs プロジェクト: Rainbohost/Crazy-Race
    private void ResetCamera()
    {
        if (fixedCam)
        {
            fixedCam.canTrackNow = false;
        }

        tiltAngle = 0f;

        collisionPos = Vector3.zero;
        collisionRot = Quaternion.identity;

        pivot.transform.localPosition = collisionPos;
        pivot.transform.localRotation = collisionRot;

        cam.orthographic = false;

        switch (cameraMode)
        {
        case CameraMode.TPS:
            transform.SetParent(null);
            targetFieldOfView = TPSMaximumFOV;
            break;

        case CameraMode.FPS:
            transform.SetParent(hoodCam.transform, false);
            transform.localPosition = Vector3.zero;
            transform.localRotation = Quaternion.identity;
            targetFieldOfView       = hoodCameraFOV;
            hoodCam.FixShake();
            break;

        case CameraMode.WHEEL:
            transform.SetParent(wheelCam.transform, false);
            transform.localPosition = Vector3.zero;
            transform.localRotation = Quaternion.identity;
            targetFieldOfView       = wheelCameraFOV;
            break;

        case CameraMode.FIXED:
            transform.SetParent(fixedCam.transform, false);
            transform.localPosition = Vector3.zero;
            transform.localRotation = Quaternion.identity;
            targetFieldOfView       = 60;
            fixedCam.currentCar     = playerCar;
            fixedCam.canTrackNow    = true;
            break;

        case CameraMode.CINEMATIC:
            transform.SetParent(cinematicCam.pivot.transform, false);
            transform.localPosition = Vector3.zero;
            transform.localRotation = Quaternion.identity;
            targetFieldOfView       = 30f;
            cinematicCam.currentCar = playerCar;
            break;

        case CameraMode.TOP:
            transform.SetParent(null);
            targetFieldOfView             = minimumOrtSize;
            pivot.transform.localPosition = Vector3.zero;
            pivot.transform.localRotation = Quaternion.identity;
            targetPosition       = playerCar.position;
            targetPosition      += playerCar.rotation * Vector3.forward * distanceOffset;
            transform.position   = playerCar.position;
            pastFollowerPosition = playerCar.position;
            pastTargetPosition   = targetPosition;
            break;

        case CameraMode.ORBIT:
            transform.SetParent(null);
            targetFieldOfView = orbitCameraFOV;
            orbitX            = 0f;
            orbitY            = 0f;
            smoothedOrbitX    = 0f;
            smoothedOrbitY    = 0f;
            break;
        }
    }