Make character not move through walls and other objects

My character/Player[polyman] is passing through walls and other objects ,my player had attached with character controller ,rigidbody Is kinematic in inspector.Below is my Player’s script. What i done wrong in script ,Can i add anything in script? .I added colliders to all obstacles including player.I took some screenshots in my inspector.
pls answer anyone!!!@rage_co

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
  
    
    //VARIABLES
    [SerializeField] private float moveSpeed;
    [SerializeField] private float walkSpeed;
    [SerializeField] private float runSpeed;

    
    private Vector3 moveDirection;
    private Vector3 velocity;
   
    [SerializeField] private bool isGrounded;
    [SerializeField] private float groundCheckDistance;
    [SerializeField] private LayerMask groundMask;
    [SerializeField] private float gravity;
    [SerializeField] private float jumpHeight;

    //REFERENCES
    private CharacterController controller;
    
    private Animator anim;

    private void Start()
    {
        
        controller = GetComponent<CharacterController>();
       
        anim = GetComponent<Animator>();
    }

    private void FixedUpdate()
    {
       
        Move();
        

    }

    private void Move()
    {
        
        isGrounded = Physics.CheckSphere(transform.position, groundCheckDistance, groundMask);

        if(isGrounded && velocity.y < 0)
        {
            velocity.y = -2f;
        }
        float moveZ = Input.GetAxis("Vertical");
       
        moveDirection = new Vector3(0, 0, moveZ);
        moveDirection = transform.TransformDirection(moveDirection);
        
        if (isGrounded)
        {
            if (moveDirection != Vector3.zero && !Input.GetKey(KeyCode.LeftShift))
            {
                Walk();
            }
            else if (moveDirection != Vector3.zero && Input.GetKey(KeyCode.LeftShift))
            {
                Run();
            }
            else if (moveDirection == Vector3.zero)
            {
                Idle();
            }
            moveDirection *= moveSpeed;

            if (Input.GetKeyDown(KeyCode.Space))
            {
                Jump();
            }

        }

       


        controller.Move(moveDirection * Time.deltaTime);

        velocity.y += gravity * Time.deltaTime;
        controller.Move(velocity * Time.deltaTime);
    }

    private void Idle()
    {
        anim.SetFloat("Speed", 0, 0.1f, Time.deltaTime);
    }
    
    private void Walk()
    {
        moveSpeed = walkSpeed;
        anim.SetFloat("Speed", 0.5f, 0.1f, Time.deltaTime);
        

    }

    private void Run()
    {
        moveSpeed = runSpeed;
        anim.SetFloat("Speed", 1,0.1f,Time.deltaTime);
    }

    private void Jump()
    {
        velocity.y = Mathf.Sqrt(jumpHeight * -2 * gravity);
    }
}

Firstly, do u have a charactercontroller and a rigidbody on one object? Secondly do u have colliders on everything if it isnt sinking through the floor? Lastly, is the rigidbody’S collider being disabled due to the charactercontroller?

https://docs.unity3d.com/ScriptReference/Rigidbody-isKinematic.html

"If isKinematic is enabled, Forces, collisions or joints will not affect the rigidbody anymore. "

You need to make sure to disable isKinematic (at the right time) if you want collisions with walls to prevent your character from passing through.

You should add RigidBody to your player and make sure isKinematic is unchecked. I think that should work.

sorry…im late cuz i just woke up like an hour ago…now for the problem, why do you have a capsule collider with a character controller? the controller comes with it’s own collider and this just might be the problem…so try removing the capsule collider…also what is the physic material you are using on the colliders (i don’t think it’s the problem , just confirming), also head to the project settings in editor > physics category and check that the collision matrix is properly setup