/// <summary>
    /// 摇杆操作
    /// </summary>
    /// <param name="move"></param>
    void OnJoystickMove(MovingJoystick move)
    {
        if (_avatarObj == null)
        {
            return;
        }
        if (move.joystickName != "New joystick")
        {
            return;
        }

        _positionX = move.joystickAxis.x;      //   获取摇杆偏移摇杆中心的x坐标
        _positionY = move.joystickAxis.y;      //    获取摇杆偏移摇杆中心的y坐标
        if (_bBeforeDragging)
        {
            _bBeforeDragging = false;
            //   _avatarObj.ChangeAvatarForward(ComMoveControllerObj.GetFPTransform().forward);
            _fpChangeAvatarForward = ComMoveControllerObj.GetFPTransform().forward;
            _fpDragFlag            = true;
            Debug.Log("_bBeforeDragging_bBeforeDragging_bBeforeDragging::" + _fpChangeAvatarForward.ToVector());
        }

        FrameSyncInput.SetFP((byte)E_InputId.E_MOVE_X, _positionX);
        FrameSyncInput.SetFP((byte)E_InputId.E_MOVE_Y, _positionY);
    }
    /**
     * @brief Instantiates a new prefab in a deterministic way.
     *
     * @param prefab GameObject's prefab to instantiate.
     * @param position Position to place the new GameObject.
     * @param rotation Rotation to set in the new GameObject.
     **/

    public static GameObject SyncedInstantiate(GameObject prefab, FPVector position, FPQuaternion rotation)
    {
        if (instance != null /*&& instance.lockstep != null*/)
        {
            GameObject go = GameObject.Instantiate(prefab, position.ToVector(), rotation.ToQuaternion()) as GameObject;

            MonoBehaviour[] monoBehaviours = go.GetComponentsInChildren <MonoBehaviour>();
            for (int index = 0, length = monoBehaviours.Length; index < length; index++)
            {
                MonoBehaviour bh = monoBehaviours[index];

                if (bh is IFrameSyncBehaviour)
                {
                    instance.mapManagedBehaviors.Add(new KeyValuePair <IFrameSyncBehaviour, FrameSyncManagedBehaviour>(
                                                         (IFrameSyncBehaviour)bh, instance.NewManagedBehavior((IFrameSyncBehaviour)bh)
                                                         ));
                }
            }

            InitializeGameObject(go, position, rotation);

            return(go);
        }

        return(null);
    }
예제 #3
0
    /**
     * @brief Instantiates a new prefab in a deterministic way.
     *
     * @param prefab GameObject's prefab to instantiate.
     * @param position Position to place the new GameObject.
     * @param rotation Rotation to set in the new GameObject.
     **/

    public static GameObject SyncedInstantiate(GameObject prefab, FPVector position, FPQuaternion rotation)
    {
        if (instance != null /*&& instance.lockstep != null*/)
        {
            GameObject go = GameObject.Instantiate(prefab, position.ToVector(), rotation.ToQuaternion()) as GameObject;
            AddSyncBehaviour(go);
            InitializeGameObject(go, position, rotation);
            return(go);
        }
        return(null);
    }
예제 #4
0
 void onDrawPath()
 {
     if (path != null && path.Length > 0)
     {
         Gizmos.color = Color.green;
         FPVector currPostion = GridMap.GetCenterPoint(path[0].x, path[0].y);
         for (int i = stepIndex; i < path.Length; i++)
         {
             FPVector nextPosition = GridMap.GetCenterPoint(path[i].x, path[i].y);
             nextPosition = GetOnGroundPoint(nextPosition);
             Gizmos.DrawLine(currPostion.ToVector(), nextPosition.ToVector());
             currPostion = nextPosition;
         }
     }
 }
