Beispiel #1
0
        public override void Process(CameraPipelineData data, float t)
        {
            float shakeFuncVal = _shakeFunc.Get(t);

            CameraData destDataWithoutShake = data._dest_data_without_shake;
            Vector3    forward = destDataWithoutShake._rot * Vector3.forward;
            Vector3    tarPos  = destDataWithoutShake._pos + forward * _radius;

            //forward
            Vector3 forwardDelta = forward * _dir.z * shakeFuncVal;

            //right
            float angleX = Mathf.Atan2(_dir.x * shakeFuncVal, _radius) * Mathf.Rad2Deg;
            //up
            float      angleY       = Mathf.Atan2(_dir.y * shakeFuncVal, _radius) * Mathf.Rad2Deg;
            Quaternion rotDelta     = Quaternion.Euler(angleY, angleX, 0);
            Quaternion curDestRot   = destDataWithoutShake._rot * rotDelta;
            Vector3    curNowCamPos = tarPos - curDestRot * Vector3.forward * _radius;
            Vector3    deltaPos     = curNowCamPos - destDataWithoutShake._pos;

            deltaPos += forwardDelta;

            data._dest_data._pos += deltaPos;
            data._dest_data._rot *= rotDelta;
        }
Beispiel #2
0
        public void Process(CameraPipelineData data, float dt)
        {
            int length = _list_shake.Count;

            for (int i = 0; i < length; i++)
            {
                _list_shake[i].Process(data, dt);
            }

            for (int i = _list_shake.Count - 1; i >= 0; i--)
            {
                if (_list_shake[i].IsEnd())
                {
                    _list_shake.RemoveAt(i);
                }
            }
        }
Beispiel #3
0
        public void Process(CameraPipelineData data, float dt)
        {
            // 如果默认的source没有,或者 _player 没有就直接返回
            if (_player == null)
            {
                return;
            }

            // 1.当前的镜头数据
            //CameraSourceData cur_source_data = Convert2CameraSource(data._now_data_witout_shake, _player.WroldPosition);

            //
            CameraData cur_source_data = data._now_data_witout_shake;

            // 混合 source源,根据时间 递归的时候会对_dest_data数据进行赋值
            _blend_source(dt);

            /*if (_dest_source_data._offset.z >= -0.001f)
             *  _dest_source_data._offset.z = -0.001f;*/

            // 做一个递归的操作
            Vector3 dest_offset = _dest_source_data._offset;

            //Vector3 tmp = dest_offset;
            //Vector3 dir = (dest_offset - cur_source_data._pos);

            /*if (dir.sqrMagnitude > _offset_speed * _offset_speed) //太远用lerp
             * {
             *  dest_offset = Vector3.Lerp(cur_source_data._pos, dest_offset, /*dt * _offset_speed#1#_default_speed._offset_speed);
             * }
             * else
             * {
             *  dest_offset = Vector3.SmoothDamp(cur_source_data._pos, dest_offset, ref _move_speed_offset, _default_speed._offset_speed/*, #1#);
             * }*/
            dest_offset = Vector3.SmoothDamp(cur_source_data._pos, dest_offset, ref _move_speed_offset, _default_speed._offset_speed /*, */);


            // 数据复制
            data._dest_data_without_shake._rot = Quaternion.Euler(_dest_source_data._rotaion);
            data._dest_data_without_shake._pos = dest_offset;
            data._dest_data = data._dest_data_without_shake;
        }