SCNPhysicsContactDelegate必须至少实现一个选择器

时间:2014-08-16 13:27:03

标签: ios scenekit

[SCNKit ERROR] SCNPhysicsContactDelegate必须至少实现一个选择器

我将viewController设置为项目的contactDelegate后收到上述错误。我找不到我忘记实现的内容,下面是我加载场景的代码。

 - (void)viewDidLoad {
[super viewDidLoad];

    SCNView *scnView = (SCNView *) self.view;

    //set the background colour
    scnView.backgroundColor = [UIColor blackColor];

    //setup the scene
    SCNScene *scene = [self setupScene];

    //present it
    scnView.scene = scene;

    //initial point of view
    scnView.pointOfView = _cameraNode;

    //plug game logic
    scnView.delegate = self;

    //physicsworld
    scnView.scene.physicsWorld.gravity = SCNVector3Make(0, 0, 0);
    scnView.scene.physicsWorld.contactDelegate = self;

[super viewDidLoad];
}


- (void)didBeginContact:(SCNPhysicsContact *)contact {
    NSLog(@"contact");
}

·H

@interface GameViewController : UIViewController <SCNSceneRendererDelegate, SCNPhysicsContactDelegate>

@end

1 个答案:

答案 0 :(得分:0)

您没有从协议中实现任何方法,因此声明一致性是错误的。

您可能希望实施physicsWorld:didBeginContact:,而不仅仅是didBeginContact:

相关问题