HowTo: Augmented Reality in GeneXus applications

Unofficial Content
This documentation is valid for:

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

iOS      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/arkit/gallery/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