Skip to main content

Bowling

Bowling

setMode(.gesture) · posX, shotTriggered, throwPower, sensors

Bowling is a 3D lane (SceneKit on iPhone) with ten pins. You aim by leaning left/right, then roll with the same pull-back → throw gesture as Dart, mapped to ball speed and spin.

How you play

  1. Connect + calibrate in the sample app.
  2. Open Bowling — lobby supports player names, frames, optional TV.
  3. Between throws, tilt to move the ball left/right on the lane.
  4. Pull back on the cap, then throw forward to roll (one roll per successful gesture).
  5. throwPower (0…1) sets ball speed; lateral aim uses filtered tilt (BowlingInputHandler).
  6. Standard 10 frames, two throws per frame (strike/spare logic in BowlingGameLogic).
  7. Multiplayer: press the cap button when the HUD says Triki = start for your turn.
  8. Short setup countdown and invisible calibration run at the start of a frame — stand still when asked.

HUD phases: Celuj · TrikiCOFNIJ rękęRzuć! → ball rolling → pin result.

VeltoKit mapping

SettingValue
MotionMode.gesture
AimtiltY / lateral → smoothed lane position (posX path via handler)
ThrowGesture via BowlingInputHandlerThrowEvent(power, lateralPosX, spin…)
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)

lanePosition = filterAim(from: input) // see sample handler

if input.shotTriggered {
rollBall(power: input.throwPower, lateral: lanePosition)
}
}

The sample does not call shotTriggered directly in BowlingGame — it routes 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.swiftAim + throw FSM
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 or aim will bias.
  • Toggle invert lateral in-game if your grip feels reversed.
  • Read Gestures for BACK → FORWARD timing shared with Dart.

← Dart · Quiz → · Configuration · Getting started