# Resonai / Vera SDK

[![NPM Package][npm]][npm-url]
[![NPM Downloads][npm-downloads]][npmtrends-url]

#### Vera SDK library

This SDK allows creation of AR experiences based on JavaScript to run in Vera by Resonai.

### Usage

This code requests `appConfig` and `querySemanticObjects` to get details about
semantic objects currently is use.
Then it creates a scene and a gltf mesh based on the queried data, and it adds
the mesh to the scene.

```javascript
import { veraApi } from '@resonai/vera-sdk'

veraApi.loaded()

const sceneID = 'helloWorldScene'

const appConfig = await veraApi.getAppConfig()
const place = appConfig.Place
const gltf = appConfig['Model URL']

const semanticObjectsDict = await veraApi.querySemanticObjects({
  confKey: appConfig._id,
  fields: ['id,type,name,key,argeometry{center_x,center_y,center_z}']
})
const semanticObject = semanticObjectsDict[place.key]
const geometry = semanticObject['ar:geometry']
const position = [geometry.center_x, geometry.center_y, geometry.center_z]
const meshObj = {
  sceneID,
  id: place._id,
  position,
  gltf
}

await veraApi.initScene({ sceneID })
await veraApi.mesh(meshObj)

```

Additional samples are available at https://github.com/resonai/com.resonai.hello-vera-js

### Change log

N/A


[npm]: https://img.shields.io/npm/v/@resonai/vera-sdk
[npm-url]: https://www.npmjs.com/package/@resonai/vera-sdk
[npm-downloads]: https://img.shields.io/npm/dw/@resonai/vera-sdk
[npmtrends-url]: https://www.npmtrends.com/@resonai/vera-sdk