Example usage for com.badlogic.gdx.graphics.g3d.particles ParticleEffect translate

List of usage examples for com.badlogic.gdx.graphics.g3d.particles ParticleEffect translate

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.g3d.particles ParticleEffect translate.

Prototype

public void translate(Vector3 translation) 

Source Link

Document

Applies the translation to the current transformation matrix of each controller.

Usage

From source file:com.mygdx.game.scene.GameScene.java

License:Apache License

private GameObject spawnFromBlueprint(GameObjectBlueprint bp) {
    if (bp.pfx != null) {
        ParticleEffect originalEffect = assets.getAsset(bp.pfx, ParticleEffect.class);
        // we cannot use the originalEffect, we must make a copy each time we create new particle effect
        ParticleEffect effect = originalEffect.copy();
        particleEffects.add(effect);/*from w w w .jav a2s.  c o  m*/
        effect.translate(bp.position);
        effect.rotate(Vector3.X, 180);
        effect.init();
        effect.start();
        ParticleSystem particleSystem = ParticleSystem.get();
        particleSystem.add(effect);
        return null;
    }
    if (bp.model != null && bp.shape != null) {

        return spawnGameModelBody(bp, bp.position);

    } else if (bp.model == null && bp.shape != null) {
        InvisibleBody obj = new InvisibleBody(bp.name, bp.shape, bp.mass, bp.position, bp.rotation,
                bp.belongsToFlag, bp.collidesWithFlag, bp.callback, bp.noDeactivate);
        addGameObject(obj);
        return obj;

    } else if (bp.model != null) {
        GameModel obj = new GameModel(bp.model, bp.name, bp.position, bp.rotation, bp.scale);
        obj.visibleOnLayers.clear();
        obj.visibleOnLayers.or(bp.visibleOnLayers);
        addGameObject(obj);
        return obj;
    } else {
        throw new GdxRuntimeException("Could not read blueprint " + bp);
    }
}