Hello. I have a minigun which stays on it´s position and i want to rotate it on the x and y axis but somehow the z axis changes aswell. Im trying to solve it for 3 hours now.
void Update()
{
//Shoot if mouse pressed
if(Input.GetButton("Fire1")){
if(currentAmmo>0f){
Shoot();
}
}
float mouseX = Input.GetAxis("Mouse X") * sensi * Time.deltaTime;
float mouseY = Input.GetAxis("Mouse Y") * sensi * Time.deltaTime;
transform.Rotate(new Vector3(0,1,0)*mouseX);
transform.Rotate(new Vector3(1,0,0)*(mouseY*-1));
}
I am grateful for every Help :).