当前位置: 首页>>代码示例>>Java>>正文


Java ParticleEmitter.setLocalTranslation方法代码示例

本文整理汇总了Java中com.jme3.effect.ParticleEmitter.setLocalTranslation方法的典型用法代码示例。如果您正苦于以下问题:Java ParticleEmitter.setLocalTranslation方法的具体用法?Java ParticleEmitter.setLocalTranslation怎么用?Java ParticleEmitter.setLocalTranslation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.effect.ParticleEmitter的用法示例。


在下文中一共展示了ParticleEmitter.setLocalTranslation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createFire

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
private void createFire() {
    /** Uses Texture from jme3-test-data library! */
    ParticleEmitter fire = new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 30);
    Material mat_red = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
    mat_red.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/flame.png"));

    fire.setMaterial(mat_red);
    fire.setImagesX(2);
    fire.setImagesY(2); // 2x2 texture animation
    fire.setEndColor(new ColorRGBA(1f, 0f, 0f, 1f));   // red
    fire.setStartColor(new ColorRGBA(1f, 1f, 0f, 0.5f)); // yellow
    fire.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 2, 0));
    fire.setStartSize(10f);
    fire.setEndSize(1f);
    fire.setGravity(0, 0, 0);
    fire.setLowLife(0.5f);
    fire.setHighLife(1.5f);
    fire.getParticleInfluencer().setVelocityVariation(0.3f);
    fire.setLocalTranslation(-350, 40, 430);

    fire.setQueueBucket(Bucket.Transparent);
    rootNode.attachChild(fire);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:24,代码来源:TestPostWater.java

示例2: onEntityUpdated

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
protected void onEntityUpdated(Entity e) {
	ParticleCaster caster = e.get(ParticleCaster.class);
	PlanarStance stance = e.get(PlanarStance.class);

	Point3D pos = stance.getCoord().get3D(stance.getElevation());
	Point3D velocity = Point2D.ORIGIN.getTranslation(stance.getOrientation().getValue(), caster.getInitialSpeed()).get3D(0);

	ParticleEmitter pe = SpatialPool.emitters.get(e.getId());
	if (pe != null) {
		pe.setLocalTranslation(TranslateUtil.toVector3f(pos));
		pe.getParticleInfluencer().setInitialVelocity(TranslateUtil.toVector3f(velocity));

		// the all at once behavior is launched here, because the emitter needs to be well placed before that call.
		if (caster.isAllAtOnce()) {
			pe.emitAllParticles();
		}
	}
}
 
开发者ID:meltzow,项目名称:supernovae,代码行数:20,代码来源:ParticlePlacingProc.java

示例3: explode

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
private void explode() {
    dirt = new ParticleEmitter("Debris", ParticleMesh.Type.Triangle, 200);
    Material debris_mat = new Material(assetManager,
            "Common/MatDefs/Misc/Particle.j3md");
    debris_mat.setTexture("Texture", assetManager.loadTexture(
            "Effects/Explosion/smoketrail.png"));
    dirt.setMaterial(debris_mat);
    rootNode.attachChild(dirt);
    dirt.setParticlesPerSec(0);
    dirt.setImagesX(1);
    dirt.setImagesY(3); // 3x3 texture animation
    dirt.setStartSize(1f);
    dirt.setEndSize(5f);
    dirt.setLowLife(0.4f);
    dirt.setHighLife(0.5f);
    dirt.setLocalTranslation(position);
    dirt.getParticleInfluencer().setInitialVelocity(new Vector3f(10f, 5f, 0));
    dirt.getParticleInfluencer().setVelocityVariation(1f);
    dirt.setGravity(0, -5f, 0);
    
    dirt.emitAllParticles();
}
 
开发者ID:damhonglinh,项目名称:Fruity-Bang,代码行数:23,代码来源:Explosion.java

