Rotation of the character along the axis Z
Hello everybody. I faced such a problem, when changing the srites (were in Dragon Bones now parts of the bodies), the character forgot how to turn along the z axis and refused to shoot, I figured out the shooting. The inspector does not rotate even manually. The character is standing, and only the point of creation of the bullet rotates. In Rigidbody2D I removed and put the check marks on the rotation, it did not help. something else prevents you from turning. There are any suggestions or tips. Apologies in advance for my english.
public void FixedUpdate() { Move();
if (joystick_attack.Horizontal != 0 || joystick_attack.Vertical != 0) { if ((Mathf.Abs(joystick_attack.Horizontal) >= 0f && Mathf.Abs(joystick_attack.Horizontal) < 0.5f) || Mathf.Abs(joystick_attack.Vertical) >= 0f && Mathf.Abs(joystick_attack.Vertical) < 0.5f) anim.SetBool("Fire_mach", false); } if ((Mathf.Abs(joystick_attack.Horizontal) >= 0.5f && Mathf.Abs(joystick_attack.Horizontal) < 0.7f) || Mathf.Abs(joystick_attack.Vertical) >= 0.5f && Mathf.Abs(joystick_attack.Vertical) < 0.7f) { anim.SetBool("Fire_mach", true); } if ((Mathf.Abs(joystick_attack.Horizontal) >= 0.7f && Mathf.Abs(joystick_attack.Horizontal) <= 1f) || Mathf.Abs(joystick_attack.Vertical) >= 0.7f && Mathf.Abs(joystick_attack.Vertical) <= 1f) { anim.SetBool("Fire_mach", true); if(mach) { Shoot(); } } } public void Move() { if ((Mathf.Abs(joystick_move.Horizontal) > 0.1f || (Mathf.Abs(joystick_move.Vertical) > 0.1f))) { anim.SetBool("Walk_mach", true); if (!audio.isPlaying) { audio.PlayOneShot(stepsSound); } moveInput = new Vector2(joystick_move.Horizontal, joystick_move.Vertical); moveVelocity = moveInput.normalized speed; rb.MovePosition(rb.position + moveVelocity Time.deltaTime); } else if ((Mathf.Abs(joystick_move.Horizontal) < 0.1f || (Mathf.Abs(joystick_move.Vertical) < 0.1f))) { anim.SetBool("Walk_mach", false); } if (Mathf.Abs(joystick_attack.Vertical) > 0.1f || Mathf.Abs(joystick_attack.Horizontal) > 0.1f) { rotZ = Mathf.Atan2(joystick_attack.Vertical, joystick_attack.Horizontal) * Mathf.Rad2Deg; transform.rotation = Quaternion.Euler(0f, 0f, rotZ + offset); } }