Skip to main content

MotionSDK API

@MainActor facade — call every frame from your game loop.

let motion = MotionSDK()
motion.setMode(.paddle)

motion.connect() // BLE scan + auto-connect

let input = motion.pollInput(deltaTime: dt) // GameInput each frame
APIRole
connect()Start BLE scan; auto-connect when one likely controller is found
disconnect()Drop BLE session
pollInput(deltaTime:)Parse packets + updateFrameGameInput
isConnected / isReceivingLink + live packet stream
liveInputThrottled copy for SwiftUI HUD

Requires Bluetooth usage strings in Info.plist. See BLE integration.

Manual bytes (your own BLE)

motion.enqueueBLE(bytes) // your notify callback
motion.updateFrame(deltaTime: dt)
let input = motion.input

Legacy: motion.update(rawX:bytes:deltaTime:).

Mode

motion.setMode(.gesture)
motion.config = MotionConfig.preset(for: .gesture)

Calibration

motion.calibrateNeutralPose() // connect + pollInput path
motion.resetPaddleCenter()
motion.flipPaddleOffsetSign()

// Low-level (same engine):
motion.engine.calibrateCenter()
motion.engine.resetPaddleMotion()

Ingress

MethodWhen
enqueueBLE(_:)Raw notify payload
ingestTrikiFrame(gyroX:gyroY:gyroZ:rotation:)Already parsed floats

See GameInput · BLE