Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

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


    Jan 12, 2021
    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()
    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


    Jan 25, 2010
    transform.rotarion near the bottom.