How to create virtual line (arCore) that slides to the direction of camera movement in Android studio?

I am new to the android studio. I want to make an app that uses ArCore. I want to measure the dimension of any object. On finding the base of the object, I want to create a virtual line that will be sliding towards the camera movement. Is there a way to do that? I would be grateful if you provide a code snippet.