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


Java GhostControl.setCollideWithGroups方法代码示例

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


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

示例1: setSpatial

import com.jme3.bullet.control.GhostControl; //导入方法依赖的package包/类
@Override
public void setSpatial(Spatial spatial) {
    super.setSpatial(spatial);
    CCharacterPhysics physics =
            spatial.getControl(CCharacterPhysics.class);
    ghost = new GhostControl(physics.getCapsuleShape());
    ghost.setCollisionGroup(CollisionGroups.NONE);
    ghost.setCollideWithGroups(CollisionGroups.CHARACTERS
            | CollisionGroups.WALLS | CollisionGroups.SPIRIT_STONE);

    ghostNode = new Node("Ghost Node");
    ((Node) spatial).attachChild(ghostNode);
    ghostNode.addControl(ghost);
    ghost.setUserObject(spatial);

    physics.getPhysicsSpace().add(ghost);
    physics.getPhysicsSpace().addCollisionListener(this);
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:19,代码来源:ACharge.java

示例2: start

import com.jme3.bullet.control.GhostControl; //导入方法依赖的package包/类
private void start() {
    CCharacterPhysics physics = spatial.getControl(CCharacterPhysics.class);
    CapsuleCollisionShape shape = physics.getCapsuleShape();
    shape.setScale(new Vector3f(1.5f, 1f, 1.5f));
    ghost = new GhostControl(shape);
    ghost.setCollisionGroup(CollisionGroups.NONE);
    ghost.setCollideWithGroups(CollisionGroups.CHARACTERS
            | CollisionGroups.WALLS | CollisionGroups.SPIRIT_STONE);
    ghostNode = new Node("Ghost Node");
    ((Node) spatial).attachChild(ghostNode);
    ghostNode.addControl(ghost);
    ghost.setUserObject(spatial);
    physics.getPhysicsSpace().add(ghost);
    physics.getPhysicsSpace().addCollisionListener(this);
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:16,代码来源:CMovementForcer.java

示例3: build

import com.jme3.bullet.control.GhostControl; //导入方法依赖的package包/类
@Override
public Node build(BuildParameters params) {
    Node node
            = (Node) assets.loadModel("Models/DamagingDagger.j3o");
    node.setLocalTranslation(params.location);

    node.setUserData(UserData.SPEED, 170f);
    node.setUserData(UserData.MASS, 30f);
    node.setUserData(UserData.DAMAGE, 150f);
    node.setUserData(UserData.IMPULSE_FACTOR, 0f);

    SphereCollisionShape collisionShape = new SphereCollisionShape(4);

    GhostControl characterCollision = new GhostControl(collisionShape);
    characterCollision.setCollideWithGroups(CollisionGroups.CHARACTERS);
    characterCollision.setCollisionGroup(CollisionGroups.PROJECTILES);
    node.addControl(characterCollision);

    RigidBodyControl physicsBody = new RigidBodyControl(collisionShape,
            (float) node.getUserData(UserData.MASS));
    physicsBody.setCollisionGroup(CollisionGroups.PROJECTILES);
    physicsBody.removeCollideWithGroup(CollisionGroups.PROJECTILES);
    node.addControl(physicsBody);

    node.addControl(new CProjectile());
    CSpellBuff buffControl = new CSpellBuff();
    if (primary) {
        buffControl.addBuff(new SlowCC.MyBuilder(6f, 0.33f));
    } else {
        buffControl.addBuff(new CastSpeedBuff.MyBuilder(6f, -0.50f));
    }
    node.addControl(buffControl);

    return node;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:36,代码来源:DaggerBuilder.java

示例4: build

import com.jme3.bullet.control.GhostControl; //导入方法依赖的package包/类
@Override
public Node build(BuildParameters params) {
    Node node = (Node) assets.loadModel("Models/Spear.j3o");
    node.getChild(0).scale(3f);
    node.setLocalTranslation(params.location);

    node.setUserData(UserData.SPEED, 140f);
    node.setUserData(UserData.MASS, 30f);
    node.setUserData(UserData.DAMAGE, 200f);
    node.setUserData(UserData.IMPULSE_FACTOR, 0f);
    
    CollisionShape collisionShape = 
            CollisionShapeFactory.createBoxShape(node);
    RigidBodyControl physicsBody = new RigidBodyControl(collisionShape,
            (float) node.getUserData(UserData.MASS));

    physicsBody.setCollisionGroup(CollisionGroups.PROJECTILES);
    physicsBody.removeCollideWithGroup(CollisionGroups.PROJECTILES);

    physicsBody.addCollideWithGroup(CollisionGroups.WALLS);

    GhostControl characterCollision = new GhostControl(collisionShape);
    characterCollision.setCollideWithGroups(CollisionGroups.CHARACTERS);
    characterCollision.setCollisionGroup(CollisionGroups.PROJECTILES);
    node.addControl(characterCollision);
    
    node.addControl(physicsBody);

    node.addControl(new CProjectile());
    CSpellBuff buffControl = new CSpellBuff();
    node.addControl(buffControl);
    buffControl.addBuff(new SpeedBleedBuff.MyBuilder(4.2f));

    node.addControl(new CSpear());

    return node;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:38,代码来源:VoidSpear.java

示例5: build

import com.jme3.bullet.control.GhostControl; //导入方法依赖的package包/类
@Override
public Node build(BuildParameters params) {
    Sphere sphere = new Sphere(8, 8, 0.3f);

    Geometry projectileGeom = new Geometry("projectile-geom", sphere);
    Node node = new Node("projectile");
    node.setLocalTranslation(params.location);
    node.attachChild(projectileGeom);
    Material material = new Material(assets,
            "Common/MatDefs/Misc/Unshaded.j3md");
    material.setColor("Color", ColorRGBA.Yellow);
    node.setMaterial(material);
    node.setUserData(UserData.SPEED, 220f);
    node.setUserData(UserData.MASS, 0.30f);
    node.setUserData(UserData.DAMAGE, damage);
    node.setUserData(UserData.IMPULSE_FACTOR, 0f);
    if (world.isClient()) {
        node.addControl(new CEntityEvent());
        /**
         * Here we specify what happens on client side when pellet is
         * removed. In this case we want explosion effect.
         */
        APelletRemoval removalAction =
                new APelletRemoval(assets);
        removalAction.setPellet(node);
        node.getControl(CEntityEvent.class)
                .setOnRemoval(removalAction);
    }
    SphereCollisionShape collisionShape = new SphereCollisionShape(1.7f);
    RigidBodyControl physicsBody = new RigidBodyControl(collisionShape,
            (float) node.getUserData(UserData.MASS));       
    /**
     * We don't want projectiles to collide with each other so we give them
     * their own collision group and prevent them from colliding with that
     * group.
     */
    physicsBody.setCollisionGroup(CollisionGroups.NONE);
    physicsBody.setCollideWithGroups(CollisionGroups.NONE);
    /**
     * Add collision with characters
     */
    GhostControl collision = new GhostControl(collisionShape);
    collision.setCollisionGroup(CollisionGroups.PROJECTILES);
    collision.setCollideWithGroups(CollisionGroups.CHARACTERS);
    node.addControl(collision);
    node.addControl(physicsBody);
    node.addControl(new CProjectile());
    CSpellBuff buffControl = new CSpellBuff();
    node.addControl(buffControl);
    return node;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:52,代码来源:PelletBuilder.java

示例6: build

import com.jme3.bullet.control.GhostControl; //导入方法依赖的package包/类
@Override
public Node build(BuildParameters params) {
    Node node = (Node) assets.loadModel("Models/SealingBoulder.j3o");
    node.setLocalTranslation(params.location);

    node.setUserData(UserData.SPEED, 145f);
    node.setUserData(UserData.MASS, 10f);
    node.setUserData(UserData.DAMAGE, 120f);
    node.setUserData(UserData.IMPULSE_FACTOR, 0f);
    node.setUserData(UserData.INCAPACITATE_LENGTH, 7.4f);

    if (world.isClient()) {
        AudioNode sound = new AudioNode(assets,
                "Effects/Sound/MagmaBash.wav");
        node.attachChild(sound);
        sound.setPositional(true);
        sound.setReverbEnabled(false);
        sound.setVolume(1f);
        sound.play();
    }

    SphereCollisionShape collisionShape = new SphereCollisionShape(4);
    
    GhostControl characterCollision = new GhostControl(collisionShape);
    characterCollision.setCollideWithGroups(CollisionGroups.CHARACTERS);
    characterCollision.setCollisionGroup(CollisionGroups.PROJECTILES);
    node.addControl(characterCollision);
    
    RigidBodyControl physicsBody = new RigidBodyControl(collisionShape,
            (float) node.getUserData(UserData.MASS));
    physicsBody.setCollisionGroup(CollisionGroups.PROJECTILES);
    physicsBody.removeCollideWithGroup(CollisionGroups.PROJECTILES);
    node.addControl(physicsBody);

    node.addControl(new CProjectile());
    CSpellBuff buffControl = new CSpellBuff();
    node.addControl(buffControl);
    buffControl.addBuff(new PetrifyCC.MyBuilder(1.9f));

    node.getControl(RigidBodyControl.class).setGravity(Vector3f.ZERO);
    return node;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:43,代码来源:SealingBoulder.java

示例7: build

import com.jme3.bullet.control.GhostControl; //导入方法依赖的package包/类
@Override
public Node build(final BuildParameters params) {
    final Node node = (Node) assets.loadModel("Models/Circle.j3o");
    node.setLocalTranslation(params.location);

    for (Spatial child : node.getChildren()) {
        child.setCullHint(Spatial.CullHint.Always);
    }

    final float radius = 15f;
    node.scale(radius, 1f, radius);

    Material mat = new Material(assets,
            "Common/MatDefs/Misc/Unshaded.j3md");

    mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
    mat.setColor("Color", ColorRGBA.BlackNoAlpha);
    node.setMaterial(mat);
    CActionQueue actionQueue = new CActionQueue();
    node.addControl(actionQueue);

    float delay = Math.max(0.8f - params.age, 0f);
    actionQueue.enqueueAction(new ADelay(delay));

    final float remainTime = 1f;

    if (world.isServer()) {
        node.addControl(new CCircleVisibility(radius));

        GhostControl ghost = new GhostControl(new CylinderCollisionShape(
                new Vector3f(radius, 0.05f, radius), 1));
        ghost.setCollideWithGroups(CollisionGroups.CHARACTERS);
        node.addControl(ghost);

        CAreaEffect cAreaEffect = new CAreaEffect(ghost);
        node.addControl(cAreaEffect);

        actionQueue.enqueueAction(new AFinish(cAreaEffect, node,
                remainTime));
    } else if (world.isClient()) {
        ParticleEmitter black = createBlack(radius / 15f, delay);
        node.attachChild(black);
        black.setLocalTranslation(0f, 1f, 0f);
        black.emitAllParticles();

        actionQueue.enqueueAction(new EntityAction() {
            @Override
            public boolean update(float tpf) {
                Vector3f worldTranslation = spatial.getWorldTranslation();

                final ParticleEmitter purple = createPurple(radius, remainTime);
                world.getWorldRoot().attachChild(purple);
                purple.setLocalTranslation(worldTranslation);
                purple.move(0f, 1f, 0f);
                purple.addControl(new CTimedExistence(5f));
                purple.emitAllParticles();

                final ParticleEmitter white = createWhite(radius, remainTime);
                world.getWorldRoot().attachChild(white);
                white.setLocalTranslation(worldTranslation);
                white.move(0f, 1f, 0f);
                white.addControl(new CTimedExistence(5f));
                white.emitAllParticles();
                
                AudioNode sound = new AudioNode(assets,
                        "Effects/Sound/MindPoison.wav");
                ((Node) spatial).attachChild(sound);
                sound.setPositional(true);
                sound.setReverbEnabled(false);
                sound.setVolume(2f);
                sound.play();

                return false;
            }
        });
    }

    return node;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:80,代码来源:MindPoison.java

示例8: build

import com.jme3.bullet.control.GhostControl; //导入方法依赖的package包/类
@Override
public Node build(BuildParameters params) {
    Sphere sphere = new Sphere(32, 32, 1.0f);

    Geometry projectileGeom = new Geometry("projectile-geom", sphere);
    projectileGeom.setCullHint(Spatial.CullHint.Always);

    Node node = new Node("projectile");
    node.setLocalTranslation(params.location);
    node.attachChild(projectileGeom);

    // TODO: Give at least bit better material
    Material material = new Material(assets,
            "Common/MatDefs/Misc/Unshaded.j3md");
    material.setColor("Color", ColorRGBA.Yellow);
    node.setMaterial(material);

    node.setUserData(UserData.SPEED, 140f);
    node.setUserData(UserData.MASS, 0.30f);
    node.setUserData(UserData.DAMAGE, 170f);
    node.setUserData(UserData.IMPULSE_FACTOR, 0f);

    if (world.isClient()) {
        ParticleEmitter fire = createFireEmitter();
        node.attachChild(fire);

        ParticleEmitter smoke = createSmokeEmitter();
        node.attachChild(smoke);

        node.addControl(new CEntityEvent());
        /**
         * Here we specify what happens on client side when fireball is
         * removed. In this case we want explosion effect.
         */
        AFireballRemoval removalAction = new AFireballRemoval();
        removalAction.setFireEmitter(fire);
        removalAction.setSmokeTrail(smoke);

        node.getControl(CEntityEvent.class)
                .setOnRemoval(removalAction);
    }

    SphereCollisionShape collisionShape = new SphereCollisionShape(3);
    RigidBodyControl physicsBody = new RigidBodyControl(collisionShape,
            (float) node.getUserData(UserData.MASS));
    /**
     * We don't want projectiles to collide with each other so we give them
     * their own collision group and prevent them from colliding with that
     * group.
     */
    physicsBody.setCollisionGroup(CollisionGroups.PROJECTILES);
    physicsBody.removeCollideWithGroup(CollisionGroups.PROJECTILES);

    /**
     * Add collision group of characters
     */
    GhostControl characterCollision = new GhostControl(collisionShape);
    characterCollision.setCollideWithGroups(CollisionGroups.CHARACTERS);
    characterCollision.setCollisionGroup(CollisionGroups.PROJECTILES);
    node.addControl(characterCollision);

    node.addControl(physicsBody);

    node.addControl(new CProjectile());
    CSpellBuff buffControl = new CSpellBuff();
    node.addControl(buffControl);

    return node;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:70,代码来源:Fireball.java

示例9: build

import com.jme3.bullet.control.GhostControl; //导入方法依赖的package包/类
@Override
public Node build(BuildParameters params) {
    Sphere sphere = new Sphere(32, 32, 1f);

    Geometry projectileGeom = new Geometry("projectile-geom", sphere);
    projectileGeom.setCullHint(Spatial.CullHint.Always);

    Node node = new Node("projectile");
    node.setLocalTranslation(params.location);
    node.attachChild(projectileGeom);

    // TODO: Give at least bit better material
    Material m = new Material(assets, "Common/MatDefs/Misc/Unshaded.j3md");
    m.setColor("Color", ColorRGBA.Yellow);
    node.setMaterial(m);

    node.setUserData(UserData.SPEED, 180f);
    node.setUserData(UserData.MASS, 10f);
    node.setUserData(UserData.DAMAGE, 220f);
    node.setUserData(UserData.IMPULSE_FACTOR, 25000f);                

    if (world.isClient()) {
        ParticleEmitter fire = createFireEmitter();
        node.attachChild(fire);

        ParticleEmitter smoke = createSmokeEmitter();
        node.attachChild(smoke);

        node.addControl(new CEntityEvent());
        /**
         * Here we specify what happens on client side when fireball is
         * removed. In this case we want explosion effect.
         */
        AFireballRemoval removalAction = new AFireballRemoval();
        removalAction.setFireEmitter(fire);
        removalAction.setSmokeTrail(smoke);

        node.getControl(CEntityEvent.class)
                .setOnRemoval(removalAction);
    }

    SphereCollisionShape collisionShape = new SphereCollisionShape(3);
    RigidBodyControl physicsBody = new RigidBodyControl(collisionShape,
            (float) node.getUserData(UserData.MASS));
    /**
     * We don't want projectiles to collide with each other so we give them
     * their own collision group and prevent them from colliding with that
     * group.
     */
    physicsBody.setCollisionGroup(CollisionGroups.PROJECTILES);
    physicsBody.removeCollideWithGroup(CollisionGroups.PROJECTILES);

    /**
     * Add collision group of characters
     */
    GhostControl characterCollision = new GhostControl(collisionShape);
    characterCollision.setCollideWithGroups(CollisionGroups.CHARACTERS);
    characterCollision.setCollisionGroup(CollisionGroups.PROJECTILES);
    node.addControl(characterCollision);

    node.addControl(physicsBody);

    node.addControl(new CProjectile());
    CSpellBuff buffControl = new CSpellBuff();
    node.addControl(buffControl);
    buffControl.addBuff(new MagmaReleaseBuff.MyBuilder(999999f));

    return node;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:70,代码来源:MagmaRelease.java

示例10: create

import com.jme3.bullet.control.GhostControl; //导入方法依赖的package包/类
public static PurifyingFlame create() {
    final float range = 200f; // TODO: Does this make sense?
    final float castTime = 0f;

    final PurifyingFlame spell = new PurifyingFlame("Purifying Flame",
            COOLDOWN, range, castTime);

    spell.castSpellActionBuilder = (Node caster, Vector3f vec) -> {
        // TODO: Get this from BuffInformation
        float duration = 3f;
        ACastSelfBuff action = new ACastSelfBuff();
        Node aoeContainer = new Node("purifying-flame");
        
        if (world.isServer()) {
            int playerId = caster.getUserData(UserData.PLAYER_ID);
            aoeContainer.setUserData(UserData.PLAYER_ID, playerId);
            
            int teamId = caster.getUserData(UserData.TEAM_ID);
            aoeContainer.setUserData(UserData.TEAM_ID, teamId);
            
            GhostControl ghost =
                    new GhostControl(new SphereCollisionShape(8f));
            ghost.setCollisionGroup(CollisionGroups.CHARACTERS);
            ghost.setCollideWithGroups(CollisionGroups.CHARACTERS);
            aoeContainer.addControl(ghost);
            
            CAreaEffect areaEffectControl = new CAreaEffect(ghost);
            areaEffectControl.setOwnerInterface(caster
                    .getControl(CInfluenceInterface.class));
            AbstractBuffBuilder ignite = Ignite
                    .ifNotCooldownCreateDamageOverTimeBuff(caster);
            
            if (ignite != null) {
                areaEffectControl.addEnterBuff(ignite);
            }
            
            float baseDps = 100f;
            float damageFactor =
                    caster.getUserData(UserData.DAMAGE_FACTOR);
            float dps = baseDps * damageFactor;
            DamageOverTimeInfluence damageOverTime =
                    new DamageOverTimeInfluence(dps);
            damageOverTime.setBreaksCrowdControl(false);
            areaEffectControl.addInfluence(damageOverTime);
            
            CInfluenceInterface casterInfluenceInterface =
                    caster.getControl(CInfluenceInterface.class);
            areaEffectControl
                    .setOwnerInterface(casterInfluenceInterface);
            
            aoeContainer.addControl(areaEffectControl);
            
            action.addBuff(new AbsorbingShieldBuff.MyBuilder(duration));
        }
        
        aoeContainer.setLocalTranslation(0f, 0f, 0f);
        CTimedExistence timedExistence = new CTimedExistence(duration);
        aoeContainer.addControl(timedExistence);
        
        PhysicsSpace physicsSpace = caster.getControl(
                CCharacterPhysics.class).getPhysicsSpace();
        
        timedExistence.setSpace(physicsSpace);
        
        caster.attachChild(aoeContainer);
        PhysicsWorkaround.addAll(physicsSpace, aoeContainer);
        
        return action;
    };

    return spell;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:73,代码来源:PurifyingFlame.java

示例11: build

import com.jme3.bullet.control.GhostControl; //导入方法依赖的package包/类
@Override
public Node build(BuildParameters params) {
    Sphere sphere = new Sphere(16, 16, 0.2f);
    Geometry projectileGeom = new Geometry("geom", sphere);
    Node node = new Node("cloud");
    node.setLocalTranslation(params.location);
    node.attachChild(projectileGeom);

    node.addControl(new CSyncInterpolation());
    // TODO: Give at least bit better material
    Material material = new Material(assets,
            "Common/MatDefs/Misc/Unshaded.j3md");
    material.setColor("Color", ColorRGBA.Black);
    node.setMaterial(material);

    node.setUserData(UserData.SPEED, 0f);
    node.setUserData(UserData.MASS, 0f);
    node.setUserData(UserData.DAMAGE, 50f);
    node.setUserData(UserData.IMPULSE_FACTOR, 26000f);

    CSpellBuff buffControl = new CSpellBuff();
    node.addControl(buffControl);

    node.addControl(new CGenericSync());

    CActionQueue actionQueue = new CActionQueue();
    node.addControl(actionQueue);

    if (world.isServer()) {
        SphereCollisionShape collisionShape
                = new SphereCollisionShape(8f);

        GhostControl ghost = new GhostControl(collisionShape);
        ghost.setCollisionGroup(CollisionGroups.NONE);
        ghost.setCollideWithGroups(CollisionGroups.CHARACTERS);
    }
    if (world.isClient()) {
        ParticleEmitter cloud = createCloudEmitter();
        node.attachChild(cloud);

        CEntityEvent cEvent = new CEntityEvent();
        node.addControl(cEvent);
        cEvent.setOnRemoval(new CloudRemoval().setCloud(cloud));
    }
    return node;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:47,代码来源:IntoTheShadows.java

示例12: build

import com.jme3.bullet.control.GhostControl; //导入方法依赖的package包/类
@Override
public Node build(BuildParameters params) {
    Sphere sphere = new Sphere(32, 32, 1.0f);
    Geometry projectileGeom = new Geometry("projectile-geom", sphere);
    Node node = new Node("projectile");
    node.setLocalTranslation(params.location);
    node.attachChild(projectileGeom);

    // TODO: Give at least bit better material
    Material material = new Material(assets,
            "Common/MatDefs/Misc/Unshaded.j3md");
    material.setColor("Color", ColorRGBA.Black);
    node.setMaterial(material);
    node.setUserData(UserData.SPEED, 180f);
    node.setUserData(UserData.MASS, 10f);
    node.setUserData(UserData.DAMAGE, 80f);
    node.setUserData(UserData.IMPULSE_FACTOR, 0f);
    node.setUserData(UserData.INCAPACITATE_LENGTH, 7.4f);

    if (world.isClient()) {
        ParticleEmitter fire = new ParticleEmitter("fire-emitter",
                ParticleMesh.Type.Triangle, 80);
        Material materialRed = new Material(assets,
                "Common/MatDefs/Misc/Particle.j3md");
        materialRed.setTexture("Texture",
                assets.loadTexture("Effects/flame.png"));
        fire.setMaterial(materialRed);
        fire.setImagesX(2);
        fire.setImagesY(2);
        fire.setSelectRandomImage(true);
        fire.setStartColor(new ColorRGBA(0.95f, 0.850f, 0.0f, 1.0f));
        fire.setEndColor(new ColorRGBA(1.0f, 1.0f, 0.80f, 0.5f));
        fire.getParticleInfluencer().setInitialVelocity(Vector3f.ZERO);
        fire.setStartSize(1.5f);
        fire.setEndSize(0.5f);
        fire.setGravity(Vector3f.ZERO);
        fire.setLowLife(0.1f);
        fire.setHighLife(0.1f);
        fire.setParticlesPerSec(250);
        fire.getParticleInfluencer().setVelocityVariation(0.2f);
        fire.setRandomAngle(true);
        node.attachChild(fire);

        AudioNode sound = new AudioNode(assets,
                "Effects/Sound/MagmaBash.wav");
        node.attachChild(sound);
        sound.setPositional(true);
        sound.setReverbEnabled(false);
        sound.setVolume(1f);
        sound.play();
    }

    SphereCollisionShape collisionShape = new SphereCollisionShape(3);

    GhostControl characterCollision = new GhostControl(collisionShape);
    characterCollision.setCollideWithGroups(CollisionGroups.CHARACTERS);
    characterCollision.setCollisionGroup(CollisionGroups.PROJECTILES);
    node.addControl(characterCollision);
    
    RigidBodyControl physicsBody = new RigidBodyControl(collisionShape,
            (float) node.getUserData(UserData.MASS));
    physicsBody.setCollisionGroup(CollisionGroups.PROJECTILES);
    physicsBody.removeCollideWithGroup(CollisionGroups.PROJECTILES);
    
    node.addControl(physicsBody);

    node.addControl(new CProjectile());
    CSpellBuff buffControl = new CSpellBuff();
    node.addControl(buffControl);
    buffControl.addBuff(new IncapacitateCC.MyBuilder(1.6f));

    node.getControl(RigidBodyControl.class).setGravity(Vector3f.ZERO);
    return node;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:75,代码来源:MagmaBash.java

示例13: build

import com.jme3.bullet.control.GhostControl; //导入方法依赖的package包/类
@Override
public Node build(BuildParameters params) {
    Sphere sphere = new Sphere(32, 32, 0.5f);

    Geometry projectileGeom = new Geometry("rail-geom", sphere);

    Node node = new Node("rail");
    node.setLocalTranslation(params.location);
    node.attachChild(projectileGeom);

    // TODO: Give at least bit better material
    Material m = new Material(assets, "Common/MatDefs/Misc/Unshaded.j3md");
    m.setColor("Color", ColorRGBA.Cyan);
    node.setMaterial(m);

    node.setUserData(UserData.SPEED, 200f);
    node.setUserData(UserData.MASS, 0.30f);
    node.setUserData(UserData.DAMAGE, 150f);
    node.setUserData(UserData.IMPULSE_FACTOR, 0f);

    if (world.isClient()) {
        ParticleEmitter smoke = createTrailEmitter();
        node.attachChild(smoke);

        node.addControl(new CEntityEvent());
        /**
         * Here we specify what happens on client side when fireball is
         * removed. In this case we want explosion effect.
         */
        ARailgunRemoval removalAction = new ARailgunRemoval();
        removalAction.setBullet(node);
        removalAction.setSmokeTrail(smoke);

        node.getControl(CEntityEvent.class).setOnRemoval(removalAction);
        node.addControl(new RailgunBuilder.CParticleDirector(smoke));
    }

    SphereCollisionShape collisionShape = new SphereCollisionShape(2.5f);
    RigidBodyControl physicsBody = new RigidBodyControl(collisionShape,
            (float) node.getUserData(UserData.MASS));
    /**
     * We don't want projectiles to collide with each other so we give them
     * their own collision group and prevent them from colliding with that
     * group.
     */
    physicsBody.setCollisionGroup(CollisionGroups.PROJECTILES);
    physicsBody.removeCollideWithGroup(CollisionGroups.PROJECTILES);

    /**
     * Add collision group of characters
     */
    GhostControl characterCollision = new GhostControl(collisionShape);
    characterCollision.setCollideWithGroups(CollisionGroups.CHARACTERS);
    characterCollision.setCollisionGroup(CollisionGroups.PROJECTILES);
    node.addControl(characterCollision);

    node.addControl(physicsBody);
    CProjectile projectileControl = new CProjectile();
    projectileControl.setIsProjectile(false);
    node.addControl(projectileControl);
    CSpellBuff buffControl = new CSpellBuff();
    node.addControl(buffControl);
    buffControl.addBuff(new BlindCC.MyBuilder(3f));

    return node;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:67,代码来源:BlindingRay.java

示例14: build

import com.jme3.bullet.control.GhostControl; //导入方法依赖的package包/类
@Override
public Node build(BuildParameters params) {
    Sphere sphere = new Sphere(32, 32, 1);

    Geometry projectileGeom = new Geometry("projectile-geom", sphere);
    projectileGeom.setCullHint(Spatial.CullHint.Always);

    Node node = new Node("projectile");
    node.setLocalTranslation(params.location);
    node.attachChild(projectileGeom);

    // TODO: Give at least bit better material
    Material material = new Material(assets,
            "Common/MatDefs/Misc/Unshaded.j3md");
    material.setColor("Color", ColorRGBA.Yellow);
    node.setMaterial(material);

    node.setUserData(UserData.SPEED, 140f);
    node.setUserData(UserData.MASS, 0.30f);
    node.setUserData(UserData.DAMAGE, 210f);
    node.setUserData(UserData.IMPULSE_FACTOR, 23000f);

    if (world.isClient()) {
        ParticleEmitter fire = createFireEmitter();
        node.attachChild(fire);

        ParticleEmitter smokeTrail = createSmokeEmitter();
        node.attachChild(smokeTrail);

        ParticleEmitter smokePuff = createSmokePuff();
        world.getWorldRoot().attachChild(smokePuff);
        smokePuff.setLocalTranslation(params.location);
        smokePuff.addControl(new CTimedExistence(5f));
        smokePuff.emitAllParticles();

        node.addControl(new CEntityEvent());
        /**
         * Here we specify what happens on client side when fireball is
         * removed. In this case we want explosion effect.
         */
        ARocketRemoval removalAction = new ARocketRemoval(assets);
        removalAction.setFireEmitter(fire);
        removalAction.setSmokeTrail(smokeTrail);

        node.getControl(CEntityEvent.class)
                .setOnRemoval(removalAction);
    }

    SphereCollisionShape collisionShape = new SphereCollisionShape(6f);

    GhostControl characterCollision = new GhostControl(collisionShape);
    characterCollision.setCollideWithGroups(CollisionGroups.CHARACTERS);
    characterCollision.setCollisionGroup(CollisionGroups.PROJECTILES);
    node.addControl(characterCollision);
    
    RigidBodyControl physicsBody = new RigidBodyControl(collisionShape,
            (float) node.getUserData(UserData.MASS));
    /**
     * We don't want projectiles to collide with each other so we give them
     * their own collision group and prevent them from colliding with that
     * group.
     */
    physicsBody.setCollisionGroup(CollisionGroups.PROJECTILES);
    physicsBody.setCollideWithGroups(CollisionGroups.NONE);


    node.addControl(physicsBody);

    CProjectile projectileControl = new CProjectile();

    ASplash splash
            = new ASplash(25f, 120f, DistanceScaling.LINEAR, null);
    splash.setSpatial(node);
    projectileControl.setSplashAction(splash);

    node.addControl(projectileControl);
    final CSpellBuff buffControl = new CSpellBuff();
    node.addControl(buffControl);
    return node;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:81,代码来源:RocketLauncher.java

示例15: build

import com.jme3.bullet.control.GhostControl; //导入方法依赖的package包/类
@Override
public Node build(BuildParameters params) {
    Sphere sphere = new Sphere(32, 32, 1.0f);

    Geometry projectileGeom = new Geometry("projectile-geom", sphere);

    Node node = new Node("projectile");
    node.setLocalTranslation(params.location);
    node.attachChild(projectileGeom);

    Material material
            = new Material(assets, "Common/MatDefs/Misc/Unshaded.j3md");
    material.setColor("Color", ColorRGBA.Black);
    node.setMaterial(material);

    node.setUserData(UserData.SPEED, 150f);
    node.setUserData(UserData.MASS, 0.30f);
    node.setUserData(UserData.DAMAGE, 140f);
    node.setUserData(UserData.IMPULSE_FACTOR, 0f);

    if (world.isClient()) {
        ParticleEmitter purple = createPurpleEmitter();
        node.attachChild(purple);

        node.addControl(new CEntityEvent());

        AOrbRemoval removalAction = new AOrbRemoval();
        removalAction.setPurpleEmitter(purple);

        node.getControl(CEntityEvent.class).setOnRemoval(removalAction);
    }

    SphereCollisionShape collisionShape = new SphereCollisionShape(3);
    RigidBodyControl physicsBody = new RigidBodyControl(collisionShape,
            (float) node.getUserData(UserData.MASS));
    /**
     * We don't want projectiles to collide with each other so we give them
     * their own collision group and prevent them from colliding with that
     * group.
     */
    physicsBody.setCollisionGroup(CollisionGroups.PROJECTILES);
    physicsBody.removeCollideWithGroup(CollisionGroups.PROJECTILES);

    /**
     * Add collision group of characters
     */
    GhostControl characterCollision = new GhostControl(collisionShape);
    characterCollision.setCollideWithGroups(CollisionGroups.CHARACTERS);
    characterCollision.setCollisionGroup(CollisionGroups.PROJECTILES);
    node.addControl(characterCollision);

    node.addControl(physicsBody);

    node.addControl(new CProjectile());
    CSpellBuff buffControl = new CSpellBuff();
    node.addControl(buffControl);
    buffControl.addBuff(new ReduceCooldownBuff.MyBuilder(0));

    return node;
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:61,代码来源:ShadowOrb.java


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