# My vector math is wrong. How do I shoot flames behind my spatial?

So the issue is that my flames are shooting straight down instead of in the reverse direction my ship is flying. Here’s an example screenshot:

And here is the code:

``````            Vector3f newDest = dest.clone();
Vector3f newSrs = src.clone();
//subtract to get direction from dest to src
Vector3f vec = newDest.subtract(newSrs);
//normalize
vec.normalizeLocal();
//negate so it goes other direction?
vec.negateLocal();
//my two distance vectors
Vector3f real = vec.mult(2f);
Vector3f real2 = vec.mult(3f);

//tonegod specific particle emitter code, jut to show how I'm using it
e1.getInfluencer(DestinationInfluencer.class).removeAll();
``````

Any ideas on where I’m going wrong with the vector math? I thought this should have been very simple but I must be doing something wrong.

Your code seems correct (except it create lot of useless Vector3f). Are you sure about the value of dest and src.

simplification

``````            Vector3f vec = src.subtract(dest); // substract create a clone and let operand asis
//normalize
vec.normalizeLocal();
//my two distance vectors
Vector3f real = vec.mult(2f);
Vector3f real2 = vec.mult(3f);

//tonegod specific particle emitter code, jut to show how I'm using it
e1.getInfluencer(DestinationInfluencer.class).removeAll();
``````

I’ll double check, they’re the same values I’m using to move the actual ship but I might be passing them in the wrong order.

So here is the output of my printlines on initiation of the code:

``````animation origin: (-71.0, 8.75, -8.0)
animation dest: (-68.51627, -10.781976, -8.717797)
Source (in emitter code): (-71.0, 8.75, -8.0)
Dest (in emitter code): (-68.51627, -10.781976, -8.717797)
direction: (-2.4837265, 19.531975, 0.7177973)
normalized direction: (-0.12606253, 0.99135315, 0.036432084)
negated normalized direction: (0.12606253, -0.99135315, -0.036432084)
destination (direction x2): (0.25212505, -1.9827063, -0.07286417)
``````

This looks good I think… as long as the destination influencer is relative to the source of the emitter, which I’m not exactly sure about.

Is it possible that since I had to rotate the node this is being attached to (prior to adding the emitter) that this is somehow affecting the direction of the emission?