Bowling
Bowling
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
- Connect + calibrate in the sample app.
- Open Bowling — lobby is touch-only (1–20 players, nicknames); Triki starts on the lane after GRAJ. Optional TV scoreboard.
- Pull back on the cap, then throw forward to roll (one roll per successful gesture).
throwPower(0…1) sets ball speed; spin comes from release dynamics inBowlingGameScene.- Standard 10 frames, two throws per frame (strike/spare logic in
BowlingGameLogic). - Multiplayer: press the cap button when the HUD says Triki = start for your turn.
- Short setup countdown and invisible calibration run at the start of a frame — stand still when asked.
HUD phases: Gotowy · Triki → COFNIJ rękę → Rzuć! → ball rolling → pixel celebration (strike / spare / pin count) → party scoreboard between turns.
VeltoKit mapping
| Setting | Value |
|---|---|
MotionMode | .gesture |
| Aim | Fixed center (lateralPosX = 0) — no Triki tilt steering |
| Throw | Gesture via BowlingInputHandler → ThrowEvent(power, …) |
| Turn start | sensors.click (physical button only in sample) |
| SDK fields | shotTriggered, 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
| File | Role |
|---|---|
app/Games/BowlingGame.swift | Round phases, scoring, SceneKit bridge |
app/Games/Bowling/BowlingInputHandler.swift | Throw FSM (no lateral aim) |
app/Games/Bowling/BowlingGameLogic.swift | Frames, players, pins |
app/Games/Bowling/BowlingGameScene.swift | 3D lane, ball, pins |
app/Games/Bowling/BowlingInvisibleCalibrator.swift | Auto 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.