How to completely fit an AR ViewRenderable on target image?
By default, 250dp equals to 1 meters, but you can change it by ViewRenderable.builder().setSizer(DpToMetersViewSizer(you_size))
you have to calculate the scale by the image size and AR core estimated size, so add these code like
// in this example, the image is 100 cm x 66 cm
val imageWidth = 1f // = 1m
val imageHeight = 0.66 // = 66 cm
val scaledWidth = imageWidth / image.extentX
val scaledHeight = imageHeight / image.extentZ
// scale the Node
node.localScale = Vector3(scaledWidth, scaledHeight, scaledWidth)
// also, my view_wall.xml is 250dp x 166dp and the VerticalAlignment is center, like
val wall = ViewRenderable.builder().setView(this, R.layout.view_wall)
.setVerticalAlignment(ViewRenderable.VerticalAlignment.CENTER)
.build()
It works for me, help it works for you.
by the way this is my practice project https://github.com/swarmnyc/arcore-augmented-image-swarm