Model Transformations
This demonstrates the orientation and
scale attributes which allow the model to be
transformed. Note that if specified before the model loads, they
will be taken into account by the automatic camera framing. If they
are changed afterwards the camera will not move, so to get new
automatic framing the updateFraming() method must be
called.
Note that these changes can be made in AR as well, but only in
WebXR mode, as this is the only mode that remains in the browser.
Changes you made ahead of time will not be reflected in Scene
Viewer, since this app downloads the original model again from its
URL. iOS Quick Look will reflect your changes as long as
ios-src is not specified, since in this case a USDZ
will be generated on the fly from the current state.
Tip: When building custom interactive overlay controls with text or numeric input fields on mobile, ensure your inputs are styled with a CSS rule setting font-size: 16px; (or larger). If a focused text field's computed font size is below 16px, mobile WebKit browsers (like iOS Safari and Chrome) will automatically zoom in the entire viewport, which does not automatically reset when the input is blurred and can break the page layout.
AR Keyboard Overlays: Inside a WebXR full-screen immersive AR session, mobile browsers do not shrink the layout viewport when a software virtual keyboard is open. To prevent inputs from being covered by the keyboard, you can register a visualViewport resize listener (only active when ar-status="session-started") to calculate the soft keyboard's overlay height and dynamically translate your overlay container upward (e.g., via transform: translateY(-offset px);), as demonstrated in the script below.