Upgrade to Pro — share decks privately, control downloads, hide ads and more …

arkit+animoji

mcz9mm
September 25, 2017
63

 arkit+animoji

mcz9mm

September 25, 2017
Tweet

Transcript

  1. A J E N D A • ARKitͰͰ͖Δ͜ͱ • SceneViewͱͷؔΘΓ߹͍

    • ݱ࣮ੈքͰͷ࠲ඪ • ݱ࣮ੈքͰͷεέʔϧ • Animoji
  2. SceneViewͱͷؔΘΓ߹͍ • 3D(Scenekit)ʴAR = ARSCNView ͷΑ͏ͳΠϝʔδ • ARͷಛ௃Ͱ͋Δݱ࣮ੈքͰͷฏ໘ͷೝࣝͱɺ࠲ඪΛ༻͍ͯSceneViewʹNode(ς Ωετ΍ΦϒδΣΫτ)Λ഑ஔ͢Δ •

    Χϝϥͷػೳͱಉ༷ʹsessionʹΑΓ؅ཧ͞Ε͓ͯΓɺsession͕੾ΕͨΓ͢Δͱೝ ͕ࣝͰ͖ͳ͘ͳΔ • AR্ۭؒʹ഑ஔ͢ΔΦϒδΣΫτ͸جຊతʹSceneKitΛ༻͍ͯੜ੒Λߦ͏
  3. ݱ࣮ੈքͰͷ࠲ඪ • ARSceneViewͰhitTestΛߦ͏
 hitTest: func hitTest(_ point: CGPoint, types: ARHitTestResult.ResultType)

    -> [ARHitTestResult] • ARSceneViewͷը໘্ʹදࣔ͞Ε͍ͯΔը૾͕࣮ࡍʹݱ࣮ੈքͰͲͷϙΠϯτʹ ౰ͨΔͷ͔൑ఆΛߦͬͯ͘ΕΔ • ͨͩɺೝࣝͨ͠ฏ໘ʹରͯ͠hitTestΛߦ͏ͷͰ·ͣ͸ೝࣝΛ͢Δඞཁ͕͋Δ • Returnʹ͸ೝࣝͨ͠ฏ໘ʹର͢Δ࠲ඪ͕݁Ռͱͯ͠ฦͬͯ͘Δ • SCNVector3ͱݺ͹ΕΔ̏࣍ݩͷ݁Ռͱͯ͠࠲ඪΛऔಘ͢Δ͜ͱ͕Ͱ͖Δ
  4. 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
  5. ݱ࣮ੈքͰͷεέʔϧ • ࠲ඪͷεέʔϧ͸શͯϝʔτϧ׵ࢉ͞Ε͍ͯΔ? // ശΛੜ੒ let cube = SCNBox(width: 0.1,

    height: 0.1, length: 0.1, chamferRadius: 0) let cubeNode = SCNNode(geometry: cube) • 0.1 ͩͱ ݱ࣮ੈքͰͷ10cm ʹ૬౰͢Δ • ͍ͭ΋ͷΑ͏ʹview্ʹද͍ࣔͯ͠ΔαΠζͰ͸ඇৗʹେ͖ͳαΠζʹͳͬͯ͠ ·͏ͷͰ஫ҙ