Please help me how to maintain the direction and forward value of mobile joystick.

I downloaded a fixed joystick from the Asset Store and tried to move the player in all directions with my fingers and thumb on the 2D screen using the x- and z-axes as horizontal and vertical in 3D.

When you lift your finger, the joystick automatically centers and stops the player.

Here, I want to maintain the rotation and forward speed in the last direction before holding the hand, so that even if the player removes the finger and the joystick is automatically returned to the center, the player continues to maintain the state before removing the finger. please help.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Windows;

public class managerController : MonoBehaviour
{
    public FixedJoystick joystick;
    public Canvas inputCanvas;
    public bool isJoystick;

    public GameObject player;
    public GameObject character;

    public managerController inputs;
    public Vector3 movementDirection;
    private Vector3 movement;

    public float moveSpeed;
    public float rotationSpeed;
    private Vector3 movement;
    private float resultSpeed;
    private float moveX;
    private float moveZ;

    public void EnableJoystickInput()
    {
        isJoystick = true;
        inputCanvas.gameObject.SetActive(true);      
   }

    // Start is called before the first frame update

    void Start()
    {
        EnableJoystickInput();
        resultSpeed = 0.1f * moveSpeed * Time.deltaTime;
    }

    // Update is called once per frame
    void Update()
    {
        if(isJoystick)
        {
            // joystick recognition
            var movementDirection = new Vector3(joystick.Direction.x, y: 0.0f, z:joystick.Direction.y);

            if (movementDirection.sqrMagnitude<=0)
            {
                return;
            }

            // Rotation of characters; Only the plane turns in the direction it is going
            var targetDirection = Vector3.RotateTowards(current: player.transform.forward, target: movementDirection, maxRadiansDelta: rotationSpeed * Time.deltaTime, maxMagnitudeDelta: 0.0f);
            character.transform.rotation = Quaternion.LookRotation(targetDirection);

            // Background and airplane direction action!
            if(character)
            {
                moveX = joystick.Horizontal;
                moveZ = joystick.Vertical;

                movementDirection = new Vector3(moveX * resultSpeed, 0, moveZ * resultSpeed);
                movement = inputs.movementDirection.normalized;
                player.transform.Translate(movement);
                //player.transform.Translate(movementDirection);
            }     
        }
    }
}

Here part…

movementDirection = new Vector3(moveX * resultSpeed, 0, moveZ * resultSpeed);
movement = inputs.movementDirection.normalized;
player.transform.Translate(movement);
//player.transform.Translate(movementDirection);

…I tried to apply this part, but the player just stops and rotates.

Don’t run the direction-change code if the magnitude of the input is below a certain amount.

You probably can fix line 48 to just check if it is less than 0.1f instead of 0