Transform.Rotate question

Hi there, I’m fairly new to Unity, but I’m learning everyday. What I want to do is:

transform.Rotate(Vector3(Input.GetAxis("Mouse Y"), (Input.GetAxis("Mouse X"), 0) * Time.deltaTime * speed);

How could I implement the Space.World on ONLY the X axis, I have tried a few things but I just get errors. Any assistance would be highly appreciated. Thanks!

transform.Rotate(0,(Input.GetAxis("Mouse X"), 0) * Time.deltaTime * speed);
transform.Rotate(Vector3(Input.GetAxis("Mouse Y"), 0, 0) * Time.deltaTime * speed,Space.World);

Thanks, that did the trick, I had to change it around a bit but I didn’t know where to add the space.world part. I was close tho :smile: thanks again!

One more question, if I want to lock the rotation of this from the Z axis I would add transform.rotation.z = 0; Now if I want to lock it from the world’s Z axis, how could I do this?

You wouldn’t, actually…transform.rotation is a quaternion, which has 4 dimensions–x, y, z, w, and z isn’t the z axis. transform.eulerAngles.z is the z axis, but read up in the docs about using that (namely, setting a single element can fail; you want to set all 3 at once usually).

–Eric