ARKit: 画面タップ先にあるノード上の位置を特定する

p0dee
Jun 6, 2021

--

SCNView内のノードを、あるいはどのノードをユーザーがタップしたのか、さらにはノード上のどこをタップしたのか。これらの取得はSCNView.hitTest(_:options:)SCNNode.convertPosition(_:to:)を組み合わせて行える。UIKitと似ている。

SCNView上のUI操作を検出することができる。

SCNView.hitTest(_:options:)について、hit test検証にはSCNNodeの持つSCNGeometryを参照している。

When you perform a hit-test search, SceneKit looks for SCNGeometry objects along the ray you specify.
SCNHitTestResult

SCNNodeが表すのは、3次元空間におけるノードの座標や変形(transform)パラメタであって、3次元形状やそれに伴うサイズを表すのはSCNGeometry。(前回調べた→ARKit: SCNMaterialのdiffuseとは?)

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response