<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Richard Deetlefs</title>
    <description>The latest articles on DEV Community by Richard Deetlefs (@richard_deetlefs_037a59ad).</description>
    <link>https://dev.to/richard_deetlefs_037a59ad</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4134960%2F196b2e08-c0f8-4c56-b17d-9919820cd52f.png</url>
      <title>DEV Community: Richard Deetlefs</title>
      <link>https://dev.to/richard_deetlefs_037a59ad</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/richard_deetlefs_037a59ad"/>
    <language>en</language>
    <item>
      <title>How Play FORE reads a golf swing at 100Hz with CoreMotion</title>
      <dc:creator>Richard Deetlefs</dc:creator>
      <pubDate>Mon, 21 Sep 2026 05:32:02 +0000</pubDate>
      <link>https://dev.to/richard_deetlefs_037a59ad/how-play-fore-reads-a-golf-swing-at-100hz-with-coremotion-2egm</link>
      <guid>https://dev.to/richard_deetlefs_037a59ad/how-play-fore-reads-a-golf-swing-at-100hz-with-coremotion-2egm</guid>
      <description>&lt;h1&gt;
  
  
  How Play FORE reads a golf swing at 100Hz with CoreMotion
&lt;/h1&gt;

&lt;p&gt;Play FORE is a solo indie iOS golf game where the iPhone &lt;em&gt;is&lt;/em&gt; the club. You hold it like a short iron, soft-swing on a haptic GO, and CoreMotion turns that motion into a shot at one island green (~153 yd).&lt;/p&gt;

&lt;p&gt;There is no aim stick and no power meter to drag. The swing is the control scheme. This post is the engineering story: sampling &lt;code&gt;CMDeviceMotion&lt;/code&gt;, mapping speed and face, rejecting junk motion, and capping hard swings so living-room play stays safe.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sampling CMDeviceMotion at ~100Hz
&lt;/h2&gt;

&lt;p&gt;On every swing attempt, Play FORE listens to the gyroscope and accelerometer through CoreMotion. The useful stream is device motion at roughly &lt;strong&gt;100Hz&lt;/strong&gt;—fast enough to catch the short window of a soft one-handed swing without pretending we have a launch-monitor bay.&lt;/p&gt;

&lt;p&gt;What we care about in that stream is not a continuous replay of the golf swing. It is two derived signals:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Peak angular velocity&lt;/strong&gt; in the swing window → how hard you swung → &lt;strong&gt;carry&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Device roll around impact&lt;/strong&gt; → how open or closed the “face” was → &lt;strong&gt;fade / draw&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Speed answers “how far.” Face answers “left or right of the line.” Soft swings, held securely, are the design surface. Full-speed living-room drivers are not.&lt;/p&gt;

&lt;h2&gt;
  
  
  Soft-swing calibration (and why hard swings are capped)
&lt;/h2&gt;

&lt;p&gt;The product brief is living-room golf. Soft swings only. That is a safety &lt;em&gt;and&lt;/em&gt; sensing constraint.&lt;/p&gt;

&lt;p&gt;Hard swings fail for two reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Safety.&lt;/strong&gt; Phones slip. Furniture and wrists exist. Soft tempo is the only tempo we want people practicing indoors.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Signal quality.&lt;/strong&gt; A wild thrash saturates the useful part of the motion window and turns club speed into noise. Soft swings keep peak angular velocity in a range we can map to a stock short-iron carry.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Calibration sits in that soft band. Overswing is capped—you are not rewarded for whipping the phone like a driver. The teaching range reinforces it: the soft/short drill &lt;strong&gt;fails if you swing too hard&lt;/strong&gt;. Tempo is part of the mechanic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Speed → carry, roll → face
&lt;/h2&gt;

&lt;p&gt;Once a swing is accepted:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Speed → carry.&lt;/strong&gt; Peak angular velocity maps to power and distance—short-iron numbers around the ~153 yd island target, not Tour driver math.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Face / wrist roll → draw / fade.&lt;/strong&gt; Roll at impact is face angle: closed pulls into a draw/hook shape; open pushes into a fade/slice shape.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Players feel this immediately when water surrounds the green. Miss left or right and you learn whether the face was closed or open.&lt;/p&gt;

&lt;h2&gt;
  
  
  False positives: pocket bumps and accidental motion
&lt;/h2&gt;

&lt;p&gt;The hard part of motion games is not reading &lt;em&gt;a&lt;/em&gt; swing. It is deciding &lt;em&gt;which&lt;/em&gt; motion was the swing.&lt;/p&gt;

&lt;p&gt;Phones live in pockets and restless hands. Bumps, sit-downs, and grip adjusts all look like acceleration if thresholds are naïve. Play FORE gates the window: hold still, countdown with haptic GO, then a short capture where we look for a coherent soft swing—not every jolt the IMU saw that minute.&lt;/p&gt;

&lt;p&gt;False positives still happen. Pocket bumps and half-swings are the classics. The fix is product-shaped as much as filter-shaped: clear GO timing, soft-swing expectations, and drills that teach what “counts.” When detection fails, we would rather ask for another swing than invent a shot from noise.&lt;/p&gt;

&lt;h2&gt;
  
  
  Teaching range: six drills that expose the sensors
&lt;/h2&gt;

&lt;p&gt;Before free play, a short teaching range walks through what the sensors reward:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Any swing&lt;/strong&gt; — on-rails easy; learn GO → soft swing
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Soft / short&lt;/strong&gt; — fail if too hard
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hard / long&lt;/strong&gt; — stretch distance without leaving soft-swing safety
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Closed face&lt;/strong&gt; — pull left; feel roll → draw
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Open face&lt;/strong&gt; — push right; feel roll → fade
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Draw into left-to-right wind&lt;/strong&gt; — finish near the pin; combine speed, face, and conditions
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Drill 6 is where the pieces meet. That is the same loop free play asks for on the island.&lt;/p&gt;

&lt;h2&gt;
  
  
  One hole on purpose
&lt;/h2&gt;

&lt;p&gt;The course is deliberately small: one polished par-3 island green over water. Distance control and face awareness matter more when water surrounds the target. The goal was never an 18-hole tour sim. It was &lt;strong&gt;swing feel&lt;/strong&gt;—tempo, carry, and face—on a device you already carry, where a soft swing is the only responsible swing.&lt;/p&gt;

&lt;p&gt;If you ship motion input: constrain the gesture, sample fast enough to see the peak, map two axes players can feel, reject junk aggressively, and cap the unsafe end of the range. CoreMotion at ~100Hz is plenty when the gesture is honest.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Play FORE&lt;/strong&gt; (App Store): &lt;a href="https://apps.apple.com/app/id6802967255" rel="noopener noreferrer"&gt;https://apps.apple.com/app/id6802967255&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Site:&lt;/strong&gt; &lt;a href="https://playfore.app/?utm_source=iosdevweekly" rel="noopener noreferrer"&gt;https://playfore.app/?utm_source=iosdevweekly&lt;/a&gt;  &lt;/p&gt;

&lt;p&gt;Solo indie by Richard Deetlefs.&lt;/p&gt;

</description>
      <category>ios</category>
      <category>swift</category>
      <category>gamedev</category>
      <category>coremotion</category>
    </item>
  </channel>
</rss>
