Metaio SDK - 创建新的AR应用程序

时间:2014-09-15 18:50:02

标签: ios xcode sdk metaio

我正在关注Metaio网站上的教程 - 创建一个新的AR应用程序,它似乎工作(我得到了Metaio启动画面,当我在ipad上构建并运行它时,水印显示在摄像机视图上

我正在尝试使用直接从Metaio SDK复制的代码来使用Hello World教程,但我无法让模型显示在图像上。

实现文件代码如下 - 我在ipad上运行它时没有错误,并获得相机视图等,但没有3D模型 - 任何建议? THX:

   #import "ViewController.h"
@interface ViewController ()
@end

@implementation ViewController
- (void) viewDidLoad
{
    [super viewDidLoad];
    // load our tracking configuration
    NSString* trackingDataFile = [[NSBundle mainBundle] pathForResource:@"TrackingData_MarkerlessFast"
                                                                 ofType:@"xml"
                                                            inDirectory:@"Assets"];

    if(trackingDataFile)
    {
        bool success = m_metaioSDK->setTrackingConfiguration([trackingDataFile UTF8String]);
        if( !success)
            NSLog(@"No success loading the tracking configuration");
            }

    // load content
    NSString* metaioManModel = [[NSBundle mainBundle] pathForResource:@"metaioman"
                                                               ofType:@"md2"
                                                          inDirectory:@"Assets"];

    if(metaioManModel)
    {
        metaio::IGeometry* theLoadedModel =  m_metaioSDK->createGeometry([metaioManModel UTF8String]);
        if( theLoadedModel )
        {
            // scale it a bit up
            theLoadedModel->setScale(metaio::Vector3d(1.0,1.0,1.0));
        }
        else
        {
            NSLog(@"error, could not load %@", metaioManModel);
        }
    }
}
@end

1 个答案:

答案 0 :(得分:0)

您是否也使用xml跟踪文件,该文件应该位于assets文件夹中? 在我看来,它可能来自几个错误:
- 跟踪图像在xml文件和文件夹中的名称不同
- 跟踪文件为空或包含错误


也许您可以共享xml跟踪文件,以便我们为您提供更多帮助。

祝你好运

相关问题