Yup, exactly, little mechanosensors in the muscle spindle measure how much your muscles have stretched and report it to the nervous system, increasing frequency of firing with intensity of muscle stretch.
By some feat of neural computation, your parietal lobes use this somatosensory information (along with other information from your different sensory systems, such as your vestibular system, which detects the motion of fluid in your brain and your head's orientation with respect to gravity) to put together a picture of your body's configuration in space. Of course, having seen 3D space with your eyes your whole life and having echo-located on sounds with your ears (assuming you have functioning eyes and ears), there's probably a lot of extra help from an informed imagination.