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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

problem with colliders

Discussion in 'Physics' started by EgorGolyb, Feb 25, 2022.

  1. EgorGolyb

    EgorGolyb

    Joined:
    Apr 25, 2021
    Posts:
    10
    Hello, I have a problem. My character ignores all colliders except the floor. I have already tried all the options: rigidbody, all types of colliders, but still nothing works, I just go through the objects. I think the problem is the way I move. Please tell me how to fix the problem if the problem is not in the way of movement. (Translated with the help of a translator, there may be errors)

    Code (CSharp):
    1. Hor = Input.GetAxis("Horizontal") * Time.deltaTime * speed;
    2. Ver = Input.GetAxis("Vertical") * Time.deltaTime * speed;
    3. transform.Translate(new Vector3(Hor, 0, Ver));
     
  2. EgorGolyb

    EgorGolyb

    Joined:
    Apr 25, 2021
    Posts:
    10
     
  3. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,620
    You're bypassing physics and modifying the Transform. The whole point of a Rigidbody is to write to the Transform for you so use its API to cause movements.

    If you don't know how to do this then just go look at one of the thousands of tutorials out there showing you how.