Overview
LiGScannerKit provides the ability to scan LigTag and obtain 6DoF data based on the optical tag coordinate system.
LiGPlayerKit provides easy AR rendering, the AR scene data is the scene built by LiG Cloud Site and Light Space App.
Swift Package Manager
LiGScannerKit: https://gitlab.com/lig-corp/ios-scanner-sdk-sample (3.2.0)
LiGPlayerKit: https://gitlab.com/ligrd/ios-player-sdk (1.2.1)
LiGPlayerKit is using GLB as primary model file. So we need to import a GLTF lib to load.
(Optional): https://github.com/magicien/GLTFSceneKit (0.4.1)
Info.plist
- Get Camera access
- Privacy – Camera Usage Description
- Get Network status access
- NSAppTransportSecurity
- NSAllowsArbitraryLoads
- NSAppTransportSecurity
LightScanner 初始化
#import LiGScannerKit
Add didFinishLaunchingWithOptions inside the AppDelegate.
let productkey = “…..”
LiGScanner.sharedInstance().initialize(productkey)
Set Delegate
#import LiGScannerKit
extension ViewController: LiGScannerDelegate {
func scannerStatus(_ status: ScannerStatus) {}
func scannerResult(_ ids: [LightID]) {}
}
Scanner Status: LightIDStatus
- .authenticationOk
- .noCameraPermission
- .noNetworkPermission
- …
LightID: LigTag model
含有以下屬性
- deviceID: Unique Number
- status: LightIDStatus
- coordinateX, coordinateY: Percentage of X/Y in screen coordinate system (0..1)
- isDetected: True will be returned when the deviceID is successfully recognized.
- isReady: In the isDetected state, the 6DoF data will be returned True when it reaches a certain level of accuracy.
- position: The coordinate of this device on the coordinate system of LigTag
- rotation: The Rotation Vector of LigTag on the coordinate system of the device lens.
- translation: Translation Vector (displacement) of LigTag in the coordinate system of the device lens.
- transform: Transform Matrix from Lens to LigTag’s coordinate.
Start Scanning
LiGScanner.sharedInstance.start()
Stop Scanning
LiGScanner.sharedInstance.stop()
Preparation of LiGPlayer
let context = LiGPlayer.sharedContext
context.sceneView = sceneView
context.config = config
context.delegate = self
context.gestureDelegate = self
context.run()