예제 #5
0
    public override void OnSyncedUpdate()
    {
        bool     MouseLeft     = FrameSyncInput.GetBool((byte)OPER_CMD.MOUSE_LEFT);
        bool     MouseRight    = FrameSyncInput.GetBool((byte)OPER_CMD.MOUSE_RIGHT);
        FPVector MousePosition = FrameSyncInput.GetFPVector((byte)OPER_CMD.MOUSE_POSITION);

        if ((MouseLeft || MouseRight) && !GameUtils.IsCursorOverUI())//如果鼠标不是点击在UI上面
        {
            var        ray = Camera.main.ScreenPointToRay(MousePosition.ToVector());
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit))
            {
                if (MouseLeft)
                {
                    GameEntity targetEntity = hit.transform.GetComponent <GameEntity>();
                    if (targetEntity)
                    {
                        SetIndicatorViaParent(hit.transform);               //地图上标记目的地

                        if (CanCastSkill(SKILL_NMAE.SKILL_1, targetEntity)) //平A
                        {
                            CastSkill(SKILL_NMAE.SKILL_1, targetEntity);
                        }
                    }
                }
                else if (MouseRight)
                {
                    GameEntity targetEntity = hit.transform.GetComponent <GameEntity>();
                    if (targetEntity)
                    {
                        SetIndicatorViaParent(hit.transform);//地图上标记目的地
                    }
                }
                else
                {
                }
            }
        }
    }
    public override void OnSyncedUpdate()
    {
        DealSycncedEndInfo();

        FPVector changeForwardVec3 = FrameSyncInput.GetFPVector((byte)E_InputId.E_DRAGGING_CAMERA);
        bool     IdelFlag          = FrameSyncInput.GetBool((byte)E_InputId.E_IDEL);
        FP       move_x            = FrameSyncInput.GetFP((byte)E_InputId.E_MOVE_X);
        FP       move_y            = FrameSyncInput.GetFP((byte)E_InputId.E_MOVE_Y);


        bool mouseDraggingFlag = FrameSyncInput.GetBool((byte)E_InputId.E_MOUSE_DRAGGING);
        bool mouseDragEndFlag  = FrameSyncInput.GetBool((byte)E_InputId.E_MOUSE_DRAGEND);

        if (mouseDraggingFlag || mouseDragEndFlag)
        {
            bool leftDirection  = FrameSyncInput.GetBool((byte)E_InputId.E_MOUSE_DRAG_LEFT);
            bool rightDirection = FrameSyncInput.GetBool((byte)E_InputId.E_MOUSE_DRAG_RIGHT);
            ComMoveFollowObj.SetMouseDragDirection(leftDirection, rightDirection);
            if (mouseDraggingFlag)
            {
                ComMoveFollowObj.SetMouseDragFlag(true);
            }
            else
            {
                ComMoveFollowObj.SetMouseDragFlag(false);
            }
        }

        if (changeForwardVec3 != FPVector.zero)
        {
            Debug.Log("changeForwardVec3:::::::::::" + changeForwardVec3.ToVector() + ",,,E_InputId.E_IDEL::" + IdelFlag);
            Debug.Log("FP_FP_FP_::move_x_xxxxxxxx::" + move_x.AsFloat() + ",move_y::" + move_y.AsFloat());
        }

        //移动处理
        if (IdelFlag)
        {
            Idle();
            ComMoveFollowObj.SetJoyStickMoveFlag(false);
            //Debug.Log("idelidelidelidelidelidelidelidelidelidelidelidelidelidelidel");
        }
        else
        {
            if (move_x != 0 || move_y != 0)
            {
                if (changeForwardVec3 != FPVector.zero)
                {
                    Debug.Log("changeForwardVec3::" + changeForwardVec3.ToVector() + "camera::" + ComMoveFollowObj.transform.forward + ",touch:::" + ComMoveFollowObj._bTouchMouse);
                    ChangeAvatarForward(changeForwardVec3);
                    // Debug.Log("changeForwardVec3:::::::::::" + changeForwardVec3.ToVector()  +"camera::"+ ComMoveFollowObj.transform.forward);
                }
                SycnMove(move_x, move_y);
            }
        }


        //射击处理
        bool shootDownFlag = FrameSyncInput.GetBool((byte)E_InputId.E_SHOOT_DOWN);

        if (shootDownFlag)
        {
            Shoot(changeForwardVec3);
        }
        bool shootUpFlag = FrameSyncInput.GetBool((byte)E_InputId.E_SHOOT_UP);

        if (shootUpFlag)
        {
            Shoot(FPVector.zero, false);
        }

        //跳跃处理
        bool jumpFlag = FrameSyncInput.GetBool((byte)E_InputId.E_JUMP);

        if (jumpFlag)
        {
            Jump();
        }

        //模型改变处理
        int modelRender = FrameSyncInput.GetInt((byte)E_InputId.E_CHANGE_MODEL);

        if (modelRender > 0)
        {
            if (modelRender == (int)KeyCode.P)      //人形
            {
                ChangeAvatarForm(Avatar.E_AvatarForm.PERSON_STATE);
            }
            else if (modelRender == (int)KeyCode.F)  //乌贼
            {
                ChangeAvatarForm(Avatar.E_AvatarForm.INKFISH_STATE);
            }
            else if (modelRender == (int)KeyCode.D)  //下潜模式
            {
                ChangeAvatarForm(Avatar.E_AvatarForm.INKFISHDIVE_STATE);
            }
        }

        //更换装备
        int replaceWeaponFlag = FrameSyncInput.GetInt((byte)E_InputId.E_REPLACE_WEAPON);

        if (replaceWeaponFlag > 0)
        {
            ChangeWeapon(replaceWeaponFlag);
        }

        //扔手雷
        bool throwGrenadeFlag = FrameSyncInput.GetBool((byte)E_InputId.E_THROW_GRENADE);

        if (throwGrenadeFlag)
        {
            ThrowGrenade();
        }
    }
