这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录 前一修订版 | |||
irrlicht_particle_system [2019/08/02 00:07] cgoxopx 移除 |
— (当前版本) | ||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== Irrlicht Particle System (irrlicht粒子系统)====== | ||
- | ===== 使用流程 ===== | ||
- | auto particles = scene->addParticleSystemSceneNode(false,n);//创建粒子节点 | ||
- | auto emitter = particles->createXXXEmitter(...);//创建发射器 | ||
- | | ||
- | particles->setEmitter(emitter);//设置发射器 | ||
- | | ||
- | particles->setParticlesAreGlobal(false);//粒子不受场景节点运动影响,可选 | ||
- | | ||
- | emitter->drop(); | ||
- | | ||
- | auto delAct=scene->createDeleteAnimator(1000);//添加删除动作,使发射器在指定毫秒后消失,可选 | ||
- | particles->addAnimator(delAct);//应用删除动作 | ||
- | delAct->drop(); | ||
- | ===== setParticlesAreGlobal ===== | ||
- | 文档原文: \\ | ||
- | Sets if the particles should be global. \\ | ||
- | If they are, the particles are affected by the movement of the particle system scene node too, otherwise they completely ignore it. Default is true. \\ | ||
- | 意思就是,设置为true,粒子将受场景节点移动影响 | ||
- | ==== 底层原理(来自于irrlicht源码): ==== | ||
- | if (ParticlesAreGlobal) | ||
- | AbsoluteTransformation.transformVect(Particles[i].pos);//设置为true,节点的绝对矩阵将会乘以粒子的位置 | ||
- | if ( !(behavior & EPB_EMITTER_VECTOR_IGNORE_ROTATION) ) | ||
- | { | ||
- | if (!ParticlesAreGlobal) | ||
- | AbsoluteTransformation.rotateVect(Particles[i].pos); | ||
- | AbsoluteTransformation.rotateVect(Particles[i].startVector); | ||
- | AbsoluteTransformation.rotateVect(Particles[i].vector); | ||
- | } | ||