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

AR互動遊戲分享.pdf

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on.
Avatar for JackyChen JackyChen
September 21, 2019

 AR互動遊戲分享.pdf

Avatar for JackyChen

JackyChen

September 21, 2019
Tweet

Other Decks in Technology

Transcript

  1. 講者簡介 • 國泰⼈人壽 iOS ⼯工程師 • Fintech 創新實習專案 Mentor •

    協助現⾏行行公司導入 Jenkins、BDD、MVVM • 新⼈人教育訓練
  2. 動作 • dae 是 xml 格式的檔案 • 從建模軟體輸出動作時,會含有複數的 animation 標籤

    • 使⽤用 ConvertToXcodeCollada ⼯工具,將 animation 合併成⼀一個,⽅方便便在 Xcode 做程 式控制
  3. 取出模型,加入 AR 場景 // ARSCNViewDelegate func renderer(_ renderer: SCNSceneRenderer, didAdd

    node: SCNNode, for anchor: ARAnchor) { } // 1. 判斷是否為 imageAnchor guard let imageAnchor = anchor as? ARImageAnchor else{return } // 2.從 scn 檔取出 CathayTown guard let townScene = SCNScene(named: "art.scnassets/Scene/ CathayTown.scn") else{fatalError("no townScene") } townNode = townScene.rootNode.childNode(withName: "town", recursively: false)! // 3. 將 CathayTown 加進 node node.addChildNode(townNode)
  4. Animation // 1. 載入「樹寶走路路」的場景檔 let scene = SCNScene( named: "art.scnassets/Scene/TreeBaby-

    walk.scn" )! // 2. 從節點階層取出第⼀一個 animationKey var walk: SCNAnimationPlayer! = nil scene.rootNode.enumerateChildNodes { (child, stop) in if !child.animationKeys.isEmpty { walk = child.animationPlayer(forKey: child.animationKeys[0]) } } // 3. 將動作設定給「閒置樹寶」 treeBaby.addAnimationPlayer(walk, forKey: "walk") // 4. 執⾏行行走路路的動作 walk.play()
  5. Collision-SCNPhysicsContactDelegate public protocol SCNPhysicsContactDelegate : NSObjectProtocol { } // 1.

    碰撞開始 optional func physicsWorld(_ world: SCNPhysicsWorld, didBegin contact: SCNPhysicsContact) // 2. 碰撞期間 optional func physicsWorld(_ world: SCNPhysicsWorld, didUpdate contact: SCNPhysicsContact) // 3. 碰撞結束 optional func physicsWorld(_ world: SCNPhysicsWorld, didEnd contact: SCNPhysicsContact)
  6. 預覽效果 •⽅方法⼆二:使⽤用 Unity ARKit Remote Plugin • AR 效果在電腦上 •

    ⼿手機超燙 • 和電腦須保持實體連線 • 不能測試 hitTest 功能
  7. • 不穩定 • 升版後直接崩潰,試了了半天才知道該版本不能 ⽤用 • 已被棄⽤用 ( deprecated as

    of 2019-06-03 ) • Unity 跨平台的特性不適⽤用 • 因為 ARKit 是在 Metal 基礎之上運⾏行行 其他
  8. 參參考資料(⼀一) • Introducing ARKit: Augmented Reality for iOS • https://developer.apple.com/videos/play/wwdc2017/602/

    • blender • https://www.blender.org/ • SceneKit: What's New • https://developer.apple.com/videos/play/wwdc2017/604/ • SCNMaterial • https://developer.apple.com/documentation/scenekit/scnmaterial • 蘋果要出新產品?可與iPhone互聯聯的AR設備 • https://kknews.cc/tech/j92n95y.html
  9. 參參考資料(⼆二) • Building Collaborative AR Experiences • https://developer.apple.com/videos/play/wwdc2019/610/ • Shared

    AR Experiences with Cloud Anchors • https://developers.google.com/ar/develop/java/cloud-anchors/overview- android • iOS Stereoscopic ARKit Template • https://github.com/hanleyweng/iOS-Stereoscopic-ARKit-Template • Using Machine Learning and CoreML to control ARKit • https://medium.com/s23nyc-tech/using-machine-learning-and-coreml-to- control-arkit-24241c894e3b • Animating a 3D model in AR with ARKit and Mixamo • https://blog.pusher.com/animating-3d-model-ar-arkit-mixamo/
  10. 參參考資料(三) • Creating Great Apps Using Core ML and ARKit

    • https://developer.apple.com/videos/play/wwdc2019/228/ • Reality Composer • https://developer.apple.com/augmented-reality/reality-composer/ • Introducing the Unity ARKit Remote • https://blogs.unity3d.com/2017/08/03/introducing-the-unity- arkit-remote/ • What’s new in Unity ARKit Plugin for ARKit 2 • https://blogs.unity3d.com/2018/06/14/whats-new-in-unity-arkit- plugin-for-arkit-2/