using System.Collections;
using UnityEngine;
public class Player : MonoBehaviour {
public Rigidbody rb;
public float movementMultiplier = 0.05f;
private void FixedUpdate()
{
float leftJoyHorizontal = Input.GetAxis("LeftJoystickHorizontal");
float leftJoyVertical = Input.GetAxis("LeftJoystickVertical");
float rightJoyHorizontal = Input.GetAxis("RightJoystickHorizontal");
float rightJoyVertical = Input.GetAxis("RightJoystickVertical");
float leftTrigger = Input.GetAxis("LeftTrigger");
Vector3 rotate = new Vector3(-rightJoyVertical, -rightJoyHorizontal, 0f);
Debug.Log(leftJoyHorizontal + " " + leftJoyVertical);
rb.AddRelativeForce(leftJoyHorizontal*movementMultiplier, -leftJoyVertical*movementMultiplier, 0f, ForceMode.Force);
}
}
If you see the Debug.log(), it logs the value of the left stick to the console. When the left is moved, the value is not 0, but when the stick is back in the center, the values do not update back to zero, as a result of this, my character keeps moving in the direction it was previously given.