gpt4 book ai didi

ios - 访问 SCNSphere 属性

转载 作者:行者123 更新时间:2023-11-28 18:51:55 24 4
gpt4 key购买 nike

我正在尝试访问/修改我在 SCNScene 中拥有的 SCNSphere 的属性。我将场景预设为名为“spaceScene.scn”的文件。我正在这样加载场景

self.sceneView.scene = [SCNScene sceneNamed:@"spaceScene.scn"];
self.sceneView.allowsCameraControl = YES;
self.sceneView.scene.rootNode.camera = [SCNCamera camera];
SCNSphere *earth = (SCNSphere *)[self.sceneView.scene.rootNode childNodeWithName:@"earth" recursively:NO];

NSMutableArray *materials = earth.materials;
NSLog(@"Materials of earth from scene: %@", materials);

我似乎无法忘记阅读SCNSphere earthma​​terials 属性。我不断收到实例错误:

-[SCNNode materials]: 无法识别的选择器发送到实例 0x1701c5550

这个问题感觉有点傻,但请有人告诉我如何访问球体属性?谢谢

最佳答案

SCNSphere 继承自 SCNNode。您应该检索节点的 geometry,它可以是一个球体。

关于ios - 访问 SCNSphere 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40387177/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com