[]求ShuriKenParticle3D用法


module App {
    import ShuriKenParticle3D       = Laya.ShuriKenParticle3D;
    import ShurikenParticleMaterial = Laya.ShurikenParticleMaterial;
    import Vector2                  = Laya.Vector2;
    import Vector3                  = Laya.Vector3;
    import Vector4                  = Laya.Vector4;
    import Particle3D               = Laya.Particle3D;
    import TextureSheetAnimation    = Laya.TextureSheetAnimation;
    import FrameOverTime            = Laya.FrameOverTime;
    import StartFrame               = Laya.StartFrame;
    import GradientDataInt          = Laya.GradientDataInt;
    import StandardMaterial         = Laya.StandardMaterial;
    import Emission                 = Laya.Emission;
    import Burst                    = Laya.Burst;

    export class JinBi extends ShuriKenParticle3D {
        constructor() {
            let material = ShurikenParticleMaterial.load("resources/Assets/ArtResources/Effects/Materials/Effect_yu_jinbi_xulie.lmat");
            super(material);
            {
                let s = this.particleSystem;
                s.isPerformanceMode = true;
                s.duration = 20;
                s.looping = true;
                s.prewarm = false;
                s.startDelayType = 0;
                s.startDelay = 0;
                s.startLifetimeType = 0;
                s.startLifetimeConstant = 2;
                s.startSpeedType = 0;
                s.startSpeedConstant = 0;
                s.threeDStartSize = false;
                s.startSizeType = 0;
                s.startSizeConstant = 1;
                s.startSizeConstantSeparate = new Vector3(1,1,1);
                s.threeDStartRotation = false;
                s.startRotationType = 0;
                s.startRotationConstant = 360.1826;
                s.startRotationConstantSeparate = new Vector3(0,0,360.1826);
                s.startRotationConstantMinSeparate = Vector3.ZERO;
                s.startRotationConstantMaxSeparate = new Vector3(0,0,360.1826);
                s.randomizeRotationDirection = 0;
                s.startColorType = 0;
                s.startColorConstant = new Vector4(1,1,1,1);
                s.gravity = new Vector3(0,-9.8,0);
                s.gravityModifier = 0;
                s.simulationSpace = 0;
                s.scaleMode = 0;
                s.playOnAwake = true;
                s.maxParticles = 1000;
                s.autoRandomSeed = true;

                {
                    let emission = new Emission();
                    emission.addBurst(new Burst(0, 1, 1));
                    emission.emissionRate = 10;
                    emission.enbale = true;
                    s.emission = emission;
                }

                // textureSheetAnimation
                {
                    let gradient = new GradientDataInt();
                    gradient.add(0, 0);
                    gradient.add(1, 8.9991);
                    let frame = FrameOverTime.createByOverTime(gradient);
                    frame.constant = 0;
                    frame.constantMin = 0;
                    frame.constantMax = 8.9991;
                    frame.frameOverTimeDataMin = new GradientDataInt();
                    frame.frameOverTimeDataMax = gradient;
                    let startFrame = StartFrame.createByConstant(0);
                    let ani = new TextureSheetAnimation(frame, startFrame);
                    ani.enbale = true;
                    ani.tiles = new Vector2(3,3);
                    ani.type = 0;
                    ani.randomRow = true;
                    ani.cycles = 1;
                    ani.enableUVChannels = 1;
                    s.textureSheetAnimation = ani;
                }

                {
                    let render = this.particleRender;
                    render.enable = true;
                    render.renderMode = 0;  // BILLBOARD
                    render.stretchedBillboardCameraSpeedScale = 0;
                    render.stretchedBillboardSpeedScale = 0;
                    render.stretchedBillboardLengthScale = 2;
                    render.sortingFudge = 0;

                    render.material = material;
                }

                let self = this;
                Laya.timer.loop(300, null, function () {
                    console.log('8: ' + self.particleSystem.aliveParticleCount);
                });
            }
        }
    }
}

执行结果一直为0, 请问这是什么问题? 是否有更详细一些的例子?

环境:
1. layabox 1.7.6 beta / layabox 1.7.5
2. windows 7 64位
 
2.png 1.png
已邀请:

183*****755

赞同来自:

这个在unity中做好,直接导出就好,不需要自己设置属性的。
参考下这个:http://ask.layabox.com/question/1654
 

183*****755

赞同来自:

先看下控制台有错没,在参考下官方粒子示例,如果还有问题,把unity中的粒子资源打成unitypackage发我

要回复问题请先

商务合作
商务合作