Skip to main content

iOS SceneKit SDK

Integration Background

This document describes the use of the Vyking Foot View (VykFootView) on iOS devices only. The VykFootView has been designed to vastly simplify the task of integration Vyking’s Foot Tracking technology into a iOS app using Apple’s native SceneKit graphics engine.

The VykFootView can be used as a drop in view using the Xcode storyboard layout scheme or it can be used programmatically.

The VykFootView offers many new facilities including using an external camera feed, currently assumed to be the ARKit camera. The Underlying Vyking Tracking SDK can use either the ARKit Camera (as an external camnera) or access and manage the camera assess itself (within the SDK).

New functions have been added to provide for a high resolution image and video capture of the scene with the shoe models.

Frameworks

The VykFootView is delivered as an xcframework.

Interface Methods

The following methods are presented using swift

Create Instance

In iOS, VykFootView is a subclass of SCNView

VykFootView(frame: CGRect, options: [String : Any]? = nil) 
NameDescription
framerectangle for the view, measured in points and specified in the coordinate system of its superview
optionsrendering options for the view, see SCNView

setupFootTracker

public func setupFootTracker( initConfig : [String : Any], accessConfig : [String : Any], delegate : vkFootViewDelegate ) -> Bool

initConfig is a dictionary passed through to the foot tracker. An example of an init configuration is:

[
// path to the location of the vykingfile
"baseDir" : Bundle.main.bundlePath + "/Data/Raw/Vyking",
// the actual name of the vyking lzma file
"vykingFile": "VykingData.lzma"
]

accessConfig is a dictionary of the form:

static let vykingTrackerAccessConfig: VykingTrackerConfig = [
"facing" : false, // rear facing camera logic
"arKit" : false,
"arKitExternalCamera" : false, // use external camera frames
"tracker" : "foot", // enable the foot tracker
"config" : [ // the upscale texture for the occluder masks
"textureScale": [
"width": 540,
"height": 960,
"widthAv": 7,
"heightAv": 7,
"fusionFactor": 0.35
]
]
]

delegate is the delegate for vkFootViewDelegate

public protocol vkFootViewDelegate {
// Called when the SDK is ready to track feet
func vkReady(good: Bool) -> Void

// Called when the vkFootView has completed a shutdown operation
func vkShutdown(good: Bool) -> Void

// An indication that a foot asset has been loaded
func vkLoadShoeAssetResponse(urlString: String, assetsPath: String?, good: Bool, message: String?)
}

startFootTracking

This method causes the foot tracking to start operating

public func startFootTracking() 

pauseFootTracking

This method causes the foot tracking to pause

public func pauseFootTracking() 

destroyFootTracking

This should be called before the view is disposed

public func destroyFootTracking() 

MTLStreamStartRecording

This method will start the screen recording

@objc public func MTLStreamStartRecording( videoOutputURLWithPath: URL, videoSettings: [String : Any]? ) 

Where videoSettings have the meaning as defined by AVAssetWriterInput and videoOutputURLWithPath is a fileURL where the video is stored.

MTLStreamStopRecording

This method will stop the screen recording

@objc public func MTLStreamStopRecording( saveVideo: @escaping ( videoURL: URL ) -> Void )

loadShoeAsset

This method will load a new shoe asset. When complete the protocol call back vkLoadShoeAssetResponse is called to report the state of the loading operation.

public func loadShoeAsset( urlString: String? ) 

A typical urlString would be the offsets.json URL that denotes a particular pair of shoes for example:

https://vyking.io/assets/test_shoe_asset/offsets.json

highResSnapShotWithClosure

Take a high resolution VykFootView snapshot. This method allows the caller to specify the resolution (width and height) of the desired image (UIImage). The image is sent back via the closure function. The function returns true if the request for the high resolution image was accepted.

public func highResSnapShotWithClosure( width: Int, height: Int, action: @escaping (UIImage?) -> Void ) -> Bool

setShoeDebugMode

Method to turn on extra shoe model debug information

public func setShoeDebugMode( enableDebug: Bool ) 

This function enabled the user to enable/disable the NSLog output of the show models.

getFeetAvailabilityCounts

Method to determine if feet are being tracked. This method allows the caller the get the number of frames since the last call which had no feet, one foot or two feet. This function allows the calling process to determine if the user should receive a hint on how to use the foot tracker. The implementation of the hint is left to the application designers. Typically the app would present a temporary view to be placed above the VykFootView.

public func getFeetAvailabilityCounts( noFeet: inout Int, oneFoot: inout Int, twoFeet: inout Int ) 

getSDKexpiry

Method to determine when SDK will expire. This method allows the caller to get the expiry date of the SDK. This method can be called any time after the SDK has been initialised.

public func getSDKexpiry() -> NSDate?