[CLOSED ] can't quite get a clamp to work with my script.

i’m trying a lot of ways to add a Mathf.Clamp to my script but i can’t get it to work the way i want it to.

could anyone tell me the proper way i could add a clamp to this?

here is my script.

var x : float;

var y : float;

var z : float;

function LateUpdate (){

transform.localEulerAngles = new Vector3(x,y,z);

}

i use this for my character’s model so i can control certain parts of the model like the arm.

if anyone could help with this i’ll greatly appreciate it.

thanks

  • Ownerfate

var x : float;

var y : float;
 
var z : float;
 
function LateUpdate (){
 
transform.localEulerAngles = new Vector3(x,y,z);

x = Mathf.Clamp(x, min, max);
y = Mathf.Clamp(x, min, max);
z = Mathf.Clamp(x, min, max);
 
}

check this out!