粒子系统
-
SceneKit 提供的粒子系统:(fire(火),confetti(五彩纸屑),bokeh(散景),rain(雨),Reactor(反应堆),smoke(烟),star(星))
-
看一看各个系统的使用:
-
创建工程,创建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;
}
- 创建摄像头
- (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);
}
- 添加一个四方体:
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];
- 创建一个粒子系统文件
网友评论