예제 #7
0
    public void Update()
    {
        if (_destVector != FPVector.zero)
        {
            float disData   = Vector3.Distance(transform.position, _ufpTransform.position.ToVector());
            FP    fixDistan = MoveSpeed * Time.deltaTime;
            if (disData <= fixDistan)
            {
                UpdatePosition(_ufpTransform.position);
                UpdateRotation(_ufpTransform.rotation);
                //   Debug.Log("======>arrived_____arrived_____arrived_____arrived_____arrived:::" + _ufpTransform.position);
            }
            else
            {
                transform.position += (_childObj.forward * fixDistan).ToVector();
                // Debug.Log("======>_ufpTransform.position_OnLine:::"+ _ufpTransform.position);
            }
        }

        if (_destRoundData != 0)
        {
            FP angleData = _destRoundData - _roundData;
            FP _tempData = RotationSpeed * MoveSpeed * Time.deltaTime;

            //Debug.Log("======>angleData:::" + angleData.AsFloat()
            //      + ",_tempData::" + _tempData.AsFloat() + ",_destRoundData::"+ _destRoundData);
            if (FPMath.Abs(angleData) <= FPMath.Abs(_tempData))
            {
                UpdatePosition(_ufpTransform.position);
                UpdateRotation(_ufpTransform.rotation);
                _roundData = _destRoundData;
                //Debug.Log("======>arrived_____round_____arrived_____round_____arrived:::" + _ufpTransform.position
                //      + ",childObj.forward::" + _childObj.forward + ",childObj.forward.toVector3::" + _childObj.forward.ToVector());
            }

            else
            {
                transform.RotateAround(_center.ToVector(), transform.up, _tempData.AsFloat());
                _roundData += _tempData;
                Debug.Log("======>_ufpTransform.round_round_OnLine:::" + _ufpTransform.position + ",_ufpTransform.position.toVector3::" + _ufpTransform.position
                          //    + ", ufpTransform.rotation:::" + _ufpTransform.rotation
                          //    + ",_ufpTransform.rotation.toVector()::" + _ufpTransform.rotation.ToQuaternion()
                          + ",childObj.forward::" + _childObj.forward + ",childObj.forward.toVector3::" + _childObj.forward.ToVector());
            }
        }


        RaycastHit hitInfo;
        bool       bExitBarrier = (RayBarrierInfo(_childObj.forward.ToVector(), out hitInfo));

        RaycastHit _groundHit;
        RaycastHit _hitInfo;

        if (bJumpFlag)         //处理跳跃
        {
            if (!bJumpArtFlag) //表示第一次开始跳跃
            {
                if (!RayGroundInfo(out _groundHit, true))
                {
                    bJumpArtFlag = true;
                }
            }
            else
            {
                if (RayGroundInfo(out _groundHit, true))
                {
                    bJumpFlag    = false;
                    bJumpArtFlag = false;
                    return;
                }
            }
            _jumpSpeed = _jumpSpeed - g * FrameSyncManager.DeltaTime;                                    //垂直上的初速度随时间的改变
            _ufpTransform.Translate(FPVector.up * _jumpSpeed * FrameSyncManager.DeltaTime, Space.World); //垂直上的运动
            UpdateRotation(_ufpTransform.rotation);
            UpdatePosition(_ufpTransform.position);
            //transform.Translate(Vector3.up * _jumpSpeed * FrameSyncManager.DeltaTime, Space.World);//垂直上的运动


            //if (_jumpSpeed < 0 && RayGroundInfo(out _groundHit, true))   //增加防止坠落的操作
            //{
            //    transform/*.parent*/.position = new Vector3(transform/*.parent*/.position.x, _groundHit.point.y, transform/*.parent*/.position.z);
            //    bJumpFlag = false;
            //    bJumpArtFlag = false;
            //    return;
            //}

            if (bMoveFlag)
            {
                _ufpTransform.Translate(_childObj.forward * MoveSpeed * FrameSyncManager.DeltaTime, Space.World);//水平上的运动
                UpdateRotation(_ufpTransform.rotation);
                UpdatePosition(_ufpTransform.position);
                //  transform.Translate(_childObj.forward.ToVector() * (MoveSpeed/** _frameEntityObj.SpeedRate*/).AsFloat() * Time.fixedDeltaTime, Space.World);//水平上的运动
            }
            return;
        }
        else if (!RayGroundInfo(out _groundHit) && !RayBarrierInfo(_childObj.forward.ToVector(), out _hitInfo) && _bHasSpeed)//空中调整角度
        {
            //Debug.Log("_childObj.forward.ToVector():::" + _childObj.forward.ToVector()
            //    + ",,,,data__ufpTransform.up::" + _ufpTransform.up.ToVector() + ",,,,,fff::"+ _ufpTransform.forward.ToVector());
            _verCurSpeed = _verCurSpeed - g * FrameSyncManager.DeltaTime;                                     //垂直上的初速度随时间的改变
            _ufpTransform.Translate(_childObj.forward * MoveSpeed * FrameSyncManager.DeltaTime, Space.World); //水平上的运动
            _ufpTransform.Translate(FPVector.up * _verCurSpeed * FrameSyncManager.DeltaTime, Space.World);    //垂直上的运动
            UpdateRotation(_ufpTransform.rotation);
            UpdatePosition(_ufpTransform.position);

            //  transform.Translate(_childObj.forward.ToVector() * (MoveSpeed/** _frameEntityObj.SpeedRate*/).AsFloat() * Time.fixedDeltaTime, Space.World);//水平上的运动
            //  transform.Translate(Vector3.up * _verCurSpeed.AsFloat() * Time.fixedDeltaTime, Space.World);//垂直上的运动

            FP angleForward = FPVector.Angle(_ufpTransform.up, FPVector.up);
            if (angleForward == 0)
            {
                return;
            }

            FPVector normal = FPVector.Cross(_ufpTransform.up, FPVector.up);
            // int DirctData = FPMath.Sign(FPVector.Dot(normal, _ufpTransform.up));
            float DirctData = Mathf.Sign(Vector3.Dot(normal.ToVector(), _ufpTransform.up.ToVector()));

            //Debug.Log(" angleForward::" + angleForward.AsFloat() + ",DirctData::"+ DirctData + ",_ufpTransform.up::"+ _ufpTransform.up + "  ,"+  _ufpTransform.up.ToVector() + ",FPVector.up::"+ FPVector.up.ToVector()
            //    + ",normal::" + normal + "," + normal.ToVector()  + ", FPVector.Dot(normal, _ufpTransform.up)::" + FPVector.Dot(normal, _ufpTransform.up).AsFloat());
            //if (DirctData == 0) DirctData = 1;
            angleForward = angleForward * DirctData;

            //   Debug.Log(" FPMath.Sign(FPVector.Dot(normal, _ufpTransform.up)::" + FPVector.Dot(new FPVector(0,0,1), new FPVector(1, 0, 0)));
            FPVector forwardVec3    = FPQuaternion.AngleAxis(angleForward, normal) * _ufpTransform.up;
            FPVector forwardForward = FPQuaternion.AngleAxis(angleForward, normal) * _ufpTransform.forward;

            FPQuaternion qur = FPQuaternion.LookRotation(forwardForward, forwardVec3);
            //Debug.Log("forwardForward:::" + forwardForward.ToVector() + ",,forwardVec3::" + forwardVec3.ToVector()
            //    + ",angleForward::"+ angleForward.AsFloat()
            //    + ",_ufpTransform.up::" + _ufpTransform.up.ToVector() + ", _ufpTransform.forward::" + _ufpTransform.forward.ToVector()
            //    + ",normal::" + normal.ToVector());
            UpdateRotation(FPQuaternion.Slerp(_ufpTransform.rotation, qur, 0.1f));
            //_ufpTransform.SetRotation();
            //transform.rotation = FPQuaternion.Slerp(_ufpTransform.rotation, qur, 0.1f);

            //将玩家处于空中的状态事件发射出去
            TriggerEvent(DefineEventId.PlayerInAirEvent);
        }
        else
        {
            FP angle = FPVector.Angle(FPVector.up, _ufpTransform.ChangeVec3ToTSVec(_groundHit.normal));
            if (angle > SlopeAngle)
            {
                if (!bMoveFlag)
                {
                    _ufpTransform.Translate(-1 * (FPVector.up) * g * FrameSyncManager.DeltaTime, Space.World);
                    UpdateRotation(_ufpTransform.rotation);
                    UpdatePosition(_ufpTransform.position);
                }
            }
            else
            {
                // transform.position = new Vector3(transform/*.parent*/.position.x, _groundHit.point.y, transform/*.parent*/.position.z);
                UpdateRotation(_ufpTransform.rotation);
                UpdatePosition(new FPVector(_ufpTransform.position.x, (FP)(_groundHit.point.y), _ufpTransform.position.z));
            }
        }
    }
