Slide 1

Slide 1 text

A R K I T S W I F T S T U D Y

Slide 2

Slide 2 text

A J E N D A • ARKitͰͰ͖Δ͜ͱ • SceneViewͱͷؔΘΓ߹͍ • ݱ࣮ੈքͰͷ࠲ඪ • ݱ࣮ੈքͰͷεέʔϧ

Slide 3

Slide 3 text

ARKitͰͰ͖Δ͜ͱ • ϙδγϣϯτϥοΩϯά • ฏ໘ݕग़ • ݱ࣮ੈքͷ࠲ඪݕग़ • HitTest • Etc..

Slide 4

Slide 4 text

SceneViewͱͷؔΘΓ߹͍ • 3D(Scenekit)ʴAR = ARSCNView ͷΑ͏ͳΠϝʔδ • ARͷಛ௃Ͱ͋Δݱ࣮ੈքͰͷฏ໘ͷೝࣝͱɺ࠲ඪΛ༻͍ͯSceneViewʹNode(ς Ωετ΍ΦϒδΣΫτ)Λ഑ஔ͢Δ • Χϝϥͷػೳͱಉ༷ʹsessionʹΑΓ؅ཧ͞Ε͓ͯΓɺsession͕੾ΕͨΓ͢Δͱೝ ͕ࣝͰ͖ͳ͘ͳΔ • AR্ۭؒʹ഑ஔ͢ΔΦϒδΣΫτ͸جຊతʹSceneKitΛ༻͍ͯੜ੒Λߦ͏

Slide 5

Slide 5 text

ݱ࣮ੈքͰͷ࠲ඪ • ARSceneViewͰhitTestΛߦ͏
 hitTest: func hitTest(_ point: CGPoint, types: ARHitTestResult.ResultType) -> [ARHitTestResult] • ARSceneViewͷը໘্ʹදࣔ͞Ε͍ͯΔը૾͕࣮ࡍʹݱ࣮ੈքͰͲͷϙΠϯτʹ ౰ͨΔͷ͔൑ఆΛߦͬͯ͘ΕΔ • ͨͩɺೝࣝͨ͠ฏ໘ʹରͯ͠hitTestΛߦ͏ͷͰ·ͣ͸ೝࣝΛ͢Δඞཁ͕͋Δ • Returnʹ͸ೝࣝͨ͠ฏ໘ʹର͢Δ࠲ඪ͕݁Ռͱͯ͠ฦͬͯ͘Δ • SCNVector3ͱݺ͹ΕΔ̏࣍ݩͷ݁Ռͱͯ͠࠲ඪΛऔಘ͢Δ͜ͱ͕Ͱ͖Δ

Slide 6

Slide 6 text

SCNVector3 var x: Float The first component in the vector. var y: Float The second component in the vector. var z: Float The third component in the vector. • ̎࣍ݩͰѻ͏ࡍ͸X࣠ͱZ࣠ͷΈΛར༻͢Δͱྑ͍ Z X Y

Slide 7

Slide 7 text

ݱ࣮ੈքͰͷεέʔϧ • ࠲ඪͷεέʔϧ͸શͯϝʔτϧ׵ࢉ͞Ε͍ͯΔ? // ശΛੜ੒ let cube = SCNBox(width: 0.1, height: 0.1, length: 0.1, chamferRadius: 0) let cubeNode = SCNNode(geometry: cube) • 0.1 ͩͱ ݱ࣮ੈքͰͷ10cm ʹ૬౰͢Δ • ͍ͭ΋ͷΑ͏ʹview্ʹද͍ࣔͯ͠ΔαΠζͰ͸ඇৗʹେ͖ͳαΠζʹͳͬͯ͠ ·͏ͷͰ஫ҙ