I am trying to throw fireball using following code,
But, when I attach the particle emitter(pe_fire) to the physicsNode (pn_fire), none the debugShape of pn_fire nor the particle emitter appears. But, if i remove the particle emitter from the physics node, then the debug shape appears. But, I they dont fly together.
[java] public void throwFireball()
{
pe_fire = new ParticleEmitter("Emitter", Type.Triangle, 100);
Material mat_red = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
mat_red.setTexture("m_Texture", assetManager.loadTexture("Effects/Explosion/flame.png"));
pe_fire.setMaterial(mat_red);
pe_fire.setImagesX(2); pe_fire.setImagesY(2); // 2x2 texture animation
pe_fire.setEndColor( new ColorRGBA(1f, 0f, 0f, 1f)); // red
pe_fire.setStartColor(new ColorRGBA(1f, 1f, 0f, 0.5f)); // yellow
pe_fire.setInitialVelocity(new Vector3f(0, 7, 0));
pe_fire.setStartSize(2.5f);
pe_fire.setEndSize(.1f);
pe_fire.setGravity(0);
pe_fire.setLowLife(0.5f);
pe_fire.setHighLife(2.75f);
pe_fire.setVelocityVariation(0.3f);
pe_fire.setRandomAngle(true);
pe_fire.setRotateSpeed(5);
pe_fire.setParticlesPerSec(3);
pe_fire.emitAllParticles();
SphereCollisionShape cs_fire = new SphereCollisionShape(3);
pn_fire = new PhysicsNode(pe_fire, cs_fire, 1);
pn_fire.setLocalTranslation(-300,13, 122);
pn_fire.attachDebugShape(assetManager);
rootNode.attachChild(pn_fire);
bulletAppState.getPhysicsSpace().add(pn_fire);
pn_fire.setGravity(new Vector3f(0,-3,0));
pn_fire.applyImpulse(pn_fire.getLocalTranslation().subtract(pn_player.getLocalTranslation()).normalizeLocal().mult(100).negate(), Vector3f.ZERO/pn_fire.getLocalTranslation()/);
}[/java]
This code is triggered at 5 sec interval from simpleUpdate.
One more things, Particles shows artifacts when SSAO is on. The transparent parts of a particle becomes black shaded.
Ive found a weird thing.
In my Laptop, where Ive Geforce 210, after the fireball is thrown, if i loss focus of the frame where the fireball should be and then come back to see it again, I see the fireball where is should be, flying towards the player.
This happens regularly when im testing with my GeForce.
But, in my radeon, i dont even see the fireball regularly.
It is like the scene is not updating while im looking at it.