예제 #8
0
    public void Update()
    {
        if (Target == null)
        {
            return;
        }
        //  ChangeDirectionByDragging();
        //if (_dragging && _directorToLeft && !_bTouchMouse)  //左遥感
        //{
        //    _rockerControl = ComMoveController.RockerControl.LeftControl;
        //    _ufpTransform.RotateAround(_playerTransformObj.position, FPVector.up, FrameSyncManager.DeltaTime * RockerSpeed);
        //    _ufpTransform.UpdateAllData();
        //    Debug.Log("_ufpTransform:::" + _ufpTransform.forward.ToVector());
        //    //transform.RotateAround(_childObj.position, Vector3.up, Time.deltaTime * RockerSpeed);
        //    return;
        //}
        //else if (_dragging && _directorToRight && !_bTouchMouse) //右遥感
        //{
        //    _rockerControl = ComMoveController.RockerControl.RightControl;
        //    _ufpTransform.RotateAround(_playerTransformObj.position, FPVector.up, FrameSyncManager.DeltaTime * -RockerSpeed);
        //    _ufpTransform.UpdateAllData();

        //    // transform.RotateAround(_childObj.position, Vector3.up, Time.deltaTime * -RockerSpeed);
        //    return;
        //}


        //Debug.Log("_currentAngle:::" + _currentAngle + ",_childObj.eulerAngles.y::" + _childObj.eulerAngles.y
        //    + ",transform.rotation::"+ transform.rotation);

        RaycastHit GroundHitInfo;
        RaycastHit BarrieHitrInfo;
        bool       bGroundInfoFlag  = _motionObj.RayGroundInfo(out GroundHitInfo);
        bool       bBarrierInfoFlag = _motionObj.RayBarrierInfo(_childTransformObj.forward.ToVector(), out BarrieHitrInfo);

        FPVector fpGroundInfoNormal = FPVector.zero;

        if (bGroundInfoFlag)
        {
            fpGroundInfoNormal = GroundHitInfo.normal.ToFPVector();
        }

        if (!_dragging && !_bTouchMouse && _bBeforeDragging)
        {
            _rockerControl = ComMoveController.RockerControl.None;
            return;
        }
        else if (!_dragging)
        {
            if (_bBeforeDragging)  //在这里设置值,为了保证childObj的forward朝向跟摄像机的一致,防止先后差值
            {
                _bBeforeDragging = false;
                return;
            }

            if (!bGroundInfoFlag)  //在空中
            {
                _rockerControl = ComMoveController.RockerControl.AirControl;
                if (_motionObj.bJumpFlag && false)  //这是处理不跟随着对象跳跃的逻辑部分
                {
                    Distance = FPMath.Clamp(Distance - (Input.GetAxis("Mouse ScrollWheel") * MouseScrollWheelSensitivity), DistanceMin, DistanceMax);
                    FPVector DataVec3 = new FPVector(_playerTransformObj.position.x, transform.position.y - Height, _playerTransformObj.position.z);
                    _ufpTransform.position = (_ufpTransform.rotation * new FPVector(.0f, Height, -Distance)) + DataVec3;
                    _ufpTransform.UpdateAllData();
                    return;
                }
            }
            else if (!bBarrierInfoFlag || !_motionObj.JudgetGroundSlope(BarrieHitrInfo.normal))  //有地面接触但前方没有障碍物
            {
                if (!_motionObj.JudgetGroundSlope(GroundHitInfo.normal))
                {
                    _rockerControl  = ComMoveController.RockerControl.OtherControl;
                    _climbOtherWall = false;
                }
                else
                {
                    if (_climbOtherWall && _beforeWallNormalVec3 != fpGroundInfoNormal)  //表示从一面墙跨到另外一面墙
                    {
                        _beforeGroundNormalVec3 = _beforeWallNormalVec3;
                        _beforeWallNormalVec3   = fpGroundInfoNormal;
                    }
                    _rockerControl = ComMoveController.RockerControl.ClimbControl;
                }
            }
            else //有地面接触且前方有障碍物
            {
                _rockerControl = ComMoveController.RockerControl.None;
                _beforeControl = ComMoveController.RockerControl.OtherControl;
                if (!_motionObj.JudgetGroundSlope(GroundHitInfo.normal)) //从地面跨到墙上的情况
                {
                    _beforeGroundNormalVec3 = fpGroundInfoNormal;
                }
                else                                                   //从一面墙跨到另外一面墙的情况
                {
                    _climbOtherWall       = true;
                    _beforeWallNormalVec3 = fpGroundInfoNormal;   //设置这个变量的原因是:有可能检测到障碍物,但是玩家并没有跨越过去
                }
            }
        }

        if (_rockerControl == RockerControl.AirControl)
        {
            Distance = FPMath.Clamp(Distance - (Input.GetAxis("Mouse ScrollWheel") * MouseScrollWheelSensitivity), DistanceMin, DistanceMax);
            _ufpTransform.position = (_ufpTransform.rotation * new FPVector(.0f, Height, -Distance)) + _playerTransformObj.position;
            _ufpTransform.UpdateAllData();
        }
        else if (_rockerControl == RockerControl.OtherControl)
        {
            var quaternion = FPQuaternion.AngleAxis((_currentAngle) + _childTransformObj.transform.eulerAngles.y, FPVector.up);
            Distance = FPMath.Clamp(Distance - (Input.GetAxis("Mouse ScrollWheel") * MouseScrollWheelSensitivity), DistanceMin, DistanceMax);
            _ufpTransform.SetRotation(quaternion);
            // transform.rotation = quaternion;
            FPVector data = (_ufpTransform.rotation * new FPVector(.0f, Height, -Distance));

            _ufpTransform.position = (_ufpTransform.rotation * new FPVector(.0f, Height, -Distance)) + _playerTransformObj.position;
            _ufpTransform.UpdatePosition();
            //Debug.Log("data::"+ data.ToVector()+ ", _ufpTransform.position::::" + _ufpTransform.position.ToVector()
            //    + ",transform::" + transform.position + "::_playerTransformObj.position:" + _playerTransformObj.position.ToVector()
            //    + ",,name::" + _playerTransformObj.gameObject.name);
            _rotation = _ufpTransform.rotation;
            _ufpTransform.UpdateForward();
        }
        else if (_rockerControl == RockerControl.ClimbControl)
        {
            Distance = FPMath.Clamp(Distance - (Input.GetAxis("Mouse ScrollWheel") * MouseScrollWheelSensitivity), DistanceMin, DistanceMax);
            var quaternion = FPQuaternion.AngleAxis((0) + transform.eulerAngles.y, FPVector.up);
            _ufpTransform.position = (_ufpTransform.rotation * new FPVector(.0f, Height, -Distance)) + _playerTransformObj.position;
            _ufpTransform.UpdateAllData();

            FPVector climbForward = _ufpTransform.forward;

            if (_beforeControl == ComMoveController.RockerControl.OtherControl && _beforeGroundNormalVec3 != FPVector.zero)
            {
                FP       tempAngle = FPVector.Angle(_beforeGroundNormalVec3, fpGroundInfoNormal);
                FPVector normal    = FPVector.Cross(_beforeGroundNormalVec3, fpGroundInfoNormal); //叉乘求出法线向量
                                                                                                  //  num *= Mathf.Sign(Vector3.Dot(normal, info.transform.up));  //求法线向量与物体上方向向量点乘,结果为1或-1,修正旋转方向
                climbForward          = FPQuaternion.AngleAxis((90 - tempAngle), normal) * fpGroundInfoNormal;
                climbForward          = -1 * climbForward;
                _finishWallNormalVec3 = climbForward;
                _beforeControl        = ComMoveController.RockerControl.ClimbControl;
            }

            FP forwardAngle = FPVector.Angle(_finishWallNormalVec3, _ufpTransform.forward);
            if (forwardAngle != 0 && false)  //处理摄像机角度偏转
            {
                //1)调整摄像机的旋转角度
                float    direcFlag  = -1;
                FPVector normalVec3 = FPVector.Cross(_finishWallNormalVec3, _ufpTransform.forward);           //叉乘求出法线向量
                direcFlag    *= FPMath.Sign(Vector3.Dot(normalVec3.ToVector(), _ufpTransform.up.ToVector())); //求法线向量与物体上方向向量点乘,结果为1或-1,修正旋转方向
                forwardAngle *= direcFlag;

                FPVector beforeForward = _ufpTransform.forward;
                FPVector forward       = FPQuaternion.AngleAxis(forwardAngle, _ufpTransform.up) * _ufpTransform.forward;
                //   Debug.Log("_ufpTransform.forward::" + _ufpTransform.forward.ToVector() + ",forward::" + forward.ToVector()
                //        + "forwardAngle:::" + forwardAngle.AsFloat() + ",forward1111::" + forward);
                float quaternionSpeed = 0.003f;
                if (!_bTouchMouse)
                {
                    quaternionSpeed = 0.03f;
                }
                if (beforeForward != forward)
                {
                    Debug.Log("LookRotation(forward):::" + FPQuaternion.LookRotation(forward) + ",_rotation::" + _rotation + ",unity::" + Quaternion.LookRotation(forward.ToVector()));

                    _rotation = FPQuaternion.Slerp(_rotation, FPQuaternion.LookRotation(forward), quaternionSpeed);
                    _ufpTransform.SetRotation(_rotation);
                }
                //   Debug.Log(",forward::"+ forward.ToVector() + ",_ufpTransform.forward::" + _ufpTransform.forward.ToVector());
                //2)调整人物的旋转角度
                if (!_climbOtherWall)  // 这是从地面爬到墙得处理,如果是从一面墙爬到另外一面墙,镜头不做转换
                {
                    Debug.Log("beforeForward:::" + beforeForward.ToVector() + ",_ufpTransform.forward::" + _ufpTransform.forward.ToVector());
                    _offsetAngle = FPVector.Angle(beforeForward, _ufpTransform.forward) * direcFlag;
                    _avatarObj.ChangeAvaterForward(_offsetAngle);
                }
            }
        }

        Debug.DrawLine(_ufpTransform.position.ToVector(), _playerTransformObj.transform.position, Color.red);

        if (_rockerControl == RockerControl.OtherControl ||
            _rockerControl == RockerControl.ClimbControl)
        {
            //看是否有障碍物
            FPVector directionTarget = (_ufpTransform.position - _ufpTransform.ChangeVec3ToTSVec(_rayPointObj.position)).normalized;
            FP       distance        = FPVector.Distance(_ufpTransform.position, _ufpTransform.ChangeVec3ToTSVec(_rayPointObj.position));
            if (distance > Distance)
            {
                _ufpTransform.Translate(directionTarget * (distance - Distance));
                _ufpTransform.UpdateRotationAndPosition();
            }

            //  Debug.DrawRay(_rayPointObj.position, directionTarget * Distance, Color.black);
            int        layerMask = LayerMask.GetMask(Layers.Render);
            RaycastHit info;
            if (Physics.Raycast(_rayPointObj.position, directionTarget.ToVector(), out info, Distance.AsFloat(), layerMask))  //如果
            {
                //   Debug.Log("info.name::" + info.transform.name);
                if (info.transform.name != transform.name /*&& info.transform.tag != Tags.Ground*/)
                {
                    _ufpTransform.SetPosition(_ufpTransform.ChangeVec3ToTSVec(info.point));
                    //transform.position = info.point;
                }
                if (_rockerControl == RockerControl.OtherControl)
                {
                    _beforeControl = RockerControl.OtherControl;
                }
            }
        }
    }