[SceneKit专题-OC]4.Particle System

2017-09-09  本文已影响0人  严兵胜

说明

2.Particle Systems粒子系统.gif

SCNParticleSystem

粒子系统常用属性:

新建一个粒子系统,xcode自带了7种效果


Snip20170909_3.png

如下的星星效果

Untitled.gif

Emitter attributes发射器属性

Emitter attributes发射器属性

Simulation attributes模拟属性

Image attributes图片属性

Image sequence attributes图片序列属性

Image sequence attributes图片序列属性

Rendering attributes渲染属性

Rendering attributes渲染属性

Physics attributes物理属性

Physics attributes物理属性

Life cycle attributes生命周期属性

Life cycle attributes生命周期属性

/**
 创建粒子
 
 @param color 粒子的颜色
 @param geometry 粒子发射器
 @return
 */
- (SCNParticleSystem *)creatParticleSystemWithColor:(UIColor *)color geometry:(SCNGeometry *)geometry{
    
    
    // 创建粒子 直接使用系统的粒子 具体创建在笔记中有介绍
    SCNParticleSystem *particleSystem = [SCNParticleSystem particleSystemNamed:@"Rain.scnp" inDirectory:nil];
    
    // 设置粒子颜色 保证粒子的颜色与发射器几何体的颜色是一致的
    particleSystem.particleColor = color;
    // 指定发射器的形状 此处将传来的几何体作为粒子的发射器
    particleSystem.emitterShape = geometry;
    
    return particleSystem;
    
}


// 创建一个粒子
    SCNParticleSystem * parrticleSystem = [self creatParticleSystemWithColor:color geometry:geometer];
    //将该粒子 添加到节点上  有时候会发现 粒子未出现在屏幕中  可能的原因之一是 粒子的大小问题(我就遇到了)
    [geometerNode addParticleSystem:parrticleSystem];




上一篇 下一篇

猜你喜欢

热点阅读