Detecting collisions with raycast or not?

Good afternoon, all right? I have a question about collisions: I have the player and I want to cushion the collisions with walls and other objects, but do not know how best … If I using raycast or collision functions even, because I tried to use raycast to detect and it detects only what is really centered on the front of the player and raycast line, that is, what is a little right raycast line will not be detected, even standing in front of the player. How should I do to improve it?

Thank you!

The way how the raycast works is that it casts a very narrow ray in a specified direction so it cannot properly track is something really is in front of your object. I think
this

could be what you are looking for.