addChildNode:[self createTextNode:@"走"]]; [self.scnView.scene.rootNode addChildNode:[self createTextNode...addChildNode:[self createTextNode:@"酷"]]; [self.scnView.scene.rootNode addChildNode:[self createTextNode...addChildNode:[self createTextNode:@"涯"]]; 下面是创建文字节点的代码 [self.scnView.scene.rootNode addChildNode:[self...addChildNode:[self createTextNode:@"天"]]; [self.scnView.scene.rootNode addChildNode:[self createTextNode...addChildNode:[self createTextNode:@"走"]]; [self.scnView.scene.rootNode addChildNode:[self createTextNode
addChildNode:self.bgNode]; [self.bgNode addChildNode:self.shadowNode]; [self.bgNode addChildNode:self.playOrPauseNode...]; [self.bgNode addChildNode:self.proviousNode]; [self.bgNode addChildNode:self.AfterNode]; [self.bgNode...addChildNode:self.showMoreNode]; [self.bgNode addChildNode:self.lowVoiceNode]; [self.bgNode addChildNode...:self.highVoiceNode]; [self.scene.rootNode addChildNode:self.eyeNode]; 第三步 添加点控节点,将其放在添加到照相机节点上去,这样照相机转动的时候...,它就能跟着转动,效果就是一直在屏幕中央 [self.eyeNode addChildNode:self.dotNode]; 第四步 抬头小时低头出现 -(void)controlEyeNodeInVR
node]; boxNode.position = SCNVector3Make(0, 0, 0); boxNode.geometry = box; [scnView.scene.rootNode addChildNode...SCNNode nodeWithGeometry:plane]; planeNode.position = SCNVector3Make(0, 0, 0); [scnView.scene.rootNode addChildNode...nodeWithGeometry:pyramid]; pyramidNode.position = SCNVector3Make(0, 0, 0); [scnView.scene.rootNode addChildNode...SCNNode nodeWithGeometry:cone]; coneNode.position = SCNVector3Make(0,0, 0); [scnView.scene.rootNode addChildNode...SCNNode nodeWithGeometry:tube]; tubeNode.position = SCNVector3Make(0, 0, 0); [scnView.scene.rootNode addChildNode
1; vortexFieldNode.physicsField.direction = SCNVector3Make(-1, 0, 0); [self.scnView.scene.rootNode addChildNode...; lineGravityNode.physicsField.direction = SCNVector3Make(0, 0, -1); [self.scnView.scene.rootNode addChildNode..., 0, 0, -M_PI/4); cameraNode.camera.automaticallyAdjustsZRange = true; [self.scnView.scene.rootNode addChildNode...addParticleSystem:particleSytem]; particleNode.physicsBody = [SCNPhysicsBody dynamicBody]; [tubeNode addChildNode...UIImage imageNamed:@"1.PNG"]; tubeNode1.position = SCNVector3Make(6, 1, 0); [self.scnView.scene.rootNode addChildNode
automaticallyAdjustsZRange = true scene.rootNode.addChildNode(cameraNode) cameraNode.position...type = .omni lightNode.position = SCNVector3(x: 0, y: 10, z: 10) scene.rootNode.addChildNode(...color = UIColor.darkGray scene.rootNode.addChildNode(ambientLightNode) // 设置相关属性 let...diffuse.contents = "floor.jpg" scene.rootNode.addChildNode(floorNode) // 创建内画面 let sceneShip...let cameraNode1 = SCNNode() cameraNode1.camera = SCNCamera() sceneShip.rootNode.addChildNode(
camera.automaticallyAdjustsZRange = TRUE; cameraNode.position = SCNVector3Make(0, 0, 10); [scnView.scene.rootNode addChildNode...createTextNodeWithString:@"天"]; SCNNode *text4 = [self createTextNodeWithString:@"涯"]; [scnView.scene.rootNode addChildNode...:text1]; [scnView.scene.rootNode addChildNode:text2]; [scnView.scene.rootNode addChildNode:text3]; [scnView.scene.rootNode...addChildNode:text4]; // 创建文字的函数 -(SCNNode*)createTextNodeWithString:(NSString*)string{ SCNText *text...particleNode addParticleSystem:particleSystem]; particleNode.position = SCNVector3Make(0.5, 0, 0); [node addChildNode
= SCNScene() let cameraNode = SCNNode() cameraNode.camera = SCNCamera() scene.rootNode.addChildNode...= SCNScene() let cameraNode = SCNNode() cameraNode.camera = SCNCamera() scene.rootNode.addChildNode...position = SCNVector3Make(0, 0, -3000) scene.rootNode.addChildNode(boss!) 运行结果如下 ?...position = SCNVector3Make(0, Float(i * 100), -3000) scene.rootNode.addChildNode(bossCopy!)...let boss = bossScene.rootNode boss.position = SCNVector3Make(0, 0, -3000) scene.rootNode.addChildNode
创建一个人的节点 let person = SCNNode() person.scale = SCNVector3Make(0.01, 0.01, 0.01) person.addChildNode...(body) person.addChildNode(clothes) person.addChildNode(hair) person.addChildNode(shoes...) self.scnView.scene.rootNode.addChildNode(person) } override func viewWillAppear(_ animated:
rootNode.addChildNode(sphereNode) 第二步 贴图 sphereNode.geometry?.firstMaterial?....automaticallyAdjustsZRange = true cameraNode.position = SCNVector3Make(0, 0, 0) sphereNode.addChildNode...type = .ambient sphereNode.addChildNode(lightNode) 你会发现正是我们需要的 ?
sphereWithRadius:3]; sunNode.geometry.firstMaterial.diffuse.contents = @"sun.jpg"; [self.scnView.scene.rootNode addChildNode...SCNNode *earthMoonNode = [SCNNode node]; earthMoonNode.position = SCNVector3Make(10, 0, 0); [sunNode addChildNode...earthNode.geometry.firstMaterial.diffuse.contents = @"earth.jpg"; earthNode.position = SCNVector3Make(0, 0, 0); [earthMoonNode addChildNode...moonNode.geometry.firstMaterial.diffuse.contents = @"moon.jpg"; moonNode.position = SCNVector3Make(2, 0, 0); [earthNode addChildNode...self.firstViewCamera.camera =[SCNCamera camera]; self.firstViewCamera.position = SCNVector3Make(0, 0, 10); [earthMoonNode addChildNode
nodeWithGeometry:jpBox]; jpNode.position = SCNVector3Make(0, 0, -0.5); [jpScene.rootNode addChildNode...SCNMatrix4MakeRotation(x, 1.0, 0.0, 0.0); [self setTextureScale]; [self addChildNode
= [SCNCamera camera]; cameraNode.camera.automaticallyAdjustsZRange = true; [scnView.scene.rootNode addChildNode...mapImage.png"; 第七步 把第一个几何体绑定到节点上添加到场景中去 SCNNode *planeNode = [SCNNode node]; [scnView.scene.rootNode addChildNode...:planeNode]; planeNode.geometry = g1; [scnView.scene.rootNode addChildNode:planeNode]; 到这里我们的准备工作已经完成...recursively:true]; node1.geometry.firstMaterial.diffuse.contents = @"1.PNG"; [scnView.scene.rootNode addChildNode
cameraNode.camera.automaticallyAdjustsZRange = true; cameraNode.position = SCNVector3Make(0, 0,1000); [scnView.scene.rootNode addChildNode...= SCNVector3Make(0, -50, 0); lowerArm.pivot = SCNMatrix4MakeTranslation(0, 50, 0); // 连接点 [lowerArm addChildNode...sphereWithRadius:10]; controlNode.geometry.firstMaterial.diffuse.contents = [UIColor blueColor]; [controlNode addChildNode...:upperArm]; controlNode.position= SCNVector3Make(0, 100, 0); // 添加到场景中去 [scnView.scene.rootNode addChildNode...SCNVector3Make(arc4random_uniform(100), arc4random_uniform(100), arc4random_uniform(100)); [scene.rootNode addChildNode
rootNode.addChildNode(cameraNode) 提示: 摄像机默认方向为 -Z 轴, 我设置它的位置为(0,1000,1000) ,沿自身坐标系x轴顺时针旋转了45度,这个是由于我的模型比较大...,放等源 let handleSpot = SCNNode() handleSpot.position = SCNVector3(0, 1000, 40) handleSpot.addChildNode...rootNode.addChildNode(handleSpot) 提示: 灯光对象的属性 shadowMode 默认为.forward,如果你设置了这个属性,灯光效应下的阴影效果才能呈现出来,它会根据灯光效应去调节阴影颜色的阿尔法分量值...rootNode .addChildNode(floorNode) 第九步 添加一个模型对象到场景中去 let treeNode = SCNScene(named: "palm_tree.dae")?...rotation = SCNVector4(x: 1, y: 0, z: 0, w: -Float(M_PI/2)) scene.rootNode.addChildNode(treeNode!)
planeNode3.position = SCNVector3Make(1, -1, -1); //设置节点 [self.jpARSCNView.scene.rootNode addChildNode...:planeNode1]; [self.jpARSCNView.scene.rootNode addChildNode:planeNode2]; [self.jpARSCNView.scene.rootNode...addChildNode:planeNode3]; } #pragma mark - 访问器方法 - (ARSCNView *)jpARSCNView { if (_jpARSCNView
rootNode.addChildNode(cameraNode) 第六步 创建一个球体 let sphere = SCNSphere(radius: 1) sphere.firstMaterial...sphereNode = SCNNode(geometry: sphere) sphereNode.position = SCNVector3(x:0,y:2,z:0) scene.rootNode.addChildNode...UIColor.blue let boxNode = SCNNode(geometry: box) boxNode.position = SCNVector3(x:0,y:20,z:0) scene.rootNode.addChildNode...diffuse.contents = "floor.jpg" let floorNode = SCNNode(geometry: floor) scene.rootNode.addChildNode(
cameraNode.camera = camera; cameraNode.position = SCNVector3Make(0, 5, 10); [self.scnView.scene.rootNode addChildNode...SCNVector3Make(0, 20, 20); lightNode.rotation = SCNVector4Make(1, 0, 0, -M_PI/4); [self.scnView.scene.rootNode addChildNode...customAction = [SCNAction sequence:@[moveAction,removeFromSuper]]; // 将节点添加到场景中去 [self.scnView.scene.rootNode addChildNode
创建一个摄像机并放入场景中 SCNNode *cameraNode = [SCNNode node]; cameraNode.camera = [SCNCamera camera]; [scene.rootNode addChildNode...lightNode.light.type = SCNLightTypeOmni; lightNode.position = SCNVector3Make(0, 10, 10); [scene.rootNode addChildNode...ambientLightNode.light.type = SCNLightTypeAmbient; ambientLightNode.light.color = [UIColor darkGrayColor]; [scene.rootNode addChildNode
sphereNode.position = SCNVector3Make(0, 0, -10); // 把节点的位置固定在(0,0,-11) // 添加节点到场景中去 [self.gameView.scene.rootNode addChildNode...:boxNode]; [self.gameView.scene.rootNode addChildNode:sphereNode]; 运行结果: Scenekit_03.gif 我们给场景中只添加一个环境光...设置灯光颜色 SCNNode *lightNode = [SCNNode node]; lightNode.light = light; [self.gameView.scene.rootNode addChildNode...= SCNVector3Make(0, 10, -100); // 设置光源节点的位置 lightNode.light = light; [self.gameView.scene.rootNode addChildNode...lightNode.position = SCNVector3Make(0, 0, 0); // 设置光源节点的位置 lightNode.light = light; [self.gameView.scene.rootNode addChildNode
= [SCNCamera camera]; cameraNode.position = SCNVector3Make(0, 0, 20); [self.scnView.scene.rootNode addChildNode...lightNode.light = [SCNLight light]; lightNode.light.type = SCNLightTypeDirectional; [self.scnView.scene.rootNode addChildNode...:lightNode]; 第八步 创建文字几何模型 添加到场景中去 self.textNode = [SCNNode node]; [self.scnView.scene.rootNode addChildNode
领取专属 10元无门槛券
手把手带您无忧上云