Question by
TeaLord1 · Jan 27, 2018 at 10:47 PM ·
scripting problemraycasting
Why does this raycast not go in a straight line?,
Hi, I tried looking through all the docs and messed with my code for a couple hours before asking but I just can't figure this out.
I want my raycast to shoot in a straight line in the x direction of my mouse and a y coordinate based on my character.
Here is my code
I don't understand for the life of me how the y coordinate of the end of the ray doesn't line up with the origin y coordinate when they both use the same y coordinate. The origin is consistent but why is this ray not just going straight from my character to my enemy. Thank you.,
code.png
(20.4 kB)
Comment
Best Answer
Answer by Hamburgert · Jan 28, 2018 at 04:43 PM
Your direction.y needs to be zero if you want to raycast straight ahead.