Model is rendering big then device size
The model I am rendering is big in size and appearing bigger then device screen when rendering, if I set value for max scale then we can handle the height of the model but it is creating problem for other small models, not allowing them to scale "zooming" properly means restricting. Can you please guide some common solution that will handle all size models.
It's probably best for your models to be adjusted to a world scale. That way if someone wants to modify them, the changes can be done to the model file and hopefully none of the code or UX needs to be changed.
But if you want to do something like auto-scaling a model, you could try something like this:
Box boundingBox = (Box) renderable.getCollisionShape();
if (boundingBox != null) {
Vector3 boundingBoxSize = boundingBox.getSize();
float maxExtent = Math.max(boundingBoxSize.x, Math.max(boundingBoxSize.y, boundingBoxSize.z));
float targetSize = 0.2f; // Whatever size you want.
float scale = targetSize / maxExtent;
node.setLocalScale(Vector3.one().scaled(scale));
}
This will scale the renderable such that the largest extent on the bounding box will be equal to targetSize.
See also: https://github.com/google-ar/sceneform-android-sdk/issues/108 and let us know if this helps
Additionally, a scale value is present in the .sfa file of your model. https://developers.google.com/ar/develop/java/sceneform/sfa
Thank you, I will try this and update.
Any luck with this?
Closing due to inactivity.