Используется 2 Quaternion.Euler, что видимо создаёт этот баг с рукой и как можно решить проблему?
https://i.stack.imgur.com/ynMGV.png
Вот кусок кода:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Animations;
public class PlayerMovement : MonoBehaviour
{
//Здесь записаны все переменные используемые в коде
[SerializeField] float speed;
[SerializeField] Rigidbody2D rb;
[SerializeField] Vector2 moveInput;
[SerializeField] Vector2 moveVelocity;
[SerializeField] Joystick walkableJoystick;
[SerializeField] Joystick shooterJoystick;
[SerializeField] float rotation;
[SerializeField] float offset;
[SerializeField] Animator anim;
[SerializeField] Transform rightHand;
[SerializeField] Transform rightHandO;
private void Update()
{
moveInput = new Vector2(walkableJoystick.Horizontal, walkableJoystick.Vertical);
moveVelocity = moveInput.normalized * speed;
rotation = Mathf.Atan2(shooterJoystick.Horizontal, shooterJoystick.Vertical) * Mathf.Rad2Deg;
if (rotation != 0)
{
rightHand.rotation = Quaternion.Euler(0, 0, rotation * offset);
}
if (rightHand.rotation.z > -75)
{
rightHandO.rotation = Quaternion.Euler(0, 0, 180);
}
}[![введите сюда описание изображения][1]][1]