Can someone help me with this blueprint code please? when I play the game the line traces are all wrong.



image

When I run this code the line trace hits in wrong directions.


The above image shows three directions which I shot at.

  1. Right down towards the feet
  2. straight ahead towards the horizon
  3. straight up into the sky.
    You can see the line trace is going in wrong directions.

In the pick up weapons / pickup ammo line trace, shown above, which are different from this one, everything works well.
Any help would get me moving forward.
Thanks in advance and may you be well.

The only thing that looks a bit strange, is taking the forward vector from that camera variable.

What is it!?

Surely taking the vector from the weapon is a better idea ( as long as X is pointing down the barrel )?

1 Like

Hi @ClockworkOcean, Thanks for taking the time to look at my code. This was a strange thing! I converted the second pin in the multiply node to a variable and gave it the value of 10000. But when I created a new variable in the variable section on the left and then added that to the pin, everything worked correctly. I tried this several times and got the same result.
It must be some compilation thing.

As for the forward vector from the camera, if I took it from the gun, it would not point at the centre of the screen where the cross-hair is, would it? But as you suggest I will try that too.

1 Like

Ah, ok, I don’t know your full setup.

Glad to hear it’s working :smiley:

1 Like