質問編集履歴

2

コードを修正

2021/10/04 07:50

投稿

sugidodan
sugidodan

スコア26

test CHANGED
File without changes
test CHANGED
@@ -188,4 +188,6 @@
188
188
 
189
189
  azimuth = (deviceMotion.attitude.yaw)
190
190
 
191
+ }
192
+
191
193
  ```

1

コードを追記

2021/10/04 07:50

投稿

sugidodan
sugidodan

スコア26

test CHANGED
File without changes
test CHANGED
@@ -53,6 +53,20 @@
53
53
  }
54
54
 
55
55
  }
56
+
57
+ ...
58
+
59
+ 中略
60
+
61
+ HStack{
62
+
63
+ Text(String(format:"%6.2f", builtIn.roll * 180.0/Double.pi)).padding()
64
+
65
+ Text(String(format:"%6.2f",builtIn.pitch * 180.0/Double.pi)).padding()
66
+
67
+ Text(String(format:"%6.2f",builtIn.azimuth * 180.0/Double.pi)).padding()
68
+
69
+ }
56
70
 
57
71
  ...
58
72
 
@@ -156,4 +170,22 @@
156
170
 
157
171
  }
158
172
 
173
+
174
+
175
+ @Published var pitch = 0.0
176
+
177
+ @Published var roll = 0.0
178
+
179
+ @Published var azimuth = 0.0
180
+
181
+
182
+
183
+ private func updateMotionData(deviceMotion:CMDeviceMotion) {
184
+
185
+ pitch = (deviceMotion.attitude.pitch)
186
+
187
+ roll = (deviceMotion.attitude.roll)
188
+
189
+ azimuth = (deviceMotion.attitude.yaw)
190
+
159
191
  ```