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

char1.setLocalTranslation(new Vector3f(70, 0, 120));
char2.setLocalTranslation(new Vector3f(80, 0, 130));

final Vector3f aimingPosition = char1.getLocalTranslation();
final Vector3f aimingDirection = target.subtract(aimingPosition);
ray = new Ray(aimingPosition, aimingDirection);



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.

ok crap i think the problem is my 3d math :slight_smile:
i attached the emitters to my root node instead. the it looks correct. So i probably need to adjust ray.direction to the characters local direction

thanks all

you might need to normalize your direction vector. Not sure where target and so on comes from, so it’s hard to say :smiley: