Official Content

Augmented Reality (AR) is an enhanced version of reality where live views of physical real-world environments are augmented with superimposed computer-generated images over a user's view of the real-world, thus enhancing the current perception of reality.

Scenario

Show a 3D model of some object and how it would fit to a place (augment the given reality).

To cover this scenario, the following API is available in GeneXus:

ARPreview external object


IsAvailable property

Type Boolean
Description Indicates if the device supports the 3D models


PreviewObject method

Description Displays the 3D Model
Parameters 3D object: URL domain
Returns None

The file URL can be a local URL (i.e. offline applications), or a remote (http/https) URL. When using remote URLs, the content is downloaded before displaying it.


Supported formats of 3D object

Apple USDZ
Android 3D assets files (glTF), Sceneform binary assets (SFB)

These file formats group all the information needed to represent a 3D model. There are several sites with models available to download, for example, AR Quick Look Gallery or https://poly.google.com/

Sample Code

Event '3D'
   &URL3D = !"https://developer.apple.com/augmented-reality/quick-look/models/wateringcan/wateringcan.usdz"
   if ARPreview.IsAvailable // Check if device supports 3D models
      ARPreview.PreviewObject(&URL3D) // Display the 3D model of the URL
   else
      msg("Your device doesn't support Augmented Reality")
   endif
Endevent

Showtime!

ezgif_com-video-to-gif_gif

Availability

This property is available since GeneXus 16 upgrade 9.

Considerations

For Apple, not all 3D models are suitable for this. If a message like "Preview Universal Scene Description (Mobile)" appears in runtime, refer to Adding visual effects in AR Quick look.

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant