Hello! I have a problem. I’m making an FPS Controller. I have a script that turns the camera up and down and the body of the character left and right. When I rotate the camera up and down, i have lags (>110 ms) and errors appear in the console:
“Gtk is reporting wrong mouse position y inside a widget”. This happens almost every second.
I use ubuntu 22.04 with xfce 4.18.
Code:
void Start()
{
_rb = GetComponent<Rigidbody>();
Cursor.visible = false;
Cursor.lockState = CursorLockMode.Locked;
}
Vector3 MoveDirection{
get{
return new Vector3(Input.GetAxis("Horizontal"),0,Input.GetAxis("Vertical"));
}
}
void FixedUpdate(){
Walk();
Rotate();
}
void Rotate(){
xRotation -= Input.GetAxisRaw("Mouse Y");
xRotation = Mathf.Clamp(xRotation, -70f, 70f);
transform.Rotate(Vector3.up * Input.GetAxisRaw("Mouse X"));
MechaCamera.transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
}
void Walk(){
_rb.AddRelativeForce(MoveDirection * WalkSpeed, ForceMode.Impulse);
}