Bowling
Bowling
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
- Connect + calibrate in the sample app.
- Open Bowling — lobby supports player names, frames, optional TV.
- Between throws, tilt to move the ball left/right on the lane.
- Pull back on the cap, then throw forward to roll (one roll per successful gesture).
throwPower(0…1) sets ball speed; lateral aim uses filtered tilt (BowlingInputHandler).- 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: Celuj · Triki → COFNIJ rękę → Rzuć! → ball rolling → pin result.
VeltoKit mapping
| Setting | Value |
|---|---|
MotionMode | .gesture |
| Aim | tiltY / lateral → smoothed lane position (posX path via handler) |
| Throw | Gesture via BowlingInputHandler → ThrowEvent(power, lateralPosX, spin…) |
| 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)
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
| File | Role |
|---|---|
app/Games/BowlingGame.swift | Round phases, scoring, SceneKit bridge |
app/Games/Bowling/BowlingInputHandler.swift | Aim + throw FSM |
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 or aim will bias.
- Toggle invert lateral in-game if your grip feels reversed.
- Read Gestures for BACK → FORWARD timing shared with Dart.