SceneKit 学习(5) -- 粒子系统

粒子系统

  1. SceneKit 提供的粒子系统:(fire(火),confetti(五彩纸屑),bokeh(散景),rain(雨),Reactor(反应堆),smoke(烟),star(星))

  2. 看一看各个系统的使用:

  3. 创建工程,创建SCNView

- (void)makescnview{
SCNView *scnview = [[SCNView alloc] initWithFrame:self.view.bounds];
scnview.allowsCameraControl = YES;
scnview.showsStatistics = YES;
_scnview = scnview;
[self.view addSubview:scnview];
SCNScene *scene = [SCNScene scene];
scnview.scene = scene;
}
  1. 创建摄像头
- (void)makeCamera{
SCNNode *node = [SCNNode node];
[self.scnview.scene.rootNode addChildNode:node];
SCNCamera *camera = [SCNCamera camera];
node.camera = camera;
node.position = SCNVector3Make(0, 0, 5);
}
  1. 添加一个四方体:
SCNBox *box1 = [SCNBox boxWithWidth:2 height:2 length:2 chamferRadius:0];
box1.firstMaterial.diffuse.contents = [UIImage imageNamed:@"1.PNG"];
SCNNode *box1Node = [SCNNode node];
box1Node.name = @"box1";
box1Node.geometry = box1;
box1Node.position = SCNVector3Make(0, 0, -10);
[self.scnview.scene.rootNode addChildNode:box1Node];
  1. 创建一个粒子系统文件

你可能感兴趣的:(SceneKit 学习(5) -- 粒子系统)