質問編集履歴
1
質問説明追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -54,4 +54,25 @@
|
|
54
54
|
//boxNode.physicsBody = boxBody
|
55
55
|
boxNode.name = "box"
|
56
56
|
コード
|
57
|
-
```
|
57
|
+
```
|
58
|
+
タップしオブジェクトを選択しても、そのポジションは初期設定のポジションのままです。
|
59
|
+
```
|
60
|
+
@objc func tapped(recognizer: UIGestureRecognizer) {
|
61
|
+
|
62
|
+
let view = recognizer.view as? SCNView
|
63
|
+
let touchLocation = recognizer.location(in: view)
|
64
|
+
|
65
|
+
let hitTestResult = sceneView.hitTest(touchLocation, options: nil)
|
66
|
+
|
67
|
+
if hitTestResult.count > 0 {
|
68
|
+
|
69
|
+
touchNode = hitTestResult.first!.node
|
70
|
+
//sceneView.allowsCameraControl = false
|
71
|
+
|
72
|
+
|
73
|
+
print("tapped/ x=",touchNode.position.x,", y=",touchNode.position.y,", z=",touchNode.position.z)
|
74
|
+
|
75
|
+
}
|
76
|
+
}
|
77
|
+
```
|
78
|
+
自由落下に限らず、オブジェクト同士がぶつかった後の座標を取得するにはどうしたらよいでしょうか
|