Fast Player walking trough walls

I belive the problem is or speed It reches(I hope not, I need It to be fast) or I’m using the wrong form of movement, rigi bodies and coliders where placed

the code looks like this:

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

public class CarMovement : MonoBehaviour
{
    public Rigidbody rb;
    public Transform car;
    public float speed = 0f;
    public float TimePassing = 0f;
    public float CurrentAngle = 0f;
    public float CurrentAceleration = 1f;
    public float universalaceleration = 5;


    Vector3 rotationRight = new Vector3(0, 80, 0);
    Vector3 rotationLeft = new Vector3(0, -80, 0);

    Vector3 forward = new Vector3(0, 0, 1);
    Vector3 backward = new Vector3(0, 0, -1);

    private void Start()
    {
    
    }

    void FixedUpdate()
    {
        TimePassing += Time.deltaTime;
        if (Input.GetKey("w"))
        {
            transform.Translate(forward * speed * Time.deltaTime);
            acceleration2();
        }
        else if (Input.GetKey("s"))
        {
            transform.Translate(forward * speed * Time.deltaTime);
            deacceleration2();
        }
        
        else
        {
            if (speed > 0)
            {
                deacceleration1();
                transform.Translate(forward * speed * Time.deltaTime);
            }
            else if (speed < 0)
            {
                acceleration1();
                transform.Translate(forward * speed * Time.deltaTime);
            }
            else if (speed == 0)
            {

            }

        }

        if (Input.GetKey("d"))
        {
            Quaternion deltaRotationRight = Quaternion.Euler(rotationRight * Time.deltaTime);
            rb.MoveRotation(rb.rotation * deltaRotationRight);
        }

        if (Input.GetKey("a"))
        {
            Quaternion deltaRotationLeft = Quaternion.Euler(rotationLeft * Time.deltaTime);
            rb.MoveRotation(rb.rotation * deltaRotationLeft);
        }

        RotationControl();

        if (Input.GetKey("space"))
        {

        }
    }

    void acceleration1()
    {
        if (TimePassing >= 1)
        {
            speed += 2/CurrentAceleration;
            TimePassing = 0;
        }
    }

    void deacceleration1()
    {
        if (TimePassing >= 1)
        {
            speed -= 2/CurrentAceleration;
            TimePassing = 0;
        }
    }
    void acceleration2()
    {
        if (TimePassing >= 1)
        {
            speed += CurrentAceleration;
            TimePassing = 0;
        }
        aceleratting();
    }

    void deacceleration2()
    {
        if (TimePassing >= 1)
        {
            speed -= CurrentAceleration;
            TimePassing = 0;
        }
        aceleratting();
    }
    void RotationControl()
    {
        if ((speed >= 30 && !Input.GetKey("s")) || (speed < -30 && !Input.GetKey("w")))
        {
            rotationRight.y = 30;
            rotationLeft.y = -30;
            CurrentAngle = 30;
        }
        else
        {
            rotationRight.y = 80;
            rotationLeft.y = -80;
            CurrentAngle = 80;
        }
    }

    void aceleratting()
        {
            if (speed > 30)
            {
                CurrentAceleration = universalaceleration / (speed - 30f);
            }
            else if (speed < -30)
            {
                CurrentAceleration = universalaceleration / (speed + 30f);
            }
            else
            {
                CurrentAceleration = universalaceleration;
            }
            if (speed < 1 && speed > -1)
        {
            speed = 0;
        }
        }
    }

This is it:

  • Modifying the transform position/rotation (or using Translate/Rotate) means teleporting the object to a new location or pose, bypassing any physics considerations.
  • Using MovePosition / MoveRotation means forcefully translating / rotating that object physics-wise, so the physics action will be performed on those objects, regardless collisions or frictions.

The correct way to physically move objects while colliding properly is using Rigidbody.AddForce/AddTorque from FixedUpdate.