ok so I know the problem when I try to clamp it I never reach a clamping range I am looking to clamp it transform on the Z axis the code I have now is this, this is everything I have dealing with this function
I want it to only move 10 degrees either way . Not sure how to add the clamp properly any direction on info would be helpful.
private Transform myTransform;
private Rigidbody rb;
private float rollInput;
void Update
{
rollInput = Input.GetAxis("Horizontal");
}
void FixedUpdate()
{
if (Input.GetAxis("Horizontal") != 0)
{
Roll(rollInput);
}
}
void Roll(float rollInput)
{
Mathf.Clamp(myTransform.rotation.z, 10, -10);
rb.AddRelativeTorque(new Vector3(0, 0, 1 * -rollInput));
Debug.Log(myTransform.rotation.z);
}