Exemplo n.º 1
0
 public FreeCameraKeyFrame(Transform cameraTransform, float fov, float time, CameraCurve cameraCurve)
 {
     position  = cameraTransform.position;
     rotation  = cameraTransform.rotation;
     this.time = time;
     this.fov  = fov;
     AddKeyframes(cameraCurve);
 }
 public void Awake()
 {
     this.manager          = base.GetComponent <ReplayManager>();
     this.cameraTransform  = PlayerController.Instance.cameraController._actualCam;
     this.camera           = cameraTransform.GetComponent <Camera>();
     this.mode             = CameraMode.Orbit;
     this.keyFrames        = new List <KeyFrame>();
     this.orbitRadialCoord = new Vector3Radial(this.cameraTransform.position - PlayerController.Instance.skaterController.skaterTransform.position);
     this.FocusOffsetY     = 0f;
     this.cameraCurve      = new CameraCurve();
 }
Exemplo n.º 3
0
        public new static CameraCurveResult Evaluate(float time, CameraCurve cameraCurve)
        {
            Vector3    pos = cameraCurve.positionCurve.Evaluate(time);
            Quaternion rot = cameraCurve.orientationCurve.Evaluate(time);
            float      fov = cameraCurve.fovCurve.Evaluate(time);

            return(new CameraCurveResult()
            {
                position = pos,
                rotation = rot,
                fov = fov
            });
        }
Exemplo n.º 4
0
        public new static CameraCurveResult Evaluate(float time, CameraCurve cameraCurve)
        {
            ;
            Vector3    pos = cameraCurve.positionCurve.Evaluate(time);
            Quaternion rot = Quaternion.LookRotation(PlayerController.Instance.skaterController.skaterTransform.position + cameraCurve.focusYOffsetCurve.Evaluate(time) * Vector3.up - pos, Vector3.up);
            float      fov = cameraCurve.fovCurve.Evaluate(time);

            return(new CameraCurveResult()
            {
                position = pos,
                rotation = rot,
                fov = fov
            });
        }
Exemplo n.º 5
0
        public override void AddKeyframes(CameraCurve cameraCurve)
        {
            cameraCurve.positionCurve.InsertCurveKey(position, time);
            cameraCurve.orientationCurve.InsertCurveKey(rotation, time);

            cameraCurve.radiusCurve.InsertCurveKey((position - PlayerController.Instance.skaterController.skaterTransform.position).magnitude, time);
            cameraCurve.focusYOffsetCurve.InsertCurveKey(focusOffsetY, time);
            cameraCurve.fovCurve.InsertCurveKey(fov, time);

            cameraCurve.freeCamCurve.InsertCurveKey(0f, time);
            cameraCurve.orbitCamCurve.InsertCurveKey(0f, time);
            cameraCurve.tripodCamCurve.InsertCurveKey(1f, time);

            cameraCurve.CalculateCurveControlPoints();
        }
Exemplo n.º 6
0
        public new static CameraCurveResult Evaluate(float time, CameraCurve cameraCurve)
        {
            Quaternion rot = cameraCurve.orientationCurve.Evaluate(time);
            Vector3    pos = PlayerController.Instance.skaterController.skaterTransform.position
                             + cameraCurve.focusYOffsetCurve.Evaluate(time) * Vector3.up
                             + rot * -Vector3.forward * cameraCurve.radiusCurve.Evaluate(time);

            float fov = cameraCurve.fovCurve.Evaluate(time);

            return(new CameraCurveResult()
            {
                position = pos,
                rotation = rot,
                fov = fov
            });
        }
Exemplo n.º 7
0
        public KeyFrame GetKeyFrame(CameraCurve curve)
        {
            switch (cameraMode)
            {
            case CameraMode.Free:
                return(new FreeCameraKeyFrame(position.Value, rotation.Value, fov, time, curve));

            case CameraMode.Orbit:
                return(new OrbitCameraKeyFrame(radialPos, position.Value, rotation.Value, yOffset, fov, time, curve));

            case CameraMode.Tripod:
                return(new TripodCameraKeyFrame(position.Value, rotation.Value, yOffset, fov, time, curve));

            default:
                throw new Exception("Unknown cameraMode: " + cameraMode);
            }
        }
