Skip to main content

GameInput

GameInput is the only type sample games use in update(input:deltaTime:). Populate it via MotionSDK.input or TrikiInputAdapter.pollInput().

Primary game fields

FieldTypeTypical use
posXDoublePaddle / aim horizontal 0…1 (center ≈ 0.5)
posYDoubleVertical aim (pointer mode)
primaryActionBoolBLE click or gesture shot this frame
shotTriggeredBoolGesture throw edge (Dart/Bowling)
throwPowerDouble0…1 strength when shotTriggered
gesturePrimedBoolPull-back before throw (UI hint)
pointerDirectionPointerDirection.left .right .up .down .center

Convenience

var didShoot: Bool { primaryAction || shotTriggered }
var action: Bool { primaryAction }
var steerX: Double { lateral }

Motion / debug fields

FieldDescription
tiltX, tiltYCalibrated tilt (Platform may enrich)
deltaX, deltaYFrame deltas
lateral, lateralSmoothAdapter copies output.x for HUD
velocityYSmoothed vertical velocity proxy
rotationPointer rotation output
intensityOften output.velocityX

Impulse flags (Platform)

FieldSource
shakeMotionParser impulses
flick, spinReserved / parser
tiltLeft, tiltRightOptional

Sensors bundle

sensors: TrikiSensors — raw-ish telemetry for HUD (tilt, gyro, click flag). Filled by Platform MotionParser, not core VeltoKit.

Example: Pong

func update(input: GameInput, deltaTime: TimeInterval) {
paddle.center.x = CGFloat(input.posX) * courtWidth
}

Example: Dart

if input.gesturePrimed {
showPullBackHint()
}
if input.shotTriggered {
launch(power: input.throwPower)
}

Example: Quiz

highlightAnswer(at: input.posX)
if input.primaryAction {
confirmSelection()
}

MotionSDK · Gestures