afaik there’s no basic collision detection for 2D, and the one that is currently work for 3D will be removed in the future in favor of kraft physics engine, which is already integrated in CGE.
You maybe able to do this with kraft physics engine (just maybe, because I haven’t used kraft, but have experience with other 2D physics engines). Create some MeshColliders as walls and wrap your character around a BoxCollider, and make sure to lock your character’s rotation so that it won’t rotate when hitting walls. Note that you will have to manipulate your character’s position via kraft, by applying force to RigidBody instead of using TCastleTransform directly.
You can take a look at physics_2d_game_sopwith demo in examples directory to understand how to setup physics in CGE.
If you dont want to do it “the physics way” then you will have to implement 2D collision detection yourself