Пример #1
0
    public void MovePlayer()
    {
        GravitySimulation();

        Vector3 localRot = axis.x * transform.right + axis.y * transform.forward;

        StablishSpeed();

        CalculateSpeeds();

        moveDir.x = localRot.x * speed;
        moveDir.z = localRot.z * speed;

        moveDir = RotateWithView();

        moveDir.y = verticalSpeed;
        //transform.localRotation = Quaternion.Euler(RotateWithView());

        controler.Move(moveDir * Time.deltaTime);

        anims.ForwardAnimation();

        if (axis.y != 0 || axis.x != 0)
        {
            moving = true;
        }
        else
        {
            moving = false;
        }

        if (axis.y > 0.1f && axis.x <= movingForwardXOffset && axis.x >= -movingForwardXOffset)
        {
            movingForward = true;
        }
        else
        {
            movingForward = false;
        }
    }