What does raycast.unit * 100 actually accomplish?

Recently, I’ve been experimenting with raycasts for guns and noticed that my raycasts weren’t very precise, they only detected a humanoid sometimes, and they couldn’t detect walls in front of them.

I have an understanding of what .unit does, but what’s the difference between a vector with x magnitude and a vector with a magnitude of 100? how does a vector with a magnitude of 100 make the vector more precise, directionally?

Thanks.

1 Like

Well .Unit is used to normalize a Vector, and Magnitude by definition is the length of a vector; so in your case a greater magnitude means it can reach further and hit whatever you need, a ray with less magnitude won’t

And I wouldn’t really say precise because rays just go in a straight/one direction, there really isn’t room for precision it’s just how long does this ray have to be to hit what I need it to hit

It doesn’t—they point in the same direction. The 100-magnitude one is just longer.

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