我试图找到一种在cocos3d中注册触摸事件的方法,例如TOUCHESBEGAN但不存在,只有
-(void) touchEvent: (uint) touchType at: (CGPoint) touchPoint {
NSLog(@"hello");
}
Bu不记录“你好”。 怎么办呢?
答案 0 :(得分:2)
不确定你是否仍对这个答案感兴趣,但现在就去了。
要在cocos3d中使用touchEvent,您需要在 CC3Layer 中启用触控(在initializeControls方法中)
self.isTouchEnabled = YES;
然后你可以在 CC3Scene 中使用touchEvent:(uint)touchType :( CGPoint)touchPoint。
答案 1 :(得分:0)
当我将此代码放入CC3Layer子类
时,开始为我工作-(void) initializeControls {
[self scheduleUpdate];
self.userInteractionEnabled = YES;
[self setTouchEnabled:YES];
}