mathf.clamp unity
//stops "value" from getting smaller than xMin and bigger than xMax.
float value = Mathf.Clamp(value, min, max);
mathf.clamp unity
//stops "value" from getting smaller than xMin and bigger than xMax.
float value = Mathf.Clamp(value, min, max);
unity clamp rotation
float rotationX = 0;
float rotationY = 0;
// you might also have some rotation speed variable
void Update() {
rotationX += Input.GetAxis("Vertical") * Time.deltaTime;
rotationX = Mathf.Clamp(rotationX, minRotationX, maxRotationX);
rotationY += Input.GetAxis("Horizontal" * Time.deltaTime;
transform.rotation = Quaternion.Euler(rotationX, rotationY, 0);
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us