SkillViewerCameraSetting.GetCurrentBezierCameraOffset C# (CSharp) Method

GetCurrentBezierCameraOffset() public method

public GetCurrentBezierCameraOffset ( ) : Vector3
return Vector3
    public Vector3 GetCurrentBezierCameraOffset()
    {
        Vector3 a = new Vector3(0.0f, cameraPath_Near.x, cameraPath_Near.y);
        Vector3 b = new Vector3(0.0f, cameraPath_ControlPoint.x, cameraPath_ControlPoint.y);
        Vector3 c = new Vector3(0.0f, cameraPath_Far.x, cameraPath_Far.y);

        // rotate matrix
        Matrix4x4 rotateMat = Matrix4x4.TRS(Vector3.zero, Quaternion.AngleAxis(yaw, Vector3.up), Vector3.one);
        // transform matrix for camera pos
        Matrix4x4 mat = rotateMat * Matrix4x4.TRS(new Vector3(0.0f, up, 0.0f), Quaternion.AngleAxis(pitch, Vector3.right), Vector3.one) * Matrix4x4.TRS(-new Vector3(0.0f, up, 0.0f), Quaternion.identity, Vector3.one);

        // calculate camera pos in world position
        return mat.MultiplyPoint(Bezier2(a, b, c, distance));
    }

Usage Example

 public void MoveToLookat(Vector3 target, bool bSmoothMove)
 {
     followPose.pos = target + cameraSetting.GetCurrentBezierCameraOffset();
     followPose.rot = cameraSetting.GetRotation();
     startPos.pos   = camera.transform.position;
     startPos.rot   = camera.transform.rotation;
     SetState(State.ToLookat);
     timeToStartSwitch = Time.time;
     timeToEndSwitch   = timeToStartSwitch + Pose.GetScale(20.0f, 90.0f, startPos, followPose);
 }