Example #1
0
        /// <summary>
        /// 底层接口,设置下一个相机视角参数
        /// </summary>
        /// <param name="InViewTarget"></param>
        /// <param name="InViewInfo"></param>
        /// <param name="smoothTime"></param>
        private void SetPendingViewInfo(Transform InViewTarget, CameraViewInfo InViewInfo, float smoothTime = 0.15f)
        {
            m_PendingVT.InitViewTarget(InViewTarget, InViewInfo);

            m_RigVelocity = Vector3.zero;
            m_FovVelocity = 0;
            //m_PitchVelocity = 0;
            m_YawVelocity = 0;
            m_DisVelocity = 0;
            m_SmoothTime  = smoothTime;
        }
Example #2
0
        /// <summary>
        /// 初始化静态数据、运行时数据
        /// </summary>
        /// <param name="InViewTarget"></param>
        /// <param name="InViewInfo"></param>
        public void Init(Transform InViewTarget, CameraViewInfo InViewInfo)
        {
            // step 1. copy static data
            CopyFrom(InViewInfo);

            // step 2. calc runtime variants
            if (InViewTarget != null)
            {
                rig = InViewTarget.position + InViewTarget.TransformVector(rigOffset);
            }
            fov      = defaultFOV;
            pitch    = defaultPitch;
            yaw      = CameraManager.NormalizeAngle((InViewTarget != null ? InViewTarget.transform.rotation.eulerAngles.y : 0) + defaultYaw);
            distance = defaultDistance;
        }
Example #3
0
        /// <summary>
        /// 仅复制静态数据
        /// </summary>
        /// <param name="InViewInfo"></param>
        private void CopyFrom(CameraViewInfo InViewInfo)
        {
            rigOffset        = InViewInfo.rigOffset;
            rigOffsetWhenAim = InViewInfo.rigOffsetWhenAim;

            defaultFOV = InViewInfo.defaultFOV;

            defaultPitch = InViewInfo.defaultPitch;
            minPitch     = InViewInfo.minPitch;
            maxPitch     = InViewInfo.maxPitch;

            defaultYaw = InViewInfo.defaultYaw;

            defaultDistance = InViewInfo.defaultDistance;
            minDistance     = InViewInfo.minDistance;
            maxDistance     = InViewInfo.maxDistance;
        }
Example #4
0
        public void SaveToDefault(Transform viewTarget, CameraViewInfo srcViewInfo, CameraViewInfo dstViewInfo)
        {
            if (srcViewInfo == null || dstViewInfo == null)
            {
                Debug.LogError("CameraController.Save: srcViewInfo == null ||dstViewInfo == null");
                return;
            }

            dstViewInfo.rigOffset        = srcViewInfo.rigOffset;
            dstViewInfo.rigOffsetWhenAim = srcViewInfo.rigOffsetWhenAim;
            dstViewInfo.defaultFOV       = srcViewInfo.fov;
            dstViewInfo.defaultPitch     = srcViewInfo.pitch;
            dstViewInfo.minPitch         = srcViewInfo.minPitch;
            dstViewInfo.maxPitch         = srcViewInfo.maxPitch;
            dstViewInfo.defaultYaw       = 0;
            dstViewInfo.defaultDistance  = srcViewInfo.distance;
            dstViewInfo.minDistance      = srcViewInfo.minDistance;
            dstViewInfo.maxDistance      = srcViewInfo.maxDistance;
        }
Example #5
0
        /// <summary>
        /// 底层接口,初始化相机视角参数
        /// </summary>
        /// <param name="InViewTarget"></param>
        /// <param name="InViewInfo"></param>
        private void InitViewInfo(Transform InViewTarget, CameraViewInfo InViewInfo)
        {
            m_CurVT.InitViewTarget(InViewTarget, InViewInfo);

            SetPendingViewInfo(InViewTarget, InViewInfo, 0);
        }
Example #6
0
 public void GetViewInfo(out Transform viewTarget, out CameraViewInfo viewInfo, out CameraViewInfo srcViewInfo)
 {
     viewTarget  = (m_PendingVT != null && m_PendingVT.m_ViewTarget != null) ? m_PendingVT.m_ViewTarget : null;
     viewInfo    = (m_PendingVT != null && m_PendingVT.m_ViewInfo != null) ? m_PendingVT.m_ViewInfo : null;
     srcViewInfo = m_ViewInfoCollection != null ? m_ViewInfoCollection[curCharView] : null;
 }
Example #7
0
            public void InitViewTarget(Transform InViewTarget, CameraViewInfo InViewInfo)
            {
                m_ViewTarget = InViewTarget;

                m_ViewInfo.Init(InViewTarget, InViewInfo);
            }
Example #8
0
 public FViewTarget()
 {
     m_ViewInfo = ScriptableObject.CreateInstance <CameraViewInfo>();
 }