Skip to main content

Bowling

Bowling

setMode(.gesture) · shotTriggered, throwPower, sensors

Bowling is a 3D lane (SceneKit on iPhone) with ten pins. You roll with the same pull-back → throw gesture as Dart; the ball starts from the center of the lane (no left/right aim with Triki tilt).

How you play

  1. Connect + calibrate in the sample app.
  2. Open Bowling — lobby is touch-only (1–20 players, nicknames); Triki starts on the lane after GRAJ. Optional TV scoreboard.
  3. Pull back on the cap, then throw forward to roll (one roll per successful gesture).
  4. throwPower (0…1) sets ball speed; spin comes from release dynamics in BowlingGameScene.
  5. Standard 10 frames, two throws per frame (strike/spare logic in BowlingGameLogic).
  6. Multiplayer: press the cap button when the HUD says Triki = start for your turn.
  7. Short setup countdown and invisible calibration run at the start of a frame — stand still when asked.

HUD phases: Gotowy · TrikiCOFNIJ rękęRzuć! → ball rolling → pixel celebration (strike / spare / pin count) → party scoreboard between turns.

VeltoKit mapping

SettingValue
MotionMode.gesture
AimFixed center (lateralPosX = 0) — no Triki tilt steering
ThrowGesture via BowlingInputHandlerThrowEvent(power, …)
Turn startsensors.click (physical button only in sample)
SDK fieldsshotTriggered, throwPower when using raw gesture output

Bowling disables reference drift and uses slightly lower pointer sensitivity than Dart (GameManager.applyMotionMode).

Integrate in your app

let motion = MotionSDK()
motion.setMode(.gesture)
motion.connect()

func tick(dt: TimeInterval) {
let input = motion.pollInput(deltaTime: dt)

if input.shotTriggered {
rollBall(power: input.throwPower) // center lane in sample
}
}

The sample routes throws through BowlingInputHandler + DartThrowController for consistent throw feel. Copy that handler if you want matching UX.

Sample app source

FileRole
app/Games/BowlingGame.swiftRound phases, scoring, SceneKit bridge
app/Games/Bowling/BowlingInputHandler.swiftThrow FSM (no lateral aim)
app/Games/Bowling/BowlingGameLogic.swiftFrames, players, pins
app/Games/Bowling/BowlingGameScene.swift3D lane, ball, pins
app/Games/Bowling/BowlingInvisibleCalibrator.swiftAuto neutral during setup

Display: Full lane on phone; TV mirror optional from lobby.

Tips

  • Stand still during the invisible calibration window before each throw.
  • Read Gestures for BACK → FORWARD timing shared with Dart.

← Dart · Quiz → · Configuration · Getting started