best way to write physics,detection in games

best way to write physics,detection in games

especially games that can wallrun, slide along edges, one that especially do not cause clip in or  fallthrough floors,

and maybe efficient byte sizes? maybe like this...

https://www.youtube.com/watch?v=xwcM_7yMygc

 

or this, where it detects wall without facing it.

https://www.youtube.com/watch?v=X3bxZnvQ1AE

 

help?