# Explain why line trace works if converting multiply node to single precision float

Hello there. I recently picked up unreal and I came across something I do not quite understand. Coming from Unity, I wanted to make a forward raycast for handling interaction. The ray would need to be cast x meters forward, and rotate with the camera.

I followed the unreal tutorial on linetrace, but I noticed that while working, it would not rotate only on the left/right axis:

A user on discord suggested converting this into a float, which did end up working and not it follows the rotation in any direction. Could please someone go into detail as to why this is so? Chat gpt did not quite manage to provide a good answer.

Thank you!

1 Like

The float method is the standard one. Youâ€™re just multiplying the forward vector by a certain length, and then adding it to the camera.

The method you had previously is incorrect, thatâ€™s why it didnâ€™t work

PS: The conversion throws the rest of the vector away, itâ€™s just a float.

1 Like

It also works if you multiply the three values by the same number.
â€śGet forwar vectorâ€ť generates the direction of the vector, multiplication adds magnitude
An example in 2d for example the dirrection is X= 0.5, Y= 0.5 you multiply the 2 results so X= 125 and Y= 125
But what you have done is just multiply one of them so the resulting position is X= 0.5 Y= 125.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.