相关疑难解决方法(0)

使用SceneKit在3D空间中旋转SCNode对象

我试图在SceneKit周围学习,作为一个例子,我想我会尝试使用SDK构建一个太阳能系统.我能够添加SCNode对象并配置其材质属性,如图案和光照.此外,我能够旋转行星,但我似乎无法理解如何沿着特定的路径"旋转"它们.

到目前为止我的代码看起来像:

// create a new scene
SCNScene *scene = [SCNScene scene];

// create and add a camera to the scene
SCNNode *cameraNode = [SCNNode node];
cameraNode.camera = [SCNCamera camera];
[scene.rootNode addChildNode:cameraNode];

// place the camera
cameraNode.position = SCNVector3Make(0, 0, 2);

// create and add a 3d sphere - sun to the scene
SCNNode *sphereNode = [SCNNode node];
sphereNode.geometry = [SCNSphere sphereWithRadius:0.3];
[scene.rootNode addChildNode:sphereNode];

// create and configure a material
SCNMaterial *material = [SCNMaterial material];
material.diffuse.contents = [NSImage imageNamed:@"SunTexture"];
material.specular.contents …
Run Code Online (Sandbox Code Playgroud)

3d macos objective-c scenekit

6
推荐指数
1
解决办法
6142
查看次数

标签 统计

3d ×1

macos ×1

objective-c ×1

scenekit ×1