Assets\PhysicRig.cs(5,39): error CS1513: } expected How do I fix this

I am new to Unity and I got this error message how can I fix it here’s the code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PhysicRig : MonoBehaviour

   public Transform playerHead;
   public CapsuleCollider bodyCollider;
 
   public float bodyHeightMin = o.5f;
   public float bodyHeightMax = 2;
 (
    // Update is called once per frame)
    void FixedUpdate()
    
        bodyCollider.Height=Mathf.Clamp(playerHead.localPosition.y, bodyHeightMin, bodyHeightMax;
        bodyCollider.center=new Vector3(playerHead.localPosition.x, bodyCollider.height/2,
            playerHead.locaPosition.z);
 (

When defining a class you have to remember the curly braces.

public class PhysicRig : MonoBehaviour
{   // <-- Start of the class

    // Everything that belongs to the class goes here

}   // <-- End of the class

Methods (functions) that belong to the class have to be between the curly braces of the class.
Methods have their own curly braces.
You always have to pay good attention to where curly braces start and end.

public class PhysicRig : MonoBehaviour
{   // <-- Start of the class

    void FixedUpdate()
    {   // <-- Start of the method's body

        // Do something in the method here

    }   // <-- End of the method's body

}   // <-- End of the class

Variables that belong to a class are usually added at the beginning of the class:

public class PhysicRig : MonoBehaviour
{   // <-- Start of the class

    // Variables that belong to the class
    public Transform playerHead;
    public CapsuleCollider bodyCollider;

    public float bodyHeightMin = o.5f;
    public float bodyHeightMax = 2;

    void FixedUpdate()
    {   // <-- Start of the method's body

        // (Do something in the method here)

    }   // <-- End of the method's body

}   // <-- End of the class

Disclaimer:
With regards to the class’ variables, I’m keeping this supersimple. When you start talking about good and bad practice it can get pretty complicated (Access Modifiers, Fields, Properties, etc.)

I got a new error message: error CS1022: Type or namespace definition, or end-of-file expected
heres the code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PhysicRig : MonoBehaviour
{ // ← Start of the class

public Transform playerHead;
public CapsuleCollider bodyCollider;

public float bodyHeightMin = o.5f;
public float bodyHeightMax = 2;
(
// Update is called once per frame)
void FixedUpdate()

  // bodyCollider.Height=Mathf.Clamp(playerHead.localPosition.y, bodyHeightMin, bodyHeightMax;
    bodyCollider.center=new Vector3(playerHead.localPosition.x, bodyCollider.height/2,
        playerHead.locaPosition.z);

} // ← End of the method’s body

} // ← End of the class

Reply to your second post:

  1. You accidentally wrote “o.5f” (the letter “o”) instead of “0.5f”.

  2. On the line after public float bodyHeightMax = 2; I see a regular parenthesis ( – Remove the parenthesis.

  3. After void FixedUpdate() you are missing an open curly brace {

  4. When you post code on this forum, please select your whole code and then press the “Preformatted text” button which looks like this: </>
    This simply adds 3 backticks before and after your code which you can add manually if you know how to input backticks.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PhysicRig : MonoBehaviour
{
    public Transform playerHead;
    public CapsuleCollider bodyCollider;

    public float bodyHeightMin = 0.5f;
    public float bodyHeightMax = 2;

    void FixedUpdate()
    {
        // bodyCollider.Height=Mathf.Clamp(playerHead.localPosition.y, bodyHeightMin, bodyHeightMax;
        bodyCollider.center=new Vector3(playerHead.localPosition.x, bodyCollider.height/2, playerHead.locaPosition.z);
    }
}