how to stop a player moving thought the walls in a 2d game

ım trying to make tank move in 2d plane . the tanks move on the x and z axis . the y axis is not used because its 2d. ı want the player object to move forward and rotate with horizontal keys . ı know many ways of doing this but the thing is ı don’t want the object to go thought the other objects. rigidbody.moveposition stops them going thought but the player object moves in global position. ı just want it to move the direction of the rotation.

Use rigidbody.velocity. Please look at the FAQ. There’s also a 3 on how to use this site…