Exemplo n.º 8
0
        public override void AddKeyframes(CameraCurve cameraCurve)
        {
            Quaternion camToPlayerLookRotation = Quaternion.LookRotation(PlayerController.Instance.skaterController.skaterTransform.position - position, Vector3.up);

            cameraCurve.positionCurve.InsertCurveKey(position, time);
            cameraCurve.orientationCurve.InsertCurveKey(rotation, time);

            cameraCurve.radiusCurve.InsertCurveKey((position - PlayerController.Instance.skaterController.skaterTransform.position).magnitude, time);
            cameraCurve.focusYOffsetCurve.InsertCurveKey(CalcFocusYOffset(), time);
            cameraCurve.fovCurve.InsertCurveKey(fov, time);

            cameraCurve.freeCamCurve.InsertCurveKey(1f, time);
            cameraCurve.orbitCamCurve.InsertCurveKey(0f, time);
            cameraCurve.tripodCamCurve.InsertCurveKey(0f, time);

            cameraCurve.CalculateCurveControlPoints();
        }
Exemplo n.º 9
0
        public override void AddKeyframes(CameraCurve cameraCurve)
        {
            Vector3 calculatedPosition = PlayerController.Instance.skaterController.skaterTransform.position + focusOffsetY * Vector3.up + rotation * -Vector3.forward * radius;

            cameraCurve.positionCurve.InsertCurveKey(calculatedPosition, time);
            cameraCurve.orientationCurve.InsertCurveKey(rotation, time);

            cameraCurve.radiusCurve.InsertCurveKey(radius, time);
            cameraCurve.focusYOffsetCurve.InsertCurveKey(focusOffsetY, time);
            cameraCurve.fovCurve.InsertCurveKey(fov, time);

            cameraCurve.freeCamCurve.InsertCurveKey(0f, time);
            cameraCurve.orbitCamCurve.InsertCurveKey(1f, time);
            cameraCurve.tripodCamCurve.InsertCurveKey(0f, time);

            cameraCurve.CalculateCurveControlPoints();
        }
Exemplo n.º 10
0
 public FreeCameraKeyFrame(Vector3 pos, Quaternion rot, float fov, float time, CameraCurve cameraCurve)
 {
     position  = pos;
     rotation  = rot;
     this.time = time;
     this.fov  = fov;
     AddKeyframes(cameraCurve);
 }
Exemplo n.º 11
0
 public virtual void AddKeyframes(CameraCurve cameraCurve)
 {
 }
Exemplo n.º 12
0
 public static CameraCurveResult Evaluate(float time, CameraCurve cameraCurve)
 {
     return(null);
 }
Exemplo n.º 13
0
        public TripodCameraKeyFrame(Vector3 pos, Quaternion rot, float yOffset, float fov, float t, CameraCurve cameraCurve)
        {
            position          = pos;
            rotation          = rot;
            this.time         = t;
            this.fov          = fov;
            this.focusOffsetY = yOffset;

            AddKeyframes(cameraCurve);
        }
Exemplo n.º 14
0
        public TripodCameraKeyFrame(Transform cameraTransform, float yOffset, float fov, float t, CameraCurve cameraCurve)
        {
            position          = cameraTransform.position;
            rotation          = Quaternion.LookRotation(PlayerController.Instance.skaterController.skaterTransform.position + focusOffsetY * Vector3.up - position, Vector3.up);
            this.time         = t;
            this.fov          = fov;
            this.focusOffsetY = yOffset;

            AddKeyframes(cameraCurve);
        }
Exemplo n.º 15
0
 public OrbitCameraKeyFrame(Vector3Radial radialPos, Vector3 pos, Quaternion rot, float yOffset, float fov, float t, CameraCurve cameraCurve)
 {
     this.radialPos    = radialPos;
     position          = PlayerController.Instance.skaterController.skaterTransform.position + Vector3.up * focusOffsetY + radialPos.cartesianCoords;
     rotation          = Quaternion.LookRotation(-radialPos.cartesianCoords, Vector3.up);
     this.time         = t;
     this.fov          = fov;
     this.focusOffsetY = yOffset;
     AddKeyframes(cameraCurve);
 }