Mathf Clamp not working?

Im not getting a bug or error message, but the mathf clamp is not holding my object between the designated area:

    void Update ()
    {
    Vector3 Paddle = new Vector3 (0.5f,this.transform.position.y, this.transform.position.z);
    transform.Translate (paddleSpeed * Time.deltaTime * Input.GetAxis ("Horizontal"), 0, 0);
    Paddle.x = Mathf.Clamp(Paddle.x, -7.75f, 7.75f);        
    }

All math functions work 100% of the time. If you ever see something “not working” it’s because of a bug in your code somewhere. In this case you’re clamping Paddle.x (but please use lowercase for variable names), and it does of course work, but since you’re not using Paddle for anything, it will have no noticeable effect on anything else.

–Eric

3 Likes