1

在 cocos3d 中,我想复制一个来自 .POD 文件(earth.pod)的旋转地球的 CC3MeshNode。这就是我制作 1 的方式:

[self addContentFromPODFile: @"earth.pod"];

CC3MeshNode* earth = (CC3MeshNode*)[self getNodeNamed: @"Sphere"];
[earth setRotation:cc3v(0.0, 0.0, 0.0)];
CCActionInterval* rotate = [CC3RotateBy actionWithDuration: 1.0
                                                       rotateBy: cc3v(0.0, 30.0, 5.0)];
[earth runAction: [CCRepeatForever actionWithAction: rotate]];
earth.location = cc3v(0, 0, 0);

现在我想创建第二个地球:

CC3MeshNode* earth2 = (CC3MeshNode*)[self getNodeNamed: @"Sphere"];
[earth2 setRotation:cc3v(0.0, 0.0, 0.0)];
CCActionInterval* rotate2 = [CC3RotateBy actionWithDuration: 1.0
                                                       rotateBy: cc3v(0.0, 30.0, 5.0)];
[earth runAction: [CCRepeatForever actionWithAction: rotate2]];
earth2.location = cc3v(5, 0, 0);

但这摆脱了原来的。如何从可以复制的 POD 文件创建 CC3MeshNode?

谢谢 :)

4

2 回答 2

0

您应该能够执行以下操作:

CC3PODResourceNode *resourceNode = [CC3PODResourceNode nodeFromFile: @"earth.pod"];
CC3MeshNode *meshNode1 = [resourceNode getMeshNodeNamed: @"Sphere"];
CC3MeshNode *meshNode2 = [meshNode1 copyWithName: @"Sphere2"];
于 2013-03-15T20:58:01.827 回答
0

CC3MeshNode* earth2 = [(CC3MeshNode*)[self getNodeNamed:@"Sphere"] copyAutoreleased];

于 2012-10-26T12:42:34.267 回答