Developer Guide

Rotating and Translating a 3D model with CraftAR Augmented Reality SDK

icon Date Developer Guide

icon Date Jul 23, 2019

icon author Catchoom Team

icon folder , , , , ,

This article applies only to the Augmented Reality SDK.

There are certain applications, such as interactive catalogs where the user is interested in viewing a 3D model from a different angle or even, you want to animate the model such that it spins continuously. Such interaction can be implemented by programmatically rotating and translating the 3D model.

The Augmented Reality SDK lets you render 3D models into the AR scene. This article explains how to change the viewpoint of a 3D model at run-time with a few lines of code on iOS and on Android.

In the example of this article, we added a slider in our layout. When the user slides, the 3D model is rotated.

Below are two screenshots of a 3D model with different values of the slider.

Rotate the model on Android

In order to modify the content’s rotation, we need to implement the Slider’s OnSeekBarChangeListener and modify our content’s rotation matrix:

Rotate the model on iOS

In order to modify the content’s rotation, we need to connect the slider to an IBAction method and update the content’s rotation as follows:

Related Posts in Developer Guide