Hi All
Im a little stuck with my shooting game, My character walks around and shoots other characters. Im using ray casting and things looking great. I got the correct characters dying. I need to give the players a sense of where these bullets are coming from so i wanted to create a smoke trail effect along the ray created by shooting. How ever the trail looks wrong, the trail looks like its going somewhere else even though the correct characters are getting hit and dying.
so i have simplified the code here
[java]
char1.setLocalTranslation(new Vector3f(70, 0, 120));
char2.setLocalTranslation(new Vector3f(80, 0, 130));
char1.attachChild(smokeTrail);
final Vector3f aimingPosition = char1.getLocalTranslation();
final Vector3f aimingDirection = target.subtract(aimingPosition);
ray = new Ray(aimingPosition, aimingDirection);
System.out.println(“start:”+ray.getOrigin());
System.out.println(“direction:”+ray.getDirection());
smokeTrail.getParticleInfluencer().setInitialVelocity(ray.getDirection());
smokeTrail.getParticleInfluencer().setVelocityVariation(0);
smokeTrail.emitAllParticles();
[/java]
from the sys-outs i see the the start of the ray and direction are the correct world co-ordinates. but ray looks off. Perhaps in not understanding what setInitialVelocity is?
any help would be greatly appreciated.