질문답변

제목연기 애니메이션 객체 및 화재 에니메이션 객체 생성/삭제 안내2024-12-18 02:28
카테고리GeOnDT for JS
작성자

app를 사용하고 있으신 U3dApp 로 바꿔주시면 되겠습니다

 

function createDisasterAtPosition(pos){
    let app = this.core;
    //////////////////////////////////////////////////////////연기생성
    let opt = {
        position: {x: pos.x, y: pos.y, z: pos.z + 100},
        name: 'disaster',
        positionSpread: {x: 10, y: 10, z: 0},

        velocityBase: {x: 50, y: 50, z: 250},
        velocitySpread: {x: 80, y: 120, z: 150},
        accelerationBase: {x: 0, y: 0, z: -10},

        particleImage: GeOnDT.UDefaultSource.SMOKE_PARTICLE_IMAGE,

        angleBase: 0,
        angleSpread: 720,
        angleVelocityBase: 0,
        angleVelocitySpread: 720,

        sizeTween: [[0, 1], [100, 250]],
        opacityTween: [[0.6, 2], [0.4, 0]],

        colorTween: [[0.4, 1], [{x: 0, y: 0, z: 0.2}, '#808080']],

        particlesPerSecond: 50,
        particleDeathAge: 2.0,
        emitterDeathAge: 60,
        speed: 0.1
    }

    let analy = app.getAnalysis('Particle');
    let particle = analy.initialize(opt);
    if(defined(particle)){
        if(defined(particle.particleMesh))
            particle.particleMesh.visible = true;
    }
    analy.active();
    //////////////////////////////////////////////////////////연기종료

    //////////////////////////////////////////////////////////불 생성
    let params = {
        fireWidth: 100,
        fireHeight: 200,
        fireDepth: 100,
        sliceSpacing: 5 + Math.random() * 50
    }

    let url1 = GeOnDT.UDefaultSource.FIRE_NOISE_IMAGE;
    let url2 = GeOnDT.UDefaultSource.FIRE_TEXTURE_IMAGE;
    let fire = app.createFire(pos, params, url1, url2);

    if (defined(fire)) {
        fire.mesh.visible = true;
    }
    //////////////////////////////////////////////////////////불 종료

    //연기 삭제시
    //analy.deactive();
    
    //불 삭제시
    // const index = app._fires.indexOf(fire);
    // if(index > -1){
    //     app._fires.splice(index,1);
    //     app.getScene().remove(fire.mesh);
    //     GeOnDT.UDEF.disposeObject3D(fire.mesh);
    // }
}

mb-file.php?path=2024%2F12%2F18%2FF34_%ED%99%94%EB%A9%B4%20%EC%BA%A1%EC%B2%98%202024-12-13%20162330.png