I want to limits angles in the Mouse Y
Ex:
public float limitangle = 40;
I don’t know how…
I want to limits angles in the Mouse Y
Ex:
public float limitangle = 40;
I don’t know how…
Hard to say because you’re not providing much information. But one way to limit a value is by using Mathf.Clamp which will “clamp” an input value between two others. If the input value is lower than the minimum then it will be forced to the minimum. Likewise if it’s greater than the maximum then it will be forced to the maximum.
float a = Mathf.Clamp(100.0f, 40.0f, 140.0f); // a will be 100 since it fits within the range.
float b = Mathf.Clamp(20.0f, 40.0f, 140.0f); // b will be 40 because that's the minimum
float c = Mathf.Clamp(200.0f, 40.0f, 140.0f); // c will be 140 because that's the maximum.
Hope that helps, otherwise you’ll need to be much more specific about what you’re looking for.
I have:
float moveRotateY = Input.GetAxis ("Mouse Y") * rotateSpeed * Time.deltaTime;
transform.Rotate (0, moveRotateY, 0);
I want put a limit to rotation in the camera.