So I made a little 2d scene with the player and 4 walls but when ever I go to the wall i just go through it. I have Box Colliders, Mesh Colliders, and RigidBodys on all of my walls and Sphere Colliders, Mesh Colliders, and RigidBodys on my player as well. My Current Script is below . Im pretty sure that im not supposed to use “transform.position” because it doesnt look for collisons butIi dont know what to use then, and I’m not sure what setting the Box/Sphere Colliders, Mesh Colliders, and Rigid Bodys need to have.
Set the player object’s Rigidbody type to dynamic, make sure the mesh collider on the player is set to convex, and use Rigidbody.MovePosition(Vector3) to set your new position each Update instead of setting the transform.position manually.
Rigidbodies on moving objects have to be dynamic if you want other colliders to prevent the rigidbody from moving through them. This is because the blocking is done by waiting for two colliders to overlap, then pushing the colliders away from each other. Kinematic and static rigidbodies can’t be pushed (i.e. be blocked by objects), they can only push other other objects away (they can only block other objects).
Try to add the Component ChracterController. and use ChracterController.Move(Vector3).