I am making a snowboarding style game, the character is a rigidbody with a constant z movement, the turns are controlled by tranform.rotation. I am trying to clamp the rotation so the character can not turn more than 90 deg in either direction (effectively back up the hill..) I am using Mathf.Clamp but it isn't working and I can not get my sleep deprived head around it :s Would anyone be so kind as to help me out :) this is my code:
var maxClamp : float = 90;
var minClamp : float = -90;
var myTurn = Input.GetAxis("Horizontal")*Time.deltaTime* turnSpeed;
myTurn = Mathf.Clamp(myTurn, minClamp, maxClamp);
var myStrafe = Input.GetAxis("Horizontal")*Time.deltaTime*strafeSpeed;
myStrafe = Mathf.Clamp(myStrafe, minClamp, maxClamp);
thankyou :)