Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

help pls it says that im missing ";" and "}" pls help it crashes every time i write this code

Discussion in 'Documentation' started by yousefbaddor136, Jan 13, 2021.

  1. yousefbaddor136

    yousefbaddor136

    Joined:
    Jan 12, 2021
    Posts:
    1
    using UnityEngine
    public class something : MonoBehaviour
    {
    public Transform camera;
    public Rigidbody rb;
    public float cameraRotationSpeed = 5f;
    public float cameraMinimumY = -60f;
    public float cameraMaximumY = 75f;
    public float rotationSmoothSpeed = 10f;
    public float walkSpeed = 9f;
    public float runSpeed = 14f;
    public float maxSpeed = 20f;
    public float jumpPower = 30f;
    public float extraGravity = 45f;
    float bodyRotationX;
    float camRotationY;
    Vector3 directionIntentX;
    Vector3 directionIntentY;
    float speed;
    public bool grounded;
    void Update()
    {
    LookRotation();
    }
    void LookRotation()
    {
    Cursor.visible = false;
    cursor.LockState = CursorLockMode.Locked;
    //Get camera and body rotational vaslues
    bodyRotationX += Input.GetAxis("Mouse X") * cameraRotationSpeed;
    camRotationY += Input.GetAxis("Mouse Y") * cameraRotationSpeed;
    //Stoping our Camera from rotating 360 degrees
    camRotationY = Mathf.ClampcamRotationY, cameraMinimum);
    //creat rotation targets and handle rotations of the body and camera
    Quaternion camTargetRotation = Quaternion.Euler(-camRotationY, 0, 0);
    Quaternion bodyTargetRotation = Quaternion.Euler(0, bodyRotationX, 0);
    //handle rotations
    transform.rotarion = Quaternion.Lerp(transform.rotation, bodyTargetRotation, Time.deltaTime * rotationSmoothSpeed);
    camera.localRotation = Quaternion.Lerp(camera.localRotation, camTargetRotation, Time.deltaTime * rotationSmoothSpeed);
    }
    }
     
  2. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,701
    transform.rotarion near the bottom.