示例4: exec

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public void exec(World world, int reason) {
    if (reason != RemovalReasons.EXPIRED) {
        return;
    }

    Vector3f worldTranslation = cloud.getParent().getWorldTranslation();

    ParticleEmitter wave = createShockwave();
    world.getWorldRoot().attachChild(wave);
    wave.setLocalTranslation(worldTranslation);
    wave.emitAllParticles();
    wave.addControl(new CTimedExistence(4f));

    AudioNode sound = new AudioNode(Globals.assets,
            "Effects/Sound/IntoTheShadows.wav");
    sound.setPositional(true);
    sound.setReverbEnabled(false);
    sound.setVolume(1f);
    sound.setLocalTranslation(worldTranslation);
    sound.play();
    sound.addControl(new CTimedExistence(4f));
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:24,代码来源:IntoTheShadows.java

示例5: createSmokePuff

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
private void createSmokePuff(Node root, Vector3f location) {
    ParticleEmitter smokePuff = new ParticleEmitter("smoke-puff",
            ParticleMesh.Type.Triangle, 20);
    Material material = new Material(assetManager,
            "Common/MatDefs/Misc/Particle.j3md");
    material.setTexture("Texture",
            assetManager.loadTexture("Effects/flame_alpha.png"));
    material.getAdditionalRenderState()
            .setBlendMode(RenderState.BlendMode.Alpha);
    smokePuff.setMaterial(material);
    smokePuff.setImagesX(2);
    smokePuff.setImagesY(2);
    smokePuff.setSelectRandomImage(true);
    smokePuff.setStartColor(new ColorRGBA(0.5f, 0.5f, 0.5f, 0.2f));
    smokePuff.setStartColor(new ColorRGBA(0.5f, 0.5f, 0.5f, 0.1f));
    smokePuff.getParticleInfluencer()
            .setInitialVelocity(Vector3f.UNIT_X.mult(5f));
    smokePuff.getParticleInfluencer().setVelocityVariation(1f);
    smokePuff.setStartSize(2f);
    smokePuff.setEndSize(6f);
    smokePuff.setGravity(Vector3f.ZERO);
    smokePuff.setLowLife(0.75f);
    smokePuff.setHighLife(1f);
    smokePuff.setParticlesPerSec(0f);
    smokePuff.setRandomAngle(true);
    smokePuff.setShape(new EmitterSphereShape(Vector3f.ZERO, 4f));

    root.attachChild(smokePuff);
    smokePuff.setLocalTranslation(location);
    smokePuff.emitAllParticles();
    smokePuff.addControl(new CTimedExistence(1f));
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:33,代码来源:PelletBuilder.java

示例6: execute

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public EffectHandle execute(Node root, Vector3f loc, String p) {
    float characterRadius = root.getUserData(UserData.RADIUS);
    ParticleEmitter e = FireballBuilder.createFireEmitter();
    e.setStartSize(e.getStartSize() * 0.5f);
    e.setEndSize(e.getEndSize() * 0.5f);
    e.setParticlesPerSec(e.getParticlesPerSec() * 0.5f);
    e.setLocalTranslation(0f, 10f, characterRadius / 1.2f);
    root.attachChild(e);        
    e.addControl(new CTimedExistence(Fireball.CAST_TIME));
    return null;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:13,代码来源:Fireball.java

示例7: createSmokePuff

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
private void createSmokePuff(Node worldRoot, Vector3f worldTranslation) {
    ParticleEmitter smokePuff = new ParticleEmitter("smoke-puff",
            ParticleMesh.Type.Triangle, 20);
    Material materialGray = new Material(Globals.assets,
            "Common/MatDefs/Misc/Particle.j3md");
    materialGray.setTexture("Texture",
            Globals.assets.loadTexture("Effects/flame.png"));
    smokePuff.setMaterial(materialGray);
    smokePuff.setImagesX(2);
    smokePuff.setImagesY(2);
    smokePuff.setSelectRandomImage(true);
    smokePuff.setStartColor(new ColorRGBA(0.5f, 0.5f, 0.5f, 0.2f));
    smokePuff.setStartColor(new ColorRGBA(0.5f, 0.5f, 0.5f, 0.1f));

    smokePuff.getParticleInfluencer()
            .setInitialVelocity(Vector3f.UNIT_X.mult(5.0f));
    smokePuff.getParticleInfluencer().setVelocityVariation(1f);

    smokePuff.setStartSize(2.0f);
    smokePuff.setEndSize(6.0f);
    smokePuff.setGravity(Vector3f.ZERO);
    smokePuff.setLowLife(0.75f);
    smokePuff.setHighLife(1f);
    smokePuff.setParticlesPerSec(0);

    smokePuff.setRandomAngle(true);

    smokePuff.setShape(new EmitterSphereShape(Vector3f.ZERO, 4.0f));
    worldRoot.attachChild(smokePuff);
    smokePuff.setLocalTranslation(worldTranslation);
    smokePuff.emitAllParticles();
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:33,代码来源:Fireball.java

示例8: createSmokePuff

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
private void createSmokePuff(Node worldRoot, Vector3f worldTranslation) {
    ParticleEmitter smokePuff = new ParticleEmitter("smoke-puff",
            ParticleMesh.Type.Triangle, 20);
    Material materialGray = new Material(assets,
            "Common/MatDefs/Misc/Particle.j3md");
    materialGray.setTexture("Texture",
            assets.loadTexture("Effects/flame.png"));
    smokePuff.setMaterial(materialGray);
    smokePuff.setImagesX(2);
    smokePuff.setImagesY(2);
    smokePuff.setSelectRandomImage(true);
    smokePuff.setStartColor(new ColorRGBA(0.5f, 0.5f, 0.5f, 0.2f));
    smokePuff.setStartColor(new ColorRGBA(0.5f, 0.5f, 0.5f, 0.1f));

    smokePuff.getParticleInfluencer()
            .setInitialVelocity(Vector3f.UNIT_X.mult(5.0f));
    smokePuff.getParticleInfluencer().setVelocityVariation(1f);

    smokePuff.setStartSize(2f);
    smokePuff.setEndSize(6f);
    smokePuff.setGravity(Vector3f.ZERO);
    smokePuff.setLowLife(0.75f);
    smokePuff.setHighLife(1f);
    smokePuff.setParticlesPerSec(0);

    smokePuff.setRandomAngle(true);

    smokePuff.setShape(new EmitterSphereShape(Vector3f.ZERO, 4f));
    worldRoot.attachChild(smokePuff);
    smokePuff.setLocalTranslation(worldTranslation);
    smokePuff.emitAllParticles();
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:33,代码来源:MagmaRelease.java

示例9: execute

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public EffectHandle execute(Node root, Vector3f loc, String p) {
    Node weapon = (Node) root.getChild("weapon");
    float antiScale = 1f / weapon.getWorldScale().x;
    ParticleEmitter e = RocketBuilder.createFireEmitter();
    e.setStartSize(e.getStartSize() * 0.33f);
    e.setEndSize(e.getEndSize() * 0.33f);
    weapon.attachChild(e);
    e.setLocalTranslation(0f, 0.7f * antiScale, 4f * antiScale);
    e.addControl(new CTimedExistence(Plasmagun.CAST_TIME));
    return null;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:13,代码来源:RocketLauncher.java

示例10: exec

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public void exec(World world, int reason) {
    Vector3f worldTranslation = fire.getParent().getLocalTranslation();

    Node node = new Node("rocket-explosion");
    world.getWorldRoot().attachChild(node);
    node.setLocalTranslation(worldTranslation);

    leaveSmokeTrail(node);
    createSmokePuff(node);

    fire.removeFromParent();
    node.attachChild(fire);
    node.attachChild(sound);
    fire.setLocalTranslation(Vector3f.ZERO);
    node.addControl(new CTimedExistence(6f));

    fire.setStartColor(new ColorRGBA(0.95f, 0.150f, 0.0f, 0.40f));
    fire.setEndColor(new ColorRGBA(1.0f, 1.0f, 0.0f, 0.0f));
    fire.setLowLife(0.4f);
    fire.setHighLife(0.5f);
    fire.setNumParticles(120);
    fire.setStartSize(7.50f);
    fire.setEndSize(25f);
    fire.getParticleInfluencer()
            .setInitialVelocity(Vector3f.UNIT_X.mult(45.0f));
    fire.getParticleInfluencer().setVelocityVariation(1f);

    fire.emitAllParticles();
    fire.setParticlesPerSec(0.0f);

    ParticleEmitter wave = createShockwave();
    world.getWorldRoot().attachChild(wave);
    wave.setLocalTranslation(worldTranslation);
    wave.emitAllParticles();
    wave.addControl(new CTimedExistence(4f));

    sound.setVolume(5f);
    sound.play();
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:41,代码来源:RocketLauncher.java

示例11: execute

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public EffectHandle execute(Node root, Vector3f loc, String p) {
    Node weapon = (Node) root.getChild("weapon");
    float antiScale = 1f / weapon.getWorldScale().x;
    ParticleEmitter e = PlasmaBuilder.createPlasmaEmitter();
    e.setStartSize(e.getStartSize() * 0.33f);
    e.setEndSize(e.getEndSize() * 0.33f);
    weapon.attachChild(e);
    e.setLocalTranslation(0f, 0.7f * antiScale, 4f * antiScale);
    e.addControl(new CTimedExistence(Plasmagun.CAST_TIME));
    return null;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:13,代码来源:Plasmagun.java

示例12: execute

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public EffectHandle execute(Node root, Vector3f loc, String p) {
    Node weapon = (Node) root.getChild("weapon");
    float antiScale = 1f / weapon.getWorldScale().x;
    ParticleEmitter e = createEmitter();
    weapon.attachChild(e);
    e.setLocalTranslation(0f, 0.7f * antiScale, 4f * antiScale);
    e.emitAllParticles();
    e.addControl(new CTimedExistence(time));
    return null;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:12,代码来源:Railgun.java

示例13: execute

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public EffectHandle execute(Node root, Vector3f location,
        String parameter) {
    CCharacterPhysics phys = root.getControl(CCharacterPhysics.class);
    float height = phys.getCapsuleShape().getHeight();
    Vector3f startLocation = new Vector3f(root.getWorldTranslation())
            .setY(height);
    soundEffect.execute(null, startLocation, null);

    Vector3f vel = phys.getViewDirection().normalize()
            .multLocal(RANGE / 0.3f);

    final ParticleEmitter emitter = createWave(vel);
    emitter.setLocalTranslation(startLocation);
    root.getParent().attachChild(emitter);

    CActionQueue actionQueue = new CActionQueue();
    emitter.addControl(actionQueue);
    actionQueue.enqueueAction(new ADelay(0.2f));
    actionQueue.enqueueAction(new EntityAction() {

        @Override
        public boolean update(float tpf) {
            emitter.setParticlesPerSec(0f);
            float timeToExist = emitter.getLowLife();
            emitter.addControl(new CTimedExistence(timeToExist));

            return false;
        }
    });

    return null;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:34,代码来源:FeralScream.java

示例14: addToCharacter

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
public void addToCharacter(BuffInfoParameters params) {
        ClientBlind blind = Globals.app.getStateManager()
                .getState(ClientBlind.class);
        blind.addBlindIfSelf(this, params);
        entityId = params.buffControl.getSpatial()
                .getUserData(UserData.ENTITY_ID);

        Sphere sphere = new Sphere(8, 8, 0.7f);
        Geometry geom = new Geometry("sphere", sphere);

        centralNode = new Node("blind-node");

        ParticleEmitter emitter = createEmitter();
        centralNode.attachChild(emitter);
//        centralNode.attachChild(geom);

        emitter.setLocalTranslation(-2.5f, 0f, 0f);
        
        geom.setLocalTranslation(-2.5f, 0f, 0f);

        Node characterNode = (Node) params.buffControl.getSpatial();

        characterNode.attachChild(centralNode);

        centralNode.setLocalTranslation(0f, 20f, 0f);
        centralNode.addControl(new CRotation(0f, 12f, 0f));
    }
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:28,代码来源:BlindEffect.java

示例15: execute

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public EffectHandle execute(Node root, Vector3f location, String p) {
    SimpleSoundEffect earthQuake =
            new SimpleSoundEffect("Effects/Sound/EarthQuake.wav");
    earthQuake.setVolume(1.5f);
    earthQuake.execute(root, location, null);

    ParticleEmitter emitter = createParticleEffect();
    root.attachChild(emitter);
    emitter.setLocalTranslation(location);
    emitter.emitAllParticles();
    emitter.addControl(new CTimedExistence(14f));
    return null;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:15,代码来源:EarthQuakeEffect.java


注:本文中的com.jme3.effect.ParticleEmitter.setLocalTranslation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。