ARKit

#import "ViewController.h"@interface ViewController ()@property (nonatomic, strong) IBOutlet ARSCNView *sceneView;@end? ? @implementation ViewController- (void)viewDidLoad {? ? [super viewDidLoad];? ? // Set the view's delegate? ? self.sceneView.delegate = self;? ? ? ? // Show statistics such as fps and timing information? ? self.sceneView.showsStatistics = YES;? ? ? ? // Create a new scene? ? SCNScene *scene = [SCNScene sceneNamed:@"art.scnassets/ship.scn"];? ? ? ? // Set the scene to the view? ? self.sceneView.scene = scene;}- (void)viewWillAppear:(BOOL)animated {? ? [super viewWillAppear:animated];? ? ? ? // Create a session configuration? ? ARWorldTrackingSessionConfiguration *configuration = [ARWorldTrackingSessionConfiguration new];? ? ? ? // Run the view's session? ? [self.sceneView.session runWithConfiguration:configuration];}- (void)viewWillDisappear:(BOOL)animated {? ? [super viewWillDisappear:animated];? ? ? ? // Pause the view's session? ? [self.sceneView.session pause];}- (void)didReceiveMemoryWarning {? ? [super didReceiveMemoryWarning];? ? // Release any cached data, images, etc that aren't in use.}#pragma mark - ARSCNViewDelegate/*// Override to create and configure nodes for anchors added to the view's session.- (SCNNode *)renderer:(id)renderer nodeForAnchor:(ARAnchor *)anchor {

SCNNode *node = [SCNNode new];

// Add geometry to the node...

return node;

}

*/

- (void)session:(ARSession *)session didFailWithError:(NSError *)error {

// Present an error message to the user

}

- (void)sessionWasInterrupted:(ARSession *)session {

// Inform the user that the session has been interrupted, for example, by presenting an overlay

}

- (void)sessionInterruptionEnded:(ARSession *)session {

// Reset tracking and/or remove existing anchors if consistent tracking is required

}

@end

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • ARKit從入門到精通(1)-ARKit初體驗(yàn)標(biāo)簽: ARKit2017-06-12 17:33 1772人閱讀 ...
    零度_不結(jié)冰閱讀 1,022評(píng)論 0 2
  • ARkit Introducing ARKit iOS 11引入ARKit,這是 個(gè)全新的框架,允許開發(fā)者輕松地為...
    坤哥愛卿閱讀 1,490評(píng)論 0 1
  • 轉(zhuǎn)載請(qǐng)標(biāo)注出處:http://blog.csdn.net/u013263917/article/details/7...
    Jonath閱讀 566評(píng)論 0 1
  • 此文章為轉(zhuǎn)載文章 ARKit從入門到精通(1)-ARKit初體驗(yàn) 1.1-AR技術(shù)簡(jiǎn)介 增強(qiáng)現(xiàn)實(shí)技術(shù)(Augmen...
    泥孩兒0107閱讀 663評(píng)論 0 1
  • 親愛的干爹: 你還好嗎?不見您已經(jīng)有三個(gè)月時(shí)間,分外想念的同時(shí)還格外的孤獨(dú),不能說瘙癢難耐但也差不多等同于...
    大大師閱讀 1,641評(píng)論 0 1

友情鏈接更多精彩內(nèi)容