Was asking because I want to make habitats that you can walk around in
Its just coding and a bit of maths. Astronauts moving around don't go very fast, so it is the 'easy case'.
You can mathematically define a 3D space (a sphere, a box, whatever your habitat looks like). For the astronaut, a 'sphere' should be good enough. Then it is relatively easy to figure when the astronaut is 'outside' the 3D space, 'inside', or is 'colliding with the boundaries'.
A basic collision model isn't that hard. Problems arise when you have objects like spacecraft that can move kilometers during one single second. Because you can check for the collision only once every frame. It is necessary to switch to something like a probablilistic model above a given speed, which is tricky because that speed would depend of the local FPS...
But for astronauts walking on a planet, that's not a problem.