我是 Cocos3D 的新手,我有两个关于 3D 模型部分的问题。
据我了解,一个 .POD 文件由几个部分组成。在我的示例中,我有一辆 3D 汽车,它具有以下部件: - 车轮 - 轮胎 - 类(等),并且这些部件具有子网格。当我使用 PVRShaman 打开 pod 文件时,我看到了这一点。
现在我的问题:
我可以访问这些部分吗?例如,我想改变轮子的颜色。我可以以编程方式执行此操作吗?
当我点击一个部分时,我想知道我点击了哪个部分。例如,我想点击轮子,并且我知道轮子已被选中。我怎样才能做到这一点?
非常感谢!
更新:在第二个提案之后,我的方法如下所示:
-(void) nodeSelected: (CC3Node*) aNode byTouchEvent: (uint) touchType at: (CGPoint) touchPoint {
NSLog(@"Node selected: %@", aNode.name);
CC3Ray touchRay = [camera unprojectPoint: touchPoint];
CC3NodePuncturingVisitor* puncturedNodes = [self nodesIntersectedByGlobalRay: touchRay];
// The reported touched node may be a parent. We want to find the descendant node that
// was actually pierced by the touch ray, so that we can attached a descriptor to it.
CC3Node* localNode = puncturedNodes.closestPuncturedNode;
NSLog(@"Node local: %@", localNode